public function _initTranslate() { $locale = new Zend_Locale(Zend_Locale::BROWSER); $translate = new Zend_Translate(array('adapter' => 'csv', 'content' => APPLICATION_PATH . '/configs/languages/lang.en', 'locale' => 'en')); $translate->addTranslation(array('content' => APPLICATION_PATH . '/configs/languages/lang.hi', 'locale' => 'hi')); if ($translate->isAvailable($locale->getLanguage())) { $translate->setLocale($locale); } else { $translate->setLocale('en'); } Zend_Registry::set('Translate', $translate); }
protected function _initSetTranslations() { $translate = new Zend_Translate(array('adapter' => 'gettext', 'content' => APPLICATION_PATH . '/../library/Rdine/Translate/Language', 'locale' => null, 'scan' => Zend_Translate::LOCALE_FILENAME)); $namespace = new Zend_Session_Namespace(); $language = 'en'; if ($namespace->lang) { if ($namespace->lang == 'en_US') { $language = 'en'; $namespace->lang = 'en_US'; } if ($namespace->lang == 'es_SP') { $language = 'es_SP'; } } else { $language = 'en'; $namespace->lang = 'en_US'; } $translate->setLocale($language); $view = $this->getResource('view'); $view->translate = $translate; if ($namespace->lang) { $view->lang = $namespace->lang; } else { $view->lang = 'en_US'; $namespace->lang = 'en_US'; } }
protected function _initLanguages() { $languageDir = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'languages'; Zend_Registry::set('languageDir', $languageDir); $translate = new Zend_Translate( 'gettext', $languageDir ); $translate->addTranslation($languageDir . DIRECTORY_SEPARATOR . 'en_GB.mo', 'en'); $translate->addTranslation($languageDir . DIRECTORY_SEPARATOR . 'fr_FR.mo', 'fr'); $translate->addTranslation($languageDir . DIRECTORY_SEPARATOR . 'it_IT.mo', 'it'); $translate->addTranslation($languageDir . DIRECTORY_SEPARATOR . 'ru_RU.mo', 'ru'); $locale = new Zend_Session_Namespace('locale'); if ($locale->value === null) { $config_model = new Default_Model_Configuration(); $locale_config = $config_model->getKey('locale'); isset($locale_config) ? $locale->value = $locale_config : $locale->value = 'en'; } $translate->setLocale($locale->value); Zend_Registry::set('tr', $translate); Zend_Registry::set('Zend_Translate', $translate); Zend_Registry::set('Zend_Locale', $locale); }
public function preDispatch($request) { try { $locale = new Zend_Locale(); $locale->setDefault('en'); $locale->setLocale(Zend_Locale::BROWSER); $requestedLanguage = key($locale->getBrowser()); $formatter = new Zend_Log_Formatter_Simple('%message%' . PHP_EOL); $writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'translations.log'); $writer->setFormatter($formatter); $logger = new Zend_Log($writer); $frontendOptions = array('cache_id_prefix' => 'translation', 'lifetime' => 86400, 'automatic_serialization' => true); $backendOptions = array('cache_dir' => APPLICATION_CACHE_PATH); $cache = Zend_Cache::factory('Core', 'File', $frontendOptions, $backendOptions); $options = array('adapter' => 'gettext', 'scan' => Zend_Translate::LOCALE_FILENAME, 'content' => APPLICATION_PATH . '/languages/en/en.mo', 'locale' => 'auto', 'disableNotices' => true); $translate = new Zend_Translate($options); if (!$translate->isAvailable($locale->getLanguage())) { $locale->setLocale('en'); } else { $translate->setLocale($locale); } $translate->setCache($cache); Zend_Registry::set('locale', $locale->getLanguage()); Zend_Registry::set('Zend_Translate', $translate); } catch (Exception $e) { try { $writer = new Zend_Log_Writer_Stream(APPLICATION_LOG_PATH . 'plugin-locale.log'); $logger = new Zend_Log($writer); $logger->log($e->getMessage(), Zend_Log::ERR); } catch (Exception $e) { } } }
/** * Retturn translation string * example $l->translate('Field %1 is incorrect', 'FieldName'); * * @param string $msg Message to transalte. */ public function translate($msg) { $translated = $msg; if ($this->translate->isTranslated($msg, true, $this->locale)) { $translated = $this->translate->translate($msg); } else { foreach ($this->translationsPaths as $name => $value) { if (!$this->translate->isAvailable($name)) { try { $this->translate->addTranslation($this->translationsPaths[$name], $name); $this->translate->setLocale($this->getLocale()); } catch (Zend_Translate_Exception $e) { continue; } } if ($this->translate->isTranslated($msg, $name)) { $translated = $this->translate->translate($msg, $name); break; } } } if (func_num_args() > 1) { $params = func_get_args(); $params[0] = $translated; $translated = @call_user_func_array("sprintf", $params); //add shield for incorrect translations(warning about incorrect number of arguments) } return $translated; }
protected function _initTranslation() { $translate = new Zend_Translate('Array', APPLICATION_PATH . '/configs/languages/pt_BR.php', 'pt_BR'); $translate->setLocale('pt_BR'); Zend_Registry::set('Zend_Translate', $translate); $locale = new Zend_Locale('pt_BR'); Zend_Registry::set('Zend_Locale', $locale); }
protected function _initTranslate() { $translate = new Zend_Translate('gettext', APPLICATION_PATH . '/data/languages/zh.mo', 'zh'); $translate->addTranslation(APPLICATION_PATH . '/data/languages/en.mo', 'en'); //$translate->setLocale('zh'); $translate->setLocale('en'); Zend_Registry::set('translate', $translate); }
public function testSetLocale() { $lang = new Zend_Translate(Zend_Translate::AN_ARRAY, array('msg1' => 'Message 1'), 'en'); $lang->addTranslation('ru', array('msg1' => 'Message 1 (ru)')); $this->assertEquals($lang->getLocale(), new Zend_Locale('en')); $lang->setLocale('ru'); $this->assertEquals($lang->getLocale(), new Zend_Locale('ru')); }
public function setIniFilenameScanTranslator($path, $defaultLanguage, $language = null) { require_once 'Zend/Translate.php'; $translate = new Zend_Translate(Zend_Translate::AN_INI, $path, $defaultLanguage, array('scan' => Zend_Translate::LOCALE_FILENAME)); if ($translate->isAvailable($language)) { $translate->setLocale($language); } $this->setTranslator($translate->getAdapter()); }
public static function getCurrentlanguage($lang = 1, $layout = false) { // set up translation adapter $session_lang = new Zend_Session_Namespace('lang'); $session_lang->lang_id = 1; if ($lang == 1) { $str = "km"; } else { $str = "en"; } $tr = new Zend_Translate('ini', PUBLIC_PATH . '/lang/' . $str, null, array('scan' => Zend_Translate::LOCALE_FILENAME)); // set locale $tr->setLocale('en'); $session_language = new Zend_Session_Namespace('language'); if (!empty($session_language->language)) { $tr->setLocale(strtolower($session_language->language)); } return $tr; }
/** * Retrieve translate object * * @return Zend_Translate * @throws Streamwide_Exception When provided locales invalid, throw Streamwide_Exception */ public function getTranslate() { if (null === $this->_translate) { $options = $this->getOptions(); if (!isset($options['locales']) || !is_array($options['locales'])) { throw new Streamwide_Exception('No translation source data provided.'); } $log = $this->getBootstrap()->getResource('Logger'); $adapter = isset($options['adapter']) ? $options['adapter'] : Zend_Translate::AN_CSV; $locale = isset($options['locales']['default']) ? $options['locales']['default'] : null; $translateOptions = array('scan' => Zend_Translate::LOCALE_DIRECTORY, 'log' => $log, 'logUntranslated' => true, 'disableNotices' => $options['disableNotices']); $this->_translate = new Zend_Translate($adapter, $options['locales']['path'], $locale, $translateOptions); $this->_translate->setLocale($this->_locale); $view = $this->getBootstrap()->getResource('View'); $view->doctype('XHTML1_STRICT'); $view->translate()->setTranslator($this->_translate); } return $this->_translate; }
/** * Setup test * * @return void */ public function setUp() { // Backup server array $this->_server = $_SERVER; // Clean host env unset($_SERVER['HTTP_HOST'], $_SERVER['HTTPS'], $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT']); // Set translator $translator = new Zend_Translate('array', array('foo' => 'en_foo', 'bar' => 'en_bar'), 'en'); $translator->addTranslation(array('foo' => 'de_foo', 'bar' => 'de_bar'), 'de'); $translator->setLocale('en'); Zend_Registry::set('Zend_Translate', $translator); }
public function preDispatch(Zend_Controller_Request_Abstract $request) { // Die CSV-Dateien laden $translate = new Zend_Translate('csv', '../application/config/lang.de.csv', 'de'); $translate->addTranslation('../application/config/lang.en.csv', 'en'); // sprache einstellen $translate->setLocale('de'); // translateobjekt in der registry speichern $registry = Zend_Registry::getInstance(); $registry->set('translate', $translate); // für alle Formular der Klasse Zend_Form das standard translate objekt setzen Zend_Form::setDefaultTranslator($translate); }
public function preDispatch(Zend_Controller_Request_Abstract $request) { $locale = new Zend_Locale(); Zend_Registry::set('Zend_Locale', $locale); // default language when requested language is not available $defaultlanguage = 'vi'; // somewhere in your application $adapter = new Zend_Translate(array('adapter' => 'ini', 'content' => APPLICATION_PATH . '/languages', 'scan' => Zend_Translate::LOCALE_DIRECTORY, 'locale' => $locale->getLanguage())); //if (! $adapter->isAvailable($locale->getLanguage())) { // not available languages are rerouted to another language $adapter->setLocale($defaultlanguage); Zend_Registry::set('Zend_Translate', $adapter); //} }
/** Changes the currently active locale * @param string $locale The locale to activate (for example: 'en_US') * @param bool $coreOnly = false Set to true to load only the core translation files, set to false (default) to load also packages and site locale translations */ public function setLocale($locale, $coreOnly = false) { $localeNeededLoading = false; if ($locale == 'en_US' && !ENABLE_TRANSLATE_LOCALE_EN_US) { if (isset($this->translate)) { unset($this->translate); } return; } if (is_dir(DIR_LANGUAGES . '/' . $locale)) { $languageDir = DIR_LANGUAGES . '/' . $locale; } elseif (is_dir(DIR_LANGUAGES_CORE . '/' . $locale)) { $languageDir = DIR_LANGUAGES_CORE . '/' . $locale; } else { return; } $options = array('adapter' => 'gettext', 'content' => $languageDir, 'locale' => $locale, 'disableNotices' => true, 'ignore' => array('.', 'messages.po')); if (defined('TRANSLATE_OPTIONS')) { $_options = unserialize(TRANSLATE_OPTIONS); if (is_array($_options)) { $options = array_merge($options, $_options); } } if (!isset($this->translate)) { $this->translate = new Zend_Translate($options); $localeNeededLoading = true; } else { if (!in_array($locale, $this->translate->getList())) { $this->translate->addTranslation($options); $localeNeededLoading = true; } $this->translate->setLocale($locale); } if (!$coreOnly) { $this->addSiteInterfaceLanguage($locale); global $config_check_failed; if (!(isset($config_check_failed) && $config_check_failed)) { foreach (PackageList::get(1)->getPackages() as $p) { $pkg = Loader::package($p->getPackageHandle()); if (is_object($pkg)) { $pkg->setupPackageLocalization($locale, null, $this->translate); } } } } if ($localeNeededLoading) { Events::fire('on_locale_load', $locale); } }
/** * Creates a Zend_Translate object using configuration paratemeters, and * also uses gettext as adapter * * @param array $config * @return Zend_Translate */ protected function _createTranslate($config = array()) { if (!empty($config)) { $path = realpath($config['path']) . "/%s/default.mo"; $translate = new Zend_Translate('gettext', sprintf($path, $config['default']), $config['default'], $config['options']); foreach ($config['languages'] as $lang) { if ($lang != $config['default']) { $translate->addTranslation(sprintf($path, $lang), $lang); } } $translate->setLocale($config['default']); return $translate; } return false; }
public function _initLocale() { $config = $this->getOptions(); try { $locale = new Zend_Locale(Zend_Locale::BROWSER); } catch (Zend_Locale_Exception $e) { $locale = new Zend_Locale($config['resources']['locale']['default']); } Zend_Registry::set('Zend_Locale', $locale); $translator = new Zend_Translate(array('adapter' => 'Csv', 'content' => APPLICATION_PATH . '/../data/lang/', 'scan' => Zend_Translate::LOCALE_DIRECTORY, 'delimiter' => ',', 'disableNotices' => true)); if (!$translator->isAvailable($locale->getLanguage())) { $translator->setLocale($config['resources']['locale']['default']); } Zend_Registry::set('Zend_Translate', $translator); Zend_Form::setDefaultTranslator($translator); }
/** * Reads all available component translations and adds them to the translation object */ private function _scanTranslations() { // check for valid translation object if (is_object($this->_translate)) { foreach ($this->_extensionRegistry as $component => $settings) { // check if component owns translation if (isset($settings->languages) && is_readable($settings->path . $settings->languages)) { // keep current locale $locale = $this->_translate->getAdapter()->getLocale(); $this->_translate->addTranslation($settings->path . $settings->languages, null, array('scan' => Zend_Translate::LOCALE_FILENAME)); // reset current locale $this->_translate->setLocale($locale); } } } }
function init() { Zend_Registry::set('languages', array('en' => 'English', 'es' => 'Español', 'ca' => 'Català', 'gl' => 'Galego', 'eu' => 'Euskara', 'nl' => 'Nederlands', 'de' => 'Deutsch', 'fr' => 'Français', 'pt' => 'Português', 'it' => 'Italiano')); $activelangs = array('en' => 0, 'es' => 0, 'ca' => 1, 'gl' => 1, 'eu' => 1, 'nl' => 1, 'de' => 1, 'fr' => 1, 'pt' => 1, 'it' => 1); Zend_Registry::set('activelangs', $activelangs); $this->lang = $this->getRequest()->getParam("language"); if ($this->lang == null) { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $this->lang = $auth->getIdentity()->lang; } } if ($this->lang == null && isset($_COOKIE['lang'])) { $this->lang = $_COOKIE['lang']; } $locale = new Zend_Locale(); // El setLocale del Zend está malito... // uso también el nativo de php $locale->setLocale($this->lang . '_' . strtoupper($this->lang) . '.utf8'); setlocale(LC_ALL, $this->lang . '_' . strtoupper($this->lang) . '.utf8'); if (!isset($activelangs[$locale->getLanguage()])) { $locale->setLocale('es_ES.utf8'); } $this->lang = $locale->getLanguage(); $this->langtest = $activelangs[$this->lang] == 1; $options = array('scan' => Zend_Translate::LOCALE_FILENAME); $translate = new Zend_Translate('csv', APPLICATION_PATH . '/languages/', $this->lang, $options); if ($translate->isAvailable($this->lang)) { $translate->setLocale($locale); Zend_Form::setDefaultTranslator($translate); Zend_Registry::set('Zend_Translate', $translate); } else { header('Location: /es'); exit; } if ($this->langtest && (!isset($_COOKIE['langtest']) || $_COOKIE['langtest'] != "0")) { $controller = $this->getActionController(); if (isset($controller->view)) { $controller->view->extra .= " advices"; if (!$controller->view->advices) { $controller->view->advices = array(); } $controller->view->advices["langtest"] = $controller->view->translate("BetaTranslation", "/{$this->lang}/page/translate?lang={$this->lang}"); $controller->view->headScript()->appendFile('/js/jquery.advice.js'); } } }
/** * this function routes all requests that come in to the default module to the index controller / index action * * @param zend_controller_request $request */ public function preDispatch(Zend_Controller_Request_Abstract $request) { if (!$request->isXmlHttpRequest()) { //load the module, controller, and action for reference $this->module = $request->getModuleName(); $this->controller = $request->getControllerName(); $this->action = $request->getActionName(); //load the section if (isset($this->sections[$this->controller])) { $this->section = $this->sections[$this->controller]; } else { $this->section = $this->defaultSection; } if ($this->_isAdminPage($request)) { $this->view->isAdminPage = true; //load config $config = Zend_Registry::get('config'); //setup layout $options = array('layout' => $config->design->adminLayout, 'layoutPath' => $config->design->adminLayoutFolder, 'contentKey' => 'form'); $this->layout = Zend_Layout::startMvc($options); $this->view = $this->layout->getView(); //load the common helpers Digitalus_View_RegisterHelpers::register($this->view); $this->view->setScriptPath($config->filepath->adminViews); //load language files $translate = null; foreach ($config->language->translations as $locale => $translation) { if (is_object($translate)) { $translate->addTranslation($config->language->path . '/' . $translation . '.csv', $locale); } else { $translate = new Zend_Translate('csv', $config->language->path . '/' . $translation . '.csv', $locale); } } $locale = $config->language->defaultLocale; $translate->setLocale($locale); $translate->setCache(Zend_Registry::get('cache')); $this->view->translate = $translate; //page links $this->view->toolbarLinks = array(); } } }
public function routeShutdown(Zend_Controller_Request_Abstract $request) { $locale = new Zend_Locale(); $options = array('scan' => Zend_Translate::LOCALE_FILENAME, 'clear' => false, 'disableNotices' => true); Zend_Translate::setCache(Zend_Registry::get('cache')); if (isset($_COOKIE['language_select'])) { $language = $_COOKIE['language_select']; } else { $language = 'en'; } $translate = new Zend_Translate('csv', APPLICATION_PATH . '/languages', 'auto', $options); $translate->addTranslation(APPLICATION_PATH . '/languages/ot'); $translate->addTranslation(APPLICATION_PATH . '/../overrides/languages'); if (!$translate->isAvailable($language)) { throw new Exception('Language ' . $language . ' is not available'); } $locale->setLocale($language); $translate->setLocale($locale); Zend_Registry::set('Zend_Locale', $locale); Zend_Registry::set('Zend_Translate', $translate); }
/** * reset session with default values * from config file * * @return void */ public function resetSession($usedatabase = false) { // get session object $this->session = new Zend_Session_Namespace("base"); // get default values $default = Zend_Registry::get('bootstrap')->getOptions(); $default = $default["session"]["default"]; // initialize values using values in database or default values if ($usedatabase === false) { foreach ($default as $key => $value) { $this->session->__set($key, $value); } } else { foreach ($default as $key => $value) { $this->session->__set($key, $this->initializeSessionValue($key, $value)); } } // always load public value from database $this->session->__set('public', $this->initializeSessionValue('public', 0)); // set language $this->language->setLocale(new Zend_Locale($this->session->language)); // save session object for further use Zend_Registry::set('session', $this->session); }
protected function _initLanguages() { $_COOKIE["_lang"] = isset($_COOKIE["_lang"]) ? $_COOKIE["_lang"] : $this->getSystemSetting(Ht_Model_SystemSetting::KEY_DEFAULT_LANGUAGE); $languageDir = APPLICATION_PATH . DIRECTORY_SEPARATOR . 'languages'; Zend_Registry::set('languageDir', $languageDir); $translate = new Zend_Translate('gettext', $languageDir); $translate->addTranslation($languageDir . DIRECTORY_SEPARATOR . $_COOKIE["_lang"] . DIRECTORY_SEPARATOR . 'messages.mo', $_COOKIE["_lang"]); $translate->setLocale($_COOKIE["_lang"]); Zend_Registry::set('tr', $translate); Zend_Registry::set('Zend_Translate', $translate); }
/** * @ZF-10051 */ public function testSettingLogPriorityForLog() { $stream = fopen('php://memory', 'w+'); require_once 'Zend/Log/Writer/Stream.php'; $writer = new Zend_Log_Writer_Stream($stream); require_once 'Zend/Log.php'; $log = new Zend_Log($writer); $lang = new Zend_Translate(array('adapter' => Zend_Translate::AN_CSV, 'content' => dirname(__FILE__) . '/Translate/Adapter/_files', 'locale' => 'en', 'delimiter' => ',', 'logPriority' => 3, 'log' => $log)); $lang->setLocale('ru'); rewind($stream); $this->assertContains('ERR (3)', stream_get_contents($stream)); $lang->setOptions(array('logPriority' => 1)); $lang->setLocale('sv'); rewind($stream); $this->assertContains('ALERT (1)', stream_get_contents($stream)); }
/** * @group ZF-5568 */ public function testOptGroupTranslationsShouldWorkAfterPopulatingElement() { $translations = array('ThisIsTheLabel' => 'Optgroup label', 'ThisShouldNotShow' => 'Foo Value', 'ThisShouldNeverShow' => 'Bar Value'); require_once 'Zend/Translate.php'; $translate = new Zend_Translate('array', $translations, 'en'); $translate->setLocale('en'); $options = array('ThisIsTheLabel' => array('foovalue' => 'ThisShouldNotShow', 'barvalue' => 'ThisShouldNeverShow')); $this->element->setTranslator($translate)->addMultiOptions($options); $this->element->setValue('barValue'); $html = $this->element->render($this->getView()); $this->assertContains($translations['ThisIsTheLabel'], $html, $html); }
public function testMultiOptionsPassedToViewHelperAreTranslated() { require_once 'Zend/Form/Element/Select.php'; require_once 'Zend/Translate.php'; $element = new Zend_Form_Element_Select('foo'); $options = array('foo' => 'This Foo Will Not Be Displayed', 'bar' => 'This Bar Will Not Be Displayed', 'baz' => 'This Baz Will Not Be Displayed'); $element->setMultiOptions($options); $translations = array('This Foo Will Not Be Displayed' => 'This is the Foo Value', 'This Bar Will Not Be Displayed' => 'This is the Bar Value', 'This Baz Will Not Be Displayed' => 'This is the Baz Value'); $translate = new Zend_Translate('array', $translations, 'en'); $translate->setLocale('en'); $element->setTranslator($translate); $test = $element->render($this->getView()); foreach ($options as $key => $value) { $this->assertNotContains($value, $test); $this->assertContains($translations[$value], $test); } }
/** * ZF-6724 */ public function testTranslationWithPercent() { $trans = new Zend_Translate('array', array('one' => 'eins', "two %1\$s" => "zwei %1\$s", "three %1\$s %2\$s" => "drei %1\$s %2\$s", 'vier%ig' => 'four%'), 'de'); $trans->setLocale('de'); $this->helper->setTranslator($trans); $this->assertEquals("four%", $this->helper->translate("vier%ig")); $this->assertEquals("zwei 100", $this->helper->translate("two %1\$s", "100")); }
/** ZF-2568 */ public function testTranslatedMessagesCanContainVariableSubstitution() { $localeFile = dirname(__FILE__) . '/_files/locale/array.php'; $translations = (include $localeFile); $translations['notDigits'] .= ' "%value%"'; $translator = new Zend_Translate('array', $translations, 'en'); $translator->setLocale('en'); $this->element->setAllowEmpty(false)->setTranslator($translator)->addValidator('digits'); $this->element->isValid('abc'); $messages = $this->element->getMessages(); $found = false; foreach ($messages as $key => $message) { if ($key == 'notDigits') { $found = true; break; } } $this->assertTrue($found, 'String Empty message not found: ' . var_export($messages, 1)); $this->assertContains(' "abc"', $message); $this->assertContains('Translating the notDigits string', $message); }
public function testErrorMessagesFromProcessAjaxAreLocalizedWhenTranslateAdapterPresent() { $translations = include dirname(__FILE__) . '/_files/locale/array.php'; $translate = new Zend_Translate('array', $translations, 'en'); $translate->setLocale('en'); $this->form->addElements(array( 'foo' => array( 'type' => 'text', 'options' => array( 'required' => true, 'validators' => array('NotEmpty') ) ), 'bar' => array( 'type' => 'text', 'options' => array( 'required' => true, 'validators' => array('Digits') ) ), )) ->setTranslator($translate); $data = array( 'foo' => '', ); $return = $this->form->processAjax($data); $messages = Zend_Json::decode($return); $this->assertTrue(is_array($messages)); $this->assertTrue(isset($messages['foo'])); $this->assertFalse(isset($messages['bar'])); foreach ($messages['foo'] as $key => $message) { if (array_key_exists($key, $translations)) { $this->assertEquals($translations[$key], $message); } else { $this->fail('Translation for ' . $key . ' does not exist?'); } } }
public static function initTranslations($instance) { //add translations to registry $coreLanguageFile = Pimcore_Tool_Admin::getLanguageFile("en"); $translator = new Zend_Translate('csv', $coreLanguageFile, 'en', array('delimiter' => ',')); $availableLanguages = Pimcore_Tool_Admin::getLanguages(); foreach ($availableLanguages as $lang) { if ($lang != "en") { $languageFile = Pimcore_Tool_Admin::getLanguageFile($lang); $translator->addTranslation($languageFile, $lang); } } if (Zend_Registry::isRegistered("Zend_Locale")) { $locale = Zend_Registry::get("Zend_Locale"); @$translator->setLocale($locale->getLanguage()); } Zend_Registry::set("Zend_Translate", $translator); if ($instance) { $instance->setTranslator($translator); } }