예제 #1
0
 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);
 }
예제 #2
0
 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());
 }
예제 #3
0
 /**
  * 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);
 }
예제 #4
-1
파일: i18n.php 프로젝트: bl00m/ampache
/**
 * 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();
}