private function handleLocalizationSalariu($appSettings) { $this->handleLocalizationSalariuInputsIntoSession($appSettings); $this->handleLocalizationSalariuSafe($appSettings); $localizationFile = 'Salariu/locale/' . $this->tCmnSession->get('lang') . '/LC_MESSAGES/salariu.mo'; $translations = new \Gettext\Translations(); $translations->addFromMoFile($localizationFile); $this->tApp = new \Gettext\Translator(); $this->tApp->loadTranslations($translations); }
public function testCreator() { //Extract translations $translations1 = Gettext\Extractors\PhpCode::fromFile(__DIR__ . '/files/phpCode-example.php'); $translations2 = Gettext\Translations::fromPhpCodefile(__DIR__ . '/files/phpCode-example.php'); $this->assertInstanceOf('Gettext\\Translations', $translations1); $this->assertInstanceOf('Gettext\\Translations', $translations2); $this->assertEquals($translations1, $translations2); $result = Gettext\Generators\Po::toString($translations1); $this->assertEquals($result, $translations2->toPoString()); }
/** * Takes care of instatiation of localization libraries * used within current module for multi-languages support * * @return NOTHING */ private function handleLocalizationCommon() { $this->handleLanguageIntoSession(); $localizationFile = $this->getCommonLocaleFolder() . '/locale/' . $this->tCmnSession->get('lang') . '/LC_MESSAGES/' . $this->commonLibFlags['localization_domain'] . '.mo'; $translations = new \Gettext\Translations(); $translations->addFromMoFile($localizationFile); $this->tCmnLb = new \Gettext\Translator(); $this->tCmnLb->loadTranslations($translations); }
/** * load_gettext * Sets up our local gettext settings. * * @return void */ function load_gettext() { $lang = AmpConfig::get('lang'); $popath = AmpConfig::get('prefix') . '/locale/' . $lang . '/LC_MESSAGES/messages.po'; $t = new Translator(); if (file_exists($popath)) { $translations = Gettext\Translations::fromPoFile($popath); $t->loadTranslations($translations); } $t->register(); }