Пример #1
0
 function &getAllPhrases(&$domainsData)
 {
     $phrasesData = array();
     foreach (array_keys($domainsData) as $i) {
         $domainData =& $domainsData[$i];
         $domainPhrases =& $this->dataSource->getDomainPhrases($domainData->getID());
         $phrasesData = array_merge($phrasesData, $domainPhrases);
     }
     return $phrasesData;
 }
Пример #2
0
 /**
  * @param string $value
  * @return bool
  */
 function isValid($value)
 {
     if (SJB_Request::getVar('fast', null)) {
         $language = $this->langDataSource->getLanguageData($value);
         if ($language instanceof LangData) {
             return true;
         }
         return false;
     }
     $languages = $this->langDataSource->getLanguagesData();
     for ($i = 0; $i < count($languages); $i++) {
         $language = $languages[$i];
         if ((string) $value === (string) $language->getID()) {
             return true;
         }
     }
     return false;
 }
Пример #3
0
 /**
  * @return I18NDataSource
  */
 public static function getInstance()
 {
     $languageDataSource = new I18NLanguageDataSource();
     $phraseDataSource = new I18NPhraseDataSource();
     $translationDataSource = new I18NTranslationDataSource();
     $i18nDataSource = new I18NDataSource();
     $i18nDataSource->setLanguageDataSource($languageDataSource);
     $i18nDataSource->setPhraseDataSource($phraseDataSource);
     $i18nDataSource->setTranslationDataSource($translationDataSource);
     $i18nDataSource->setDomainDataSource(new I18NDomainDataSource());
     return $i18nDataSource;
 }
Пример #4
0
 /**
  * @static
  * @return SJB_I18N
  */
 public static function create()
 {
     $instance = new SJB_I18N();
     $settings = new SJB_Settings();
     $systemSettings = new SJB_System();
     $session = new SJB_Session();
     $dateFormatter = new SJB_DateFormatter();
     $languageSettings = new I18NLanguageSettings();
     $context = new I18NContext();
     $admin = new I18NAdmin();
     $translator = new I18NTranslator();
     $datasource = I18NDataSource::getInstance();
     $langSwitcher = new I18NSwitchLanguageAgent();
     $translationValidatorFactory = new SJB_TranslationValidatorFactory();
     $languageValidatorFactory = new SJB_LanguageValidatorFactory();
     $generalValidationFactory = new GeneralValidationFactory();
     $reflectionFactory = new ReflectionFactory();
     $phraseSearcher = new I18NPhraseSearcher();
     $fullTextMatcher = new FullTextMatcher();
     $phraseSearchCriteriaFactory = new I18NPhraseSearchCriteriaFactory();
     $formatterFactory = new I18NFormatterFactory();
     $fileHelper = new I18NFileHelper();
     $langSwitcher->setContext($context);
     $langSwitcher->setSession($session);
     $langSwitcher->setI18N($instance);
     $context->setSettings($settings);
     $context->setSession($session);
     $context->setLanguageSettings($languageSettings);
     $context->setSystemSettings($systemSettings);
     $fileSystem = SJB_ObjectMother::createFileSystem();
     $fileHelper->setContext($context);
     $fileHelper->setFileSystem($fileSystem);
     $datasource->init($context, $fileHelper);
     $admin->setDataSource($datasource);
     $languageSettings->setContext($context);
     $languageSettings->setDataSource($datasource);
     $translator->setContext($context);
     $translator->setDatasource($datasource);
     $languageValidatorFactory->setContext($context);
     $languageValidatorFactory->setGeneralValidationFactory($generalValidationFactory);
     $languageValidatorFactory->setReflectionFactory($reflectionFactory);
     $languageValidatorFactory->setLanguageDataSource($datasource);
     $translationValidatorFactory->setContext($context);
     $translationValidatorFactory->setGeneralValidationFactory($generalValidationFactory);
     $translationValidatorFactory->setReflectionFactory($reflectionFactory);
     $translationValidatorFactory->setLanguageDataSource($datasource);
     $phraseSearcher->setDataSource($datasource);
     $phraseSearcher->setMatcher($fullTextMatcher);
     $formatterFactory->setContext($context);
     $instance->setTranslator($translator);
     $instance->setAdmin($admin);
     $instance->setLangSwitcher($langSwitcher);
     $instance->setContext($context);
     $instance->setLanguageValidatorFactory($languageValidatorFactory);
     $instance->setTranslationValidatorFactory($translationValidatorFactory);
     $instance->setReflectionFactory($reflectionFactory);
     $instance->setPhraseSearcher($phraseSearcher);
     $instance->setPhraseSearchCriteriaFactory($phraseSearchCriteriaFactory);
     $instance->setFormatterFactory($formatterFactory);
     $instance->setFileHelper($fileHelper);
     return $instance;
 }
Пример #5
0
 /**
  * @return LangData
  */
 function &_getLangData()
 {
     $langData = $this->datasource->getLanguageData($this->context->getLang());
     return $langData;
 }