Example #1
0
 /**
  * @internal
  */
 public function getConfig()
 {
     $config = array('controller_plugins' => array('invokables' => array('_' => 'Library\\Mvc\\Controller\\Plugin\\TranslationHelper', 'RedirectToRoute' => 'Library\\Mvc\\Controller\\Plugin\\RedirectToRoute', 'UrlFromRoute' => 'Library\\Mvc\\Controller\\Plugin\\UrlFromRoute')), 'service_manager' => array('factories' => array('\\Library\\Logger' => 'Library\\Log\\LoggerServiceFactory'), 'invokables' => array('Library\\ArchiveManager' => 'Library\\ArchiveManager', 'Library\\Now' => 'DateTime', 'Library\\Random' => 'Library\\Random'), 'shared' => array('Library\\Now' => false)), 'translator_plugins' => array('invokables' => array('Po' => 'Library\\I18n\\Translator\\Loader\\Po')), 'view_helpers' => array('factories' => array('formYesNo' => 'Library\\View\\Helper\\Service\\FormYesNoFactory', 'htmlTag' => 'Library\\View\\Helper\\Service\\HtmlTagFactory'), 'invokables' => array('formSelectSimple' => 'Library\\View\\Helper\\FormSelectSimple', 'formSelectUntranslated' => 'Library\\View\\Helper\\FormSelectUntranslated')));
     $config += Application::getTranslationConfig(static::getPath('data/i18n'));
     if (\Locale::getPrimaryLanguage(\Locale::getDefault()) != 'en') {
         $zfTranslations = @($appConfig = Application::getConfig()['paths']['Zend translations']);
         if (is_dir($zfTranslations)) {
             $locale = \Locale::getDefault();
             $translationFile = "{$zfTranslations}/{$locale}/Zend_Validate.php";
             if (!is_file($translationFile)) {
                 $locale = \Locale::getPrimaryLanguage($locale);
                 $translationFile = "{$zfTranslations}/{$locale}/Zend_Validate.php";
                 if (!is_file($translationFile)) {
                     $translationFile = null;
                 }
             }
             if ($translationFile) {
                 $config['translator']['translation_files'][] = array('type' => 'phparray', 'filename' => $translationFile, 'text_domain' => 'Zend');
             }
         }
     }
     return $config;
 }
Example #2
0
 /**
  * @internal
  */
 public function getConfig()
 {
     $config = (require __DIR__ . '/../module.config.php');
     $config += \Library\Application::getTranslationConfig(static::getPath('data/i18n'));
     return $config;
 }
 public function testGetTranslationConfigNoFile()
 {
     $locale = \Locale::getDefault();
     \Locale::setDefault('de_DE');
     $basePath = vfsStream::setup('root');
     $this->assertEquals(array(), Application::getTranslationConfig($basePath->url()));
     \Locale::setDefault($locale);
 }