示例#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);
 }
 function exportLang($lang_id)
 {
     $trAdmin = $this->repo->get($lang_id);
     return $trAdmin->storage->exportLang();
 }