From 8317b89bd629a1189eb8de72c75b8883f045c25b Mon Sep 17 00:00:00 2001 From: "vishalsingh.qlo325" Date: Wed, 30 Apr 2025 11:14:04 +0530 Subject: [PATCH] Removed extra non required static variable --- classes/Translate.php | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/classes/Translate.php b/classes/Translate.php index be0672e13..eac5b8401 100644 --- a/classes/Translate.php +++ b/classes/Translate.php @@ -30,8 +30,7 @@ class TranslateCore { public static $ignore_folder = array('.', '..', '.svn', '.git', '.htaccess', 'index.php'); - public static $langAdmLoaded = false; - public static $_LANGADM = array(); + public static $adminTranslations = array(); /** * Get a translation for an admin controller @@ -49,15 +48,15 @@ class TranslateCore $modules_tabs = Tab::getModuleTabList(); } - if (!self::$langAdmLoaded) { - $iso = Context::getContext()->language->iso_code; - if (empty($iso)) { - $iso = Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')); - } + $iso = Context::getContext()->language->iso_code; + if (empty($iso)) { + $iso = Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')); + } + + if (!isset(self::$adminTranslations[$iso])) { if (file_exists(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php')) { - self::$langAdmLoaded = true; include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); - self::$_LANGADM = $GLOBALS['_LANGADM']; + self::$adminTranslations[$iso] = $GLOBALS['_LANGADM']; } } @@ -71,10 +70,10 @@ class TranslateCore $string = preg_replace("/\\\*'/", "\'", $string); $key = md5($string); - if (isset(self::$_LANGADM[$class.$key])) { - $str = self::$_LANGADM[$class.$key]; + if (isset(self::$adminTranslations[$iso][$class.$key])) { + $str = self::$adminTranslations[$iso][$class.$key]; } else { - $str = Translate::getGenericAdminTranslation($string, $key, self::$_LANGADM); + $str = Translate::getGenericAdminTranslation($string, $key, self::$adminTranslations[$iso]); } if ($htmlentities) {