Пример #1
0
 /**
  * @param I18NContext $context
  * @param I18NFileHelper $fileHelper
  */
 function init(I18NContext $context, I18NFileHelper $fileHelper)
 {
     $this->context = $context;
     $adminFactory = new Translation2AdminFactory();
     $adminFactory->setContext($context);
     $repo = new I18NAdminRepository();
     $repo->setFileHelper($fileHelper);
     $repo->setAdminFactory($adminFactory);
     $repo->load();
     $tr_admin = new Translation2AdminWrapper();
     $tr_admin->setContext($context);
     $tr_admin->setRepository($repo);
     $phraseDataFactory = new PhraseDataFactory();
     $phraseDataFactory->setLanguageDataSource($this->languageDataSource);
     $phraseDataFactory->setTranslationDataSource($this->translationDataSource);
     $this->languageDataSource->setContext($context);
     $this->languageDataSource->setTranslator($tr_admin);
     $this->languageDataSource->setTrAdmin($tr_admin);
     $this->domainDataSource->setContext($context);
     $this->domainDataSource->setTranslator($tr_admin);
     $this->domainDataSource->setTrAdmin($tr_admin);
     $this->translationDataSource->setContext($context);
     $this->translationDataSource->setTranslator($tr_admin);
     $this->translationDataSource->setTrAdmin($tr_admin);
     $this->phraseDataSource->setContext($context);
     $this->phraseDataSource->setTranslator($tr_admin);
     $this->phraseDataSource->setTrAdmin($tr_admin);
     $this->phraseDataSource->setPhraseDataFactory($phraseDataFactory);
 }
Пример #2
0
 function &getDomainPhrases($domainId)
 {
     $page = $this->tr->getRawPage($domainId, $this->context->getDefaultLang());
     $phrases = array();
     foreach (array_keys($page) as $phraseId) {
         $phrases[] =& $this->getPhraseData($phraseId, $domainId);
     }
     return $phrases;
 }
Пример #3
0
 function gettext($phrase_id, $domain_id, $lang)
 {
     return $this->tr->get($phrase_id, $domain_id, $lang);
 }
Пример #4
0
 function exportLanguage($lang_id)
 {
     return $this->tr_admin->exportLang($lang_id);
 }
Пример #5
0
 function addDomain($name)
 {
     $i18n = SJB_ObjectMother::createI18N();
     $langs_data = $i18n->getLanguagesData();
     return $this->tr_admin->addPage($name, $langs_data);
 }