function merge($d) { $dictionary = new lmbI18NDictionary($this->getTranslations()); $translations = $d->getTranslations(); foreach ($translations as $text => $translation) { $dictionary->add($text, $translation); } return $dictionary; }
function testUseCustomDomain() { $domain = 'my_domain'; $dictionary = new lmbI18NDictionary(); $dictionary->add('Apply filter', 'Применить фильтр'); $this->toolkit->addLocaleObject(new lmbLocale('ru'), 'ru'); $this->toolkit->setDictionary('ru', $domain, $dictionary); $this->toolkit->setLocale('ru'); $out = $this->_createMacroTemplate('{$var|i18n:$domain}')->render(array('var' => 'Apply filter', 'domain' => $domain)); $this->assertEqual($out, 'Применить фильтр'); }
function testDBEVariable() { $dictionary = new lmbI18NDictionary(); $dictionary->add('Apply filter', 'Применить фильтр'); $this->toolkit->setDictionary('ru', 'foo', $dictionary); $this->toolkit->setLocale('ru'); $template = '{$var|i18n:"foo"}'; $this->registerTestingTemplate('/limb/locale_string_filter_dbe.html', $template); $page = $this->initTemplate('/limb/locale_string_filter_dbe.html'); $page->set('var', 'Apply filter'); $this->assertTrue($page->capture(), 'Применить фильтр'); }
function testHasNotSameEntries() { $d1 = new lmbI18NDictionary(); $d1->add('Foo', 'Foo'); $d1->add('Test'); $d2 = new lmbI18NDictionary(); $d2->add('Test'); $d2->add('Bar'); $this->assertFalse($d1->hasSameEntries($d2)); }
function testUnfinishedTranslations() { $d = new lmbI18NDictionary(); $back = new lmbQtDictionaryBackend(); $d->add('Foo'); $d->add('Bar', 'Бар'); $dom = $back->getDOMDocument($d); $translations = $dom->getElementsByTagName('translation'); $this->assertEqual($translations->item(0)->getAttribute('type'), 'unfinished'); $this->assertFalse($translations->item(1)->hasAttribute('type')); }