MINOR Testing languages without fallbacks (related to #7386)

This commit is contained in:
Ingo Schommer 2012-05-29 13:54:49 +02:00
parent ad6b7a40ee
commit c3d8d82d52
2 changed files with 27 additions and 0 deletions

View File

@ -0,0 +1,3 @@
mi_NZ:
i18nTestModule:
ENTITY: Translation (mi_NZ)

View File

@ -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(