From 244af052cc3704e78b0d30e2d8ab988fe0f130ff Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sun, 15 Jan 2012 08:29:56 +0100 Subject: [PATCH] Fix: add MAIN_USE_CUSTOM_TRANSLATION for use /custom/langs directory --- htdocs/core/class/translate.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/class/translate.class.php b/htdocs/core/class/translate.class.php index aca78e6a664..9f004232f22 100644 --- a/htdocs/core/class/translate.class.php +++ b/htdocs/core/class/translate.class.php @@ -193,7 +193,7 @@ class Translate $langarray=explode('_',$langofdir); if ($alt < 1 && strtolower($langarray[0]) == strtolower($langarray[1])) $alt=1; if ($alt < 2 && (strtolower($langofdir) == 'en_us' || strtolower($langofdir) == 'fr_fr' || strtolower($langofdir) == 'es_es')) $alt=2; - + foreach($this->dir as $keydir => $searchdir) { // Directory of translation files @@ -250,7 +250,7 @@ class Translate $tab=explode('=',$line,2); $key=trim($tab[0]); //print "Domain=$domain, found a string for $tab[0] with value $tab[1]
"; - if (empty($this->tab_translate[$key]) && isset($tab[1])) // If data was already found, we must not enter here, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite) + if ((! empty($conf->global->MAIN_USE_CUSTOM_TRANSLATION) || empty($this->tab_translate[$key])) && isset($tab[1])) // If data was already found, we must not enter here, even if MAIN_FORCELANGDIR is set (MAIN_FORCELANGDIR is to replace lang dir, not to overwrite) { $value=trim(preg_replace('/\\n/',"\n",$tab[1])); @@ -286,7 +286,7 @@ class Translate } } - if (empty($conf->global->MAIN_FORCELANGDIR)) break; // Break loop on each root dir. If a module has forced dir, we do not stop loop. + if (empty($conf->global->MAIN_FORCELANGDIR) && empty($conf->global->MAIN_USE_CUSTOM_TRANSLATION)) break; // Break loop on each root dir. If a module has forced dir, we do not stop loop. } } }