Ejemplo n.º 1
0
 /**
  * Constructor
  *
  * @param TranslatorInterface $translator Main VuFind translator
  */
 public function __construct(TranslatorInterface $translator)
 {
     $this->translator = $translator;
     try {
         $this->translator->addTranslationFile('ExtendedIni', APPLICATION_PATH . '/languages/native.ini', 'default', 'native');
         $this->translator->setLocale('native');
     } catch (\Zend\Mvc\Exception\BadMethodCallException $e) {
         if (!extension_loaded('intl')) {
             throw new \Exception('Translation broken due to missing PHP intl extension.' . ' Please disable translation or install the extension.');
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * Constructor
  *
  * @param TranslatorInterface $translator Main VuFind translator
  */
 public function __construct(TranslatorInterface $translator)
 {
     // Clone the translator; we need to switch language for the purposes
     // of this plugin, but we don't want that change to happen globally.
     $this->translator = clone $translator;
     try {
         $this->translator->addTranslationFile('ExtendedIni', APPLICATION_PATH . '/languages/native.ini', 'default', 'native');
         $this->translator->setLocale('native');
     } catch (\Zend\Mvc\Exception\BadMethodCallException $e) {
         if (!extension_loaded('intl')) {
             throw new \Exception('Translation broken due to missing PHP intl extension.' . ' Please disable translation or install the extension.');
         }
     }
 }