From ba20087ceb95ff35294b5220378fbfef0c03362b Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 15:52:59 +0200 Subject: [PATCH 1/3] FIX better compatibility for translation of label in setup API --- htdocs/api/class/api_setup.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 406172590d7..41715cff0ba 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -612,10 +612,11 @@ 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 string $dict Dictionnary for translation * * @return void */ - private function translateLabel($object, $lang, $prefix = 'Country') + private function translateLabel($object, $lang, $prefix = 'Country', $dict = 'dict') { if (!empty($lang)) { // Load the translations if this is a new language. @@ -623,7 +624,7 @@ class Setup extends DolibarrApi global $conf; $this->translations = new Translate('', $conf); $this->translations->setDefaultLang($lang); - $this->translations->load('dict'); + $this->translations->load($dict); } if ($object->code) { $key = $prefix.$object->code; @@ -636,7 +637,6 @@ class Setup extends DolibarrApi } } - /** * Get the list of events types. * From 65cbd2c663f48b9646b3551a0e61482608c58e61 Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 17:59:34 +0200 Subject: [PATCH 2/3] Update api_setup.class.php some values needs more dictionaries --- htdocs/api/class/api_setup.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 41715cff0ba..345a8e60799 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -624,7 +624,7 @@ class Setup extends DolibarrApi global $conf; $this->translations = new Translate('', $conf); $this->translations->setDefaultLang($lang); - $this->translations->load($dict); + $this->translations->loadLangs(array($dict)); } if ($object->code) { $key = $prefix.$object->code; From e450b950d14819077cd422b223b913f06731f7ad Mon Sep 17 00:00:00 2001 From: ptibogxiv Date: Fri, 28 Oct 2022 21:24:30 +0200 Subject: [PATCH 3/3] Update api_setup.class.php --- htdocs/api/class/api_setup.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index 345a8e60799..c35c75cd154 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -616,7 +616,7 @@ class Setup extends DolibarrApi * * @return void */ - private function translateLabel($object, $lang, $prefix = 'Country', $dict = 'dict') + private function translateLabel($object, $lang, $prefix = 'Country', $dict = array('dict')) { if (!empty($lang)) { // Load the translations if this is a new language. @@ -624,7 +624,7 @@ class Setup extends DolibarrApi global $conf; $this->translations = new Translate('', $conf); $this->translations->setDefaultLang($lang); - $this->translations->loadLangs(array($dict)); + $this->translations->loadLangs($dict); } if ($object->code) { $key = $prefix.$object->code;