FIX better compatibility for translation of label in setup API

This commit is contained in:
ptibogxiv 2022-10-28 15:52:59 +02:00 committed by GitHub
parent 6645693b45
commit ba20087ceb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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