Пример #1
0
 /**
  * Construct the translator.
  *
  * @param ServiceManager $sm Service manager.
  *
  * @return \Zend\I18n\Translator\Translator
  */
 public static function getTranslator(ServiceManager $sm)
 {
     $factory = new \Zend\I18n\Translator\TranslatorServiceFactory();
     $translator = $factory->createService($sm);
     // Set up the ExtendedIni plugin:
     $config = $sm->get('VuFind\\Config')->get('config');
     $pathStack = array(APPLICATION_PATH . '/languages', LOCAL_OVERRIDE_DIR . '/languages');
     $fallbackLocales = null;
     $translator->getPluginManager()->setService('extendedini', new \VuFind\I18n\Translator\Loader\ExtendedIni($pathStack, $fallbackLocales));
     // Set up language caching for better performance:
     try {
         $translator->setCache($sm->get('VuFind\\CacheManager')->getCache('language'));
     } catch (\Exception $e) {
         // Don't let a cache failure kill the whole application, but make
         // note of it:
         $logger = $sm->get('VuFind\\Logger');
         $logger->debug('Problem loading cache: ' . get_class($e) . ' exception: ' . $e->getMessage());
     }
     return $translator;
 }
Пример #2
0
}, 'logger' => function ($sm) {
    $logger = new \VuFind\Log\Logger();
    $logger->setServiceLocator($sm);
    $logger->setConfig(\VuFind\Config\Reader::getConfig());
    return $logger;
}, 'mailer' => function ($sm) {
    $mailer = new \VuFind\Mailer();
    $mailer->setTranslator($sm->get('Translator'));
    return $mailer;
}, 'sms' => function ($sm) {
    $sms = new \VuFind\Mailer\SMS();
    $sms->setTranslator($sm->get('Translator'));
    return $sms;
}, 'translator' => function ($sm) {
    $factory = new \Zend\I18n\Translator\TranslatorServiceFactory();
    $translator = $factory->createService($sm);
    // Set up the ExtendedIni plugin:
    $translator->getPluginManager()->setService('extendedini', new \VuFind\I18n\Translator\Loader\ExtendedIni());
    // Set up language caching for better performance:
    $translator->setCache($sm->get('CacheManager')->getCache('language'));
    return $translator;
}, 'worldcatconnection' => function ($sm) {
    $wc = new \VuFind\Connection\WorldCat();
    $wc->setLogger($sm->get('Logger'));
    return $wc;
}, 'worldcatutils' => function ($sm) {
    $wcu = new \VuFind\Connection\WorldCatUtils();
    $wcu->setLogger($sm->get('Logger'));
    return $wcu;
}), 'invokables' => array('authmanager' => 'VuFind\\Auth\\Manager', 'cart' => 'VuFind\\Cart', 'cachemanager' => 'VuFind\\Cache\\Manager', 'recordloader' => 'VuFind\\Record\\Loader', 'searchspecsreader' => 'VuFind\\Config\\SearchSpecsReader', 'sessionmanager' => 'Zend\\Session\\SessionManager')), 'session_plugin_manager' => array('abstract_factories' => array('VuFind\\Session\\PluginFactory'), 'invokables' => array('database' => 'VuFind\\Session\\Database', 'file' => 'VuFind\\Session\\File', 'memcache' => 'VuFind\\Session\\Memcache'), 'aliases' => array('filesession' => 'File', 'memcachesession' => 'Memcache', 'mysqlsession' => 'Database')), 'statistics_driver_plugin_manager' => array('abstract_factories' => array('VuFind\\Statistics\\Driver\\PluginFactory'), 'invokables' => array('db' => 'VuFind\\Statistics\\Driver\\Db', 'file' => 'VuFind\\Statistics\\Driver\\File', 'solr' => 'VuFind\\Statistics\\Driver\\Solr'), 'aliases' => array('database' => 'db')), 'translator' => array(), 'view_manager' => array('display_not_found_reason' => APPLICATION_ENV == 'development', 'display_exceptions' => APPLICATION_ENV == 'development', 'not_found_template' => 'error/404', 'exception_template' => 'error/index', 'template_path_stack' => array()));
// Define record view routes -- route name => controller