/**
  * Create a new GettextZendTranslator and configure it with passed params
  * @param string|Zend_Locale $given_locale
  * @param string $filename
  * @param boolean $default_instance If none instance yet, this instance will be used whatever this param value is
  */
 public function __construct($given_locale = null, $filename = null, $default_instance = true)
 {
     if ($filename != null) {
         $this->filename = $filename;
     }
     self::$absolutePath = Config::getInstance()->getString('appRootDir') . self::DIR_LOCALES;
     $this->debugMode = Config::getInstance()->getBoolean('i18n/gettextZendTranslator/debug', false);
     $path = self::$absolutePath . self::DEFAULT_LOCALE . '/' . $this->filename;
     parent::__construct(self::GETTEXT, $path, self::DEFAULT_LOCALE);
     // Adding other existing locales
     $locales = $this->getAvailableLocales();
     foreach ($locales as $locale) {
         if ($locale != self::DEFAULT_LOCALE) {
             parent::addTranslation(self::$absolutePath . $locale . '/' . $this->filename, $locale);
         }
     }
     if ($given_locale == null) {
         if (($given_locale = Zend_Registry::get('Zend_Locale')) == null) {
             $given_locale = self::DEFAULT_LOCALE;
         }
     }
     $this->setLocale($given_locale);
     Zend_Registry::set('Zend_Translator', $this);
     if ($default_instance || self::$instance == null) {
         self::$instance = $this;
     }
 }
Example #2
0
 /**
  * Current module
  *
  * @param  array $options
  */
 public function __construct($options = array())
 {
     if (Axis_Area::isInstaller() || !Axis::config('core/translation/autodetect')) {
         self::setCache(Axis::cache());
     }
     $this->_module = $options['module'];
     $locale = $this->getLocale();
     $filename = $this->_getFileName($locale);
     if (!is_readable($filename)) {
         $locale = Axis_Locale::DEFAULT_LOCALE;
         $filename = $this->_getFileName($locale);
     }
     // custom modules can be without translation for default locale
     if (!is_readable($filename)) {
         $filename = $this->_getSafeFileName();
     }
     parent::__construct(array('adapter' => self::AN_CSV, 'content' => $filename, 'locale' => $locale, 'delimiter' => ','));
 }
Example #3
0
 /**
  * Constructor
  *
  * @return void
  */
 public function __construct($contentFile, $locale)
 {
     $this->_contentFile = $contentFile;
     parent::__construct($this->getConfig());
 }
Example #4
0
 /**
  * Konstruiert Klasse für Übersetzungen in OPUS Applikation.
  */
 public function __construct($options = null)
 {
     $options = !is_null($options) ? array_merge($this->getOptions(), $options) : $this->getOptions();
     parent::__construct($options);
 }
 function __construct()
 {
     parent::__construct('gettext', Globals::$BASE_PATH . '/translations/en_EN.UTF-8/LC_MESSAGES/itech.mo', 'en_EN.UTF-8');
 }