From 41890d0a0be2663273ac15002d39cd7c9836538d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Fri, 16 Jan 2015 14:38:00 +0100 Subject: [PATCH] Fixed: Translation of module name and desc was not used for external modules. --- htdocs/core/modules/DolibarrModules.class.php | 29 ++++++++++++++----- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/htdocs/core/modules/DolibarrModules.class.php b/htdocs/core/modules/DolibarrModules.class.php index e4d1f834b4a..b19557f25ff 100644 --- a/htdocs/core/modules/DolibarrModules.class.php +++ b/htdocs/core/modules/DolibarrModules.class.php @@ -344,7 +344,8 @@ abstract class DolibarrModules /** - * Gives the translated module name if translation exists in admin.lang or the default module name. + * Gives the translated module name if translation exists in admin.lang or into language files of module. + * Otherwise return the module key name. * * @return string Translated module name */ @@ -359,9 +360,16 @@ abstract class DolibarrModules return $langs->trans("Module".$this->numero."Name"); } else - { - // If module name translation using it's unique id does not exists, we take its name - return $this->name; + { + // If module name translation using it's unique id does not exists, we take use its name to find translation + if (is_array($this->langfiles)) + { + foreach($this->langfiles as $val) + { + if ($val) $langs->load($val); + } + } + return $langs->trans($this->name); } } @@ -382,9 +390,16 @@ abstract class DolibarrModules return $langs->trans("Module".$this->numero."Desc"); } else - { - // If module description translation using it's unique id does not exists, we take its description - return $this->description; + { + // If module description translation using it's unique id does not exists, we take use its name to find translation + if (is_array($this->langfiles)) + { + foreach($this->langfiles as $val) + { + if ($val) $langs->load($val); + } + } + return $langs->trans($this->description); } } -- GitLab