Example #1
0
 /**
  * Init the translator of the application.
  * @param $locale Locale to use for the translator
  */
 private static function initTranslator($locale)
 {
     $translatorClassName = Config::getInstance()->getString('properties/translator', 'I18nUtil');
     if (class_exists($translatorClassName)) {
         $translator = new $translatorClassName();
         if ($translator instanceof ITranslator) {
             self::$translator = $translator;
             self::$translator->setLocale(self::getSupportedLocale($locale));
         } else {
             throw new ConfigurationException("The properties/translator configuration class does not implement ITranslator interface.");
         }
     } else {
         throw new ConfigurationException("The properties/translator configuration parameter is invalid.");
     }
 }