mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
MINOR Testing languages without fallbacks (related to #7386)
This commit is contained in:
parent
ad6b7a40ee
commit
c3d8d82d52
3
tests/i18n/_fakewebroot/i18ntestmodule/lang/mi_NZ.yml
Normal file
3
tests/i18n/_fakewebroot/i18ntestmodule/lang/mi_NZ.yml
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
mi_NZ:
|
||||||
|
i18nTestModule:
|
||||||
|
ENTITY: Translation (mi_NZ)
|
@ -431,6 +431,30 @@ class i18nTest extends SapphireTest {
|
|||||||
|
|
||||||
SS_ClassLoader::instance()->popManifest();
|
SS_ClassLoader::instance()->popManifest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testIncludeByLocaleWithoutFallbackLanguage() {
|
||||||
|
$classManifest = new SS_ClassManifest($this->alternateBasePath, true, true, false);
|
||||||
|
SS_ClassLoader::instance()->pushManifest($classManifest);
|
||||||
|
|
||||||
|
$adapter = i18n::get_translator('core')->getAdapter();
|
||||||
|
$this->assertTrue($adapter->isAvailable('en'));
|
||||||
|
$this->assertFalse($adapter->isAvailable('mi')); // not defined at all
|
||||||
|
$this->assertFalse($adapter->isAvailable('mi_NZ')); // defined, but not loaded yet
|
||||||
|
$this->assertFalse($adapter->isTranslated('i18nTestModule.ENTITY', 'mi'),
|
||||||
|
'Existing unloaded entity not available before call'
|
||||||
|
);
|
||||||
|
$this->assertFalse($adapter->isTranslated('i18nTestModule.ENTITY', 'mi_NZ'),
|
||||||
|
'Non-existing unloaded entity not available before call'
|
||||||
|
);
|
||||||
|
|
||||||
|
i18n::include_by_locale('mi_NZ');
|
||||||
|
|
||||||
|
$this->assertFalse($adapter->isAvailable('mi'));
|
||||||
|
$this->assertTrue($adapter->isAvailable('mi_NZ'));
|
||||||
|
$this->assertTrue($adapter->isTranslated('i18nTestModule.ENTITY', null, 'mi_NZ'), 'Includes module files');
|
||||||
|
|
||||||
|
SS_ClassLoader::instance()->popManifest();
|
||||||
|
}
|
||||||
|
|
||||||
function testRegisterTranslator() {
|
function testRegisterTranslator() {
|
||||||
$translator = new Zend_Translate(array(
|
$translator = new Zend_Translate(array(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user