// bug fixed translation, code change, no need to use strtolower

This commit is contained in:
mBertholino
2012-01-11 14:35:18 +00:00
parent 11dda92b61
commit 05f3293446
2 changed files with 11 additions and 17 deletions
+9 -16
View File
@@ -1608,16 +1608,8 @@ class AdminControllerCore extends Controller
{ {
$iso = Context::getContext()->language->iso_code; $iso = Context::getContext()->language->iso_code;
include_once(_PS_TRANSLATIONS_DIR_.$iso.'/admin.php'); 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])) if (isset(self::$tab_module_list[$class]))
{ {
$class_name_controller = $class.'controller'; $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); return Module::findTranslation(Module::$classInModule[$class_name_controller], $string, $class_name_controller);
} }
} }
$key = md5(str_replace('\'', '\\\'', $string)); $key = md5(str_replace('\'', '\\\'', $string));
// retrocomp : // retrocomp :
// if value is not set, try with "AdminTab" as prefix. // if value is not set, try with "AdminTab" as prefix.
// @todo : change AdminTab to Helper // @todo : change AdminTab to Helper
//echo $class.$key.'<br />';
if (isset($_LANGADM[$class.$key])) if (isset($_LANGADM[$class.$key]))
$str = $_LANGADM[$class.$key]; $str = $_LANGADM[$class.$key];
else if (isset($_LANGADM['admincontroller'.$key])) else if (isset($_LANGADM['AdminController'.$key]))
$str = $_LANGADM['admincontroller'.$key]; $str = $_LANGADM['AdminController'.$key];
else if (isset($_LANGADM['helper'.$key])) else if (isset($_LANGADM['Helper'.$key]))
$str = $_LANGADM['helper'.$key]; $str = $_LANGADM['Helper'.$key];
else if (isset($_LANGADM['admintab'.$key])) else if (isset($_LANGADM['AdminTab'.$key]))
$str = $_LANGADM['admintab'.$key]; $str = $_LANGADM['AdminTab'.$key];
else else
// note in 1.5, some translations has moved from AdminXX to helper/*.tpl // note in 1.5, some translations has moved from AdminXX to helper/*.tpl
$str = $string; $str = $string;
$str = $htmlentities ? htmlentities($str, ENT_QUOTES, 'utf-8') : $str; $str = $htmlentities ? htmlentities($str, ENT_QUOTES, 'utf-8') : $str;
return str_replace('"', '&quot;', ($addslashes ? addslashes($str) : stripslashes($str))); return str_replace('"', '&quot;', ($addslashes ? addslashes($str) : stripslashes($str)));
} }
+2 -1
View File
@@ -68,6 +68,7 @@ function smartyTranslate($params, &$smarty)
switch ($dir_filename) switch ($dir_filename)
{ {
// note : this may be modified later // note : this may be modified later
case '.': $class = 'index';break; case '.': $class = 'index';break;
case 'helper' : $class = 'AdminTab';break; case 'helper' : $class = 'AdminTab';break;
@@ -75,7 +76,7 @@ function smartyTranslate($params, &$smarty)
{ {
$parentClass = explode('/', $filename); $parentClass = explode('/', $filename);
$key = array_search('controllers', $parentClass); $key = array_search('controllers', $parentClass);
$class = 'Admin'.ucfirst($parentClass[$key + 1]); $class = 'Admin'.Tools::toCamelCase($parentClass[$key + 1], true);
} }
} }