Fixed: Translation of module name and desc was not used for external

modules.
This commit is contained in:
Laurent Destailleur 2015-01-16 14:38:00 +01:00
parent e20c1decdf
commit 41890d0a0b

View File

@ -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);
}
}