本文整理汇总了PHP中Translatable::set_default_locale方法的典型用法代码示例。如果您正苦于以下问题:PHP Translatable::set_default_locale方法的具体用法?PHP Translatable::set_default_locale怎么用?PHP Translatable::set_default_locale使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translatable
的用法示例。
在下文中一共展示了Translatable::set_default_locale方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tear_down_once
static function tear_down_once()
{
if (!self::$origTranslatableSettings['has_extension']) {
Object::remove_extension('SiteTree', 'Translatable');
}
Translatable::set_default_locale(self::$origTranslatableSettings['default_locale']);
self::kill_temp_db();
self::create_temp_db();
parent::tear_down_once();
}
示例2: testAutoDetectLanguage
/**
* Tests to see if the controller responds correctly if the language is in the url
*/
public function testAutoDetectLanguage()
{
//Set accept language to french
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr-FR,fr;q=0.5';
Translatable::set_default_locale('fr_FR');
Translatable::set_current_locale('fr_FR');
i18n::set_locale('fr_FR');
//Perform Request
$response = $this->get('MultilingualTestController');
//Ensure a 200 response
$this->assertEquals(200, $response->getStatusCode());
//Verify the response matches what is expected
$this->assertEquals('i18n: fr_FR|Translatable: fr_FR', $response->getBody());
}
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-translatablerouting,代码行数:17,代码来源:MultilingualControllerTest.php
示例3: tear_down_once
static function tear_down_once()
{
if (class_exists('Translatable')) {
if (self::$origTranslatableSettings['has_extension']) {
Object::add_extension('SiteTree', 'Translatable');
Object::add_extension('SiteConfig', 'Translatable');
}
Translatable::set_default_locale(self::$origTranslatableSettings['default_locale']);
Translatable::set_current_locale(self::$origTranslatableSettings['default_locale']);
}
self::kill_temp_db();
self::create_temp_db();
parent::tear_down_once();
}
示例4: tearDown
public function tearDown() {
parent::tearDown();
Translatable::set_default_locale($this->translatableDefaultLocale);
}
示例5: testFrenchShouldBeRoot
/**
* Tests to see if the french home page is the root url and the english home page is not for french browsers
*/
public function testFrenchShouldBeRoot()
{
//Set accept language to french
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr-FR,fr;q=0.5';
Translatable::set_default_locale('fr_FR');
Translatable::set_current_locale('fr_FR');
i18n::set_locale('fr_FR');
$default = $this->objFromFixture('Page', 'home');
$defaultFR = $this->objFromFixture('Page', 'home_fr');
$this->assertEquals(false, MultilingualRootURLController::should_be_on_root($default));
$this->assertEquals(true, MultilingualRootURLController::should_be_on_root($defaultFR));
}
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-translatablerouting,代码行数:15,代码来源:MultilingualModelAsControllerTest.php
示例6: testFrenchGetHomepageLink
/**
* Verifies the correct home page is detected for the french locale
*/
public function testFrenchGetHomepageLink()
{
//Set accept language to french
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr-FR,fr;q=0.5';
Translatable::set_default_locale('fr_FR');
Translatable::set_current_locale('fr_FR');
i18n::set_locale('fr_FR');
$this->assertEquals('maison', MultilingualRootURLController::get_homepage_link());
}
开发者ID:helpfulrobot,项目名称:webbuilders-group-silverstripe-translatablerouting,代码行数:12,代码来源:MultilingualRootURLControllerTest.php
示例7: tearDown
function tearDown()
{
Translatable::set_default_locale($this->origLocale);
Translatable::set_current_locale($this->origLocale);
parent::tearDown();
}
示例8: array
<?php
LeftAndMain::require_css('express/css/custom.css');
SiteTree::add_extension('ExpressSiteTree');
ContentController::add_extension('ExpressSiteTree_Controller');
SiteConfig::add_extension('CustomSiteConfig');
// Don't allow h1 in the editor
HtmlEditorConfig::get('cms')->setOption('theme_advanced_blockformats', 'p,pre,address,h2,h3,h4,h5,h6');
// Add in start and type attributes for ol
HtmlEditorConfig::get('cms')->setOption('extended_valid_elements', 'img[class|src|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|usemap],iframe[src|name|width|height|title|align|allowfullscreen|frameborder|marginwidth|marginheight|scrolling],object[width|height|data|type],param[name|value],map[class|name|id],area[shape|coords|href|target|alt],ol[start|type]');
// Macrons
HtmlEditorConfig::get('cms')->enablePlugins(array('ssmacron' => '../../../framework/thirdparty/tinymce_ssmacron/editor_plugin_src.js'));
HtmlEditorConfig::get('cms')->insertButtonsAfter('charmap', 'ssmacron');
GD::set_default_quality(90);
FulltextSearchable::enable();
// Configure document converter.
if (class_exists('DocumentConverterDecorator')) {
DocumentImportIFrameField_Importer::set_docvert_username('ss-express');
DocumentImportIFrameField_Importer::set_docvert_password('hLT7pCaJrYVz');
DocumentImportIFrameField_Importer::set_docvert_url('http://docvert.silverstripe.com:8888/');
Page::add_extension('DocumentConverterDecorator');
}
// Default translations
if (class_exists('Translatable')) {
Translatable::set_default_locale('en_NZ');
Translatable::set_allowed_locales(array('en_NZ', 'mi_NZ', 'zh_cmn', 'en_GB'));
SiteTree::add_extension('Translatable');
SiteConfig::add_extension('Translatable');
}
Config::inst()->update('i18n', 'common_locales', array("mi_NZ" => array(0 => 'Māori')));
Config::inst()->update('i18n', 'common_languages', array("mi" => array(0 => 'Māori')));