Merge pull request #22699 from ptibogxiv/patch-56

FIX better compatibility for translation of label in setup API
This commit is contained in:
Laurent Destailleur 2022-11-01 22:08:25 +01:00 committed by GitHub
commit ef8bb2e1b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -612,9 +612,10 @@ class Setup extends DolibarrApi
* @param object $object Object with label to translate
* @param string $lang Code of the language the name of the object must be translated to
* @param string $prefix Prefix for translation key
* @param array $dict Array of dictionnary for translation
* @return void
*/
private function translateLabel($object, $lang, $prefix = 'Country')
private function translateLabel($object, $lang, $prefix = 'Country', $dict = array('dict'))
{
if (!empty($lang)) {
// Load the translations if this is a new language.
@ -622,7 +623,7 @@ class Setup extends DolibarrApi
global $conf;
$this->translations = new Translate('', $conf);
$this->translations->setDefaultLang($lang);
$this->translations->load('dict');
$this->translations->loadLangs($dict);
}
if ($object->code) {
$key = $prefix.$object->code;
@ -635,7 +636,6 @@ class Setup extends DolibarrApi
}
}
/**
* Get the list of events types.
*