diff --git a/module/VuFind/config/module.config.php b/module/VuFind/config/module.config.php index a9bb5fe73066d42fe3ee2f49ea54e632700ec3a8..246aa1d8d9b243fed4ef06b730d1c33c642e2b33 100644 --- a/module/VuFind/config/module.config.php +++ b/module/VuFind/config/module.config.php @@ -345,19 +345,17 @@ $config = [ 'VuFind\SMS\SMSInterface' => 'VuFind\SMS\Factory', 'VuFind\Solr\Writer' => 'VuFind\Solr\WriterFactory', 'VuFind\Tags' => 'VuFind\TagsFactory', - 'VuFind\Translator' => 'VuFind\Service\Factory::getTranslator', 'VuFind\WorldCatUtils' => 'VuFind\Service\Factory::getWorldCatUtils', 'VuFindHttp\HttpService' => 'VuFind\Service\Factory::getHttp', 'VuFindSearch\Service' => 'VuFind\Service\Factory::getSearchService', 'Zend\Db\Adapter\Adapter' => 'VuFind\Service\Factory::getDbAdapter', + 'Zend\Mvc\I18n\Translator' => 'VuFind\Service\Factory::getTranslator', 'Zend\Session\SessionManager' => 'VuFind\Session\ManagerFactory', ], 'initializers' => [ 'VuFind\ServiceManager\ServiceInitializer', ], 'aliases' => [ - 'mvctranslator' => 'VuFind\Translator', - 'translator' => 'VuFind\Translator', 'VuFind\AccountCapabilities' => 'VuFind\Config\AccountCapabilities', 'VuFind\AuthManager' => 'VuFind\Auth\Manager', 'VuFind\AuthPluginManager' => 'VuFind\Auth\PluginManager', @@ -414,6 +412,7 @@ $config = [ 'VuFind\SessionManager' => 'Zend\Session\SessionManager', 'VuFind\SessionPluginManager' => 'VuFind\Session\PluginManager', 'VuFind\SMS' => 'VuFind\SMS\SMSInterface', + 'VuFind\Translator' => 'Zend\Mvc\I18n\Translator', 'VuFind\YamlReader' => 'VuFind\Config\YamlReader', ], ], diff --git a/module/VuFind/src/VuFind/Bootstrapper.php b/module/VuFind/src/VuFind/Bootstrapper.php index e332df55c4bd9789077cf4e1929aaa7a61eb3b18..1c6945aac8caf9fd176f269646fa0a790a204f38 100644 --- a/module/VuFind/src/VuFind/Bootstrapper.php +++ b/module/VuFind/src/VuFind/Bootstrapper.php @@ -332,7 +332,7 @@ class Bootstrapper $language = $config->Site->language; } try { - $translator = $sm->get('VuFind\Translator'); + $translator = $sm->get('Zend\Mvc\I18n\Translator'); $translator->setLocale($language) ->addTranslationFile('ExtendedIni', null, 'default', $language); foreach ($this->getTextDomains() as $domain) { diff --git a/module/VuFind/src/VuFind/Content/AbstractAmazonFactory.php b/module/VuFind/src/VuFind/Content/AbstractAmazonFactory.php index ae0077c26b803930077a3fe05210e19c522662bc..d46af909f6293aa5741af4eed9ef39fd3911ec47 100644 --- a/module/VuFind/src/VuFind/Content/AbstractAmazonFactory.php +++ b/module/VuFind/src/VuFind/Content/AbstractAmazonFactory.php @@ -65,7 +65,7 @@ class AbstractAmazonFactory implements \Zend\ServiceManager\Factory\FactoryInter ? $config->Content->amazonassociate : null; $secret = isset($config->Content->amazonsecret) ? $config->Content->amazonsecret : null; - $label = $container->get('VuFind\Translator')->translate( + $label = $container->get('Zend\Mvc\I18n\Translator')->translate( 'Supplied by Amazon' ); return new $requestedName($associate, $secret, $label); diff --git a/module/VuFind/src/VuFind/Controller/ContentController.php b/module/VuFind/src/VuFind/Controller/ContentController.php index e2cd7763bba98c26792bf9b084356c0ef5878a30..607f9d30cd0f91a251787cd73d3669f65829d13d 100644 --- a/module/VuFind/src/VuFind/Controller/ContentController.php +++ b/module/VuFind/src/VuFind/Controller/ContentController.php @@ -51,7 +51,7 @@ class ContentController extends AbstractBase { $page = $this->params()->fromRoute('page'); $themeInfo = $this->serviceLocator->get('VuFindTheme\ThemeInfo'); - $language = $this->serviceLocator->get('VuFind\Translator') + $language = $this->serviceLocator->get('Zend\Mvc\I18n\Translator') ->getLocale(); $defaultLanguage = $this->getConfig()->Site->language; diff --git a/module/VuFind/src/VuFind/Controller/SearchController.php b/module/VuFind/src/VuFind/Controller/SearchController.php index de35732680011c168ba3cfc6367c80463d369e77..81663a5e896d06468a4d6c335d01efc49959c978 100644 --- a/module/VuFind/src/VuFind/Controller/SearchController.php +++ b/module/VuFind/src/VuFind/Controller/SearchController.php @@ -564,7 +564,8 @@ class SearchController extends AbstractSearch // Check if we have facet results cached, and build them if we don't. $cache = $this->serviceLocator->get('VuFind\Cache\Manager') ->getCache('object'); - $language = $this->serviceLocator->get('VuFind\Translator')->getLocale(); + $language = $this->serviceLocator->get('Zend\Mvc\I18n\Translator') + ->getLocale(); $hiddenFilters = $this->getActiveHiddenFilters(); $hiddenFiltersHash = md5(json_encode($hiddenFilters)); $cacheName .= "List-$hiddenFiltersHash-$language"; diff --git a/module/VuFind/src/VuFind/Controller/SummonController.php b/module/VuFind/src/VuFind/Controller/SummonController.php index 29f8cc4ec2e11fdf5d255773367da9dd96f5e94f..0a49591aeaab8572205b154edba86bafca7337fe 100644 --- a/module/VuFind/src/VuFind/Controller/SummonController.php +++ b/module/VuFind/src/VuFind/Controller/SummonController.php @@ -158,7 +158,8 @@ class SummonController extends AbstractSearch // Check if we have facet results cached, and build them if we don't. $cache = $this->serviceLocator->get('VuFind\Cache\Manager') ->getCache('object'); - $language = $this->serviceLocator->get('VuFind\Translator')->getLocale(); + $language = $this->serviceLocator->get('Zend\Mvc\I18n\Translator') + ->getLocale(); $cacheKey = 'summonSearchAdvancedFacetsList-' . $language; if (!($list = $cache->getItem($cacheKey))) { $config = $this->serviceLocator->get('VuFind\Config\PluginManager') diff --git a/module/VuFind/src/VuFind/Service/Factory.php b/module/VuFind/src/VuFind/Service/Factory.php index bbef087d1c979899889d868ca43c47c7549ff747..bf3766f7adbf02adcc1a9565d4236b142a975637 100644 --- a/module/VuFind/src/VuFind/Service/Factory.php +++ b/module/VuFind/src/VuFind/Service/Factory.php @@ -117,7 +117,7 @@ class Factory * * @param ServiceManager $sm Service manager. * - * @return \Zend\I18n\Translator\TranslatorInterface + * @return \Zend\Mvc\I18n\Translator */ public static function getTranslator(ServiceManager $sm) { diff --git a/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php b/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php index 28a902f60a55adbc8ad851386511f6263e43aaa9..0df5c49706e85c15d497bdbc7ec0395b5a10e082 100644 --- a/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php +++ b/module/VuFind/src/VuFind/Service/ReCaptchaFactory.php @@ -73,7 +73,7 @@ class ReCaptchaFactory implements FactoryInterface ? $config->Captcha->privateKey : ''); $httpClient = $container->get('VuFindHttp\HttpService')->createClient(); - $translator = $container->get('VuFind\Translator'); + $translator = $container->get('Zend\Mvc\I18n\Translator'); $rcOptions = ['lang' => $translator->getLocale()]; if (isset($config->Captcha->theme)) { $rcOptions['theme'] = $config->Captcha->theme; diff --git a/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php b/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php index 643c632e2dcfd790f72257cfac2f5e5f48e32b85..712bc8aada1ef95bf69e65841e6f8bd20c2f5214 100644 --- a/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php +++ b/module/VuFind/src/VuFind/ServiceManager/ServiceInitializer.php @@ -88,7 +88,7 @@ class ServiceInitializer implements InitializerInterface $instance->setLogger($sm->get('VuFind\Log\Logger')); } if ($instance instanceof \VuFind\I18n\Translator\TranslatorAwareInterface) { - $instance->setTranslator($sm->get('VuFind\Translator')); + $instance->setTranslator($sm->get('Zend\Mvc\I18n\Translator')); } if ($instance instanceof \VuFindHttp\HttpServiceAwareInterface) { $instance->setHttpService($sm->get('VuFindHttp\HttpService')); diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Factory.php b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php index e3231b0c63d1d4d4a03451ff82d38f487d6efbbc..32ed384f808035e17d55dd4242710c291caae257 100644 --- a/module/VuFind/src/VuFind/View/Helper/Root/Factory.php +++ b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php @@ -288,8 +288,8 @@ class Factory */ public static function getHelpText(ServiceManager $sm) { - $lang = $sm->has('VuFind\Translator') - ? $sm->get('VuFind\Translator')->getLocale() + $lang = $sm->has('Zend\Mvc\I18n\Translator') + ? $sm->get('Zend\Mvc\I18n\Translator')->getLocale() : 'en'; $helpers = $sm->get('ViewHelperManager'); return new HelpText($helpers->get('context'), $lang); diff --git a/module/VuFind/src/VuFindTest/Unit/TestCase.php b/module/VuFind/src/VuFindTest/Unit/TestCase.php index 439dac727b706cd081fb3eb405814b03873e8044..539145c3432c4857f1475851a4745524875e717f 100644 --- a/module/VuFind/src/VuFindTest/Unit/TestCase.php +++ b/module/VuFind/src/VuFindTest/Unit/TestCase.php @@ -209,7 +209,8 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase $this->serviceManager->setService('Config', []); $factory = new \Zend\Mvc\I18n\TranslatorFactory(); $this->serviceManager->setService( - 'VuFind\Translator', $factory->createService($this->serviceManager) + 'Zend\Mvc\I18n\Translator', + $factory->createService($this->serviceManager) ); } return $this->serviceManager; diff --git a/module/VuFindTheme/src/VuFindTheme/Initializer.php b/module/VuFindTheme/src/VuFindTheme/Initializer.php index 29a1881b52e3e5f593f2ae46cb79cb31ba0b28e6..51f87b8696ac1519af80eb55614ba9c74a1a794a 100644 --- a/module/VuFindTheme/src/VuFindTheme/Initializer.php +++ b/module/VuFindTheme/src/VuFindTheme/Initializer.php @@ -412,7 +412,7 @@ class Initializer if (!empty($pathStack)) { try { - $translator = $this->serviceManager->get('VuFind\Translator'); + $translator = $this->serviceManager->get('Zend\Mvc\I18n\Translator'); $pm = $translator->getPluginManager(); $pm->get('ExtendedIni')->addToPathStack($pathStack);