From 05f3293446c2e36a3e8856c148ae5a5da37fa873 Mon Sep 17 00:00:00 2001 From: mBertholino Date: Wed, 11 Jan 2012 14:35:18 +0000 Subject: [PATCH] // bug fixed translation, code change, no need to use strtolower --- classes/AdminController.php | 25 +++++++++---------------- config/smartyadmin.config.inc.php | 3 ++- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/classes/AdminController.php b/classes/AdminController.php index 8aeae012d..3364dcaa1 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -1608,16 +1608,8 @@ class AdminControllerCore extends Controller { $iso = Context::getContext()->language->iso_code; include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); - - if (isset($_LANGADM)) - $_LANGADM = array_change_key_case($_LANGADM); - else - $_LANGADM = array(); } - $class = strtolower($class); - // For traductions in a tpl folder with an underscore - $class = str_replace('_', '', $class); if (isset(self::$tab_module_list[$class])) { $class_name_controller = $class.'controller'; @@ -1628,23 +1620,24 @@ class AdminControllerCore extends Controller return Module::findTranslation(Module::$classInModule[$class_name_controller], $string, $class_name_controller); } } - $key = md5(str_replace('\'', '\\\'', $string)); - // retrocomp : // if value is not set, try with "AdminTab" as prefix. // @todo : change AdminTab to Helper + //echo $class.$key.'
'; + if (isset($_LANGADM[$class.$key])) $str = $_LANGADM[$class.$key]; - else if (isset($_LANGADM['admincontroller'.$key])) - $str = $_LANGADM['admincontroller'.$key]; - else if (isset($_LANGADM['helper'.$key])) - $str = $_LANGADM['helper'.$key]; - else if (isset($_LANGADM['admintab'.$key])) - $str = $_LANGADM['admintab'.$key]; + else if (isset($_LANGADM['AdminController'.$key])) + $str = $_LANGADM['AdminController'.$key]; + else if (isset($_LANGADM['Helper'.$key])) + $str = $_LANGADM['Helper'.$key]; + else if (isset($_LANGADM['AdminTab'.$key])) + $str = $_LANGADM['AdminTab'.$key]; else // note in 1.5, some translations has moved from AdminXX to helper/*.tpl $str = $string; + $str = $htmlentities ? htmlentities($str, ENT_QUOTES, 'utf-8') : $str; return str_replace('"', '"', ($addslashes ? addslashes($str) : stripslashes($str))); } diff --git a/config/smartyadmin.config.inc.php b/config/smartyadmin.config.inc.php index c7b8213bb..e5b3292ab 100644 --- a/config/smartyadmin.config.inc.php +++ b/config/smartyadmin.config.inc.php @@ -68,6 +68,7 @@ function smartyTranslate($params, &$smarty) switch ($dir_filename) { + // note : this may be modified later case '.': $class = 'index';break; case 'helper' : $class = 'AdminTab';break; @@ -75,7 +76,7 @@ function smartyTranslate($params, &$smarty) { $parentClass = explode('/', $filename); $key = array_search('controllers', $parentClass); - $class = 'Admin'.ucfirst($parentClass[$key + 1]); + $class = 'Admin'.Tools::toCamelCase($parentClass[$key + 1], true); } }