From 84ff64125de0462cf9961e89a9f43f60af2d4669 Mon Sep 17 00:00:00 2001
From: Demian Katz <demian.katz@villanova.edu>
Date: Wed, 29 Apr 2015 13:16:56 -0400
Subject: [PATCH] Fixed bug: translation broken by displayLanguageOption
 helper. - Resolves VUFIND-1111

---
 .../src/VuFind/View/Helper/Root/DisplayLanguageOption.php    | 4 +---
 module/VuFind/src/VuFind/View/Helper/Root/Factory.php        | 5 ++++-
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/module/VuFind/src/VuFind/View/Helper/Root/DisplayLanguageOption.php b/module/VuFind/src/VuFind/View/Helper/Root/DisplayLanguageOption.php
index adea7d7d75f..2d80c55d084 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/DisplayLanguageOption.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/DisplayLanguageOption.php
@@ -53,9 +53,7 @@ class DisplayLanguageOption extends \Zend\View\Helper\AbstractHelper
      */
     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);
+        $this->translator = $translator;
         try {
             $this->translator->addTranslationFile(
                 'ExtendedIni',
diff --git a/module/VuFind/src/VuFind/View/Helper/Root/Factory.php b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php
index 3cb5f15bf5f..9f59e62c02a 100644
--- a/module/VuFind/src/VuFind/View/Helper/Root/Factory.php
+++ b/module/VuFind/src/VuFind/View/Helper/Root/Factory.php
@@ -139,8 +139,11 @@ class Factory
      */
     public static function getDisplayLanguageOption(ServiceManager $sm)
     {
+        // We want to construct a separate translator instance for this helper,
+        // since it configures different language/locale than the core shared
+        // instance!
         return new DisplayLanguageOption(
-            $sm->getServiceLocator()->get('VuFind\Translator')
+            \VuFind\Service\Factory::getTranslator($sm->getServiceLocator())
         );
     }
 
-- 
GitLab