[SPIP] ~v3.0.20-->v3.0.25
[lhc/web/clavette_www.git] / www / ecrire / inc / traduire.php
index 1bb4cc9..861bce1 100644 (file)
@@ -3,7 +3,7 @@
 /***************************************************************************\
  *  SPIP, Systeme de publication pour l'internet                           *
  *                                                                         *
- *  Copyright (c) 2001-2014                                                *
+ *  Copyright (c) 2001-2016                                                *
  *  Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James  *
  *                                                                         *
  *  Ce programme est un logiciel libre distribue sous licence GNU/GPL.     *
@@ -69,7 +69,7 @@ function charger_langue($lang, $module = 'spip') {
                // var liee a la langue
                $l = $GLOBALS['meta']['langue_site'];
                if (!$fichiers_lang = chercher_module_lang($module, $l))
-                       $fichiers_lang = chercher_module_lang($module, 'fr');
+                       $fichiers_lang = chercher_module_lang($module, _LANGUE_PAR_DEFAUT);
 
                if ($fichiers_lang) {
                        $GLOBALS['idx_lang']='i18n_'.$module.'_' .$l;
@@ -140,9 +140,13 @@ function inc_traduire_dist($ori, $lang) {
                if (empty($GLOBALS[$var])) {
                        charger_langue($lang, $module);
 
-                       // surcharge perso -- on cherche (lang/)local_xx.php ...
-                       if (!isset($local['local_'.$lang]))
+                       // surcharge perso
+                       // -- on cherche (lang/)local_xx.php ...
+                       if (!isset($local['local_'.$lang])) {
+                               // redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer)
+                               $GLOBALS['idx_lang']= $var;
                                $local['local_'.$lang] = chercher_module_lang('local', $lang);
+                       }
                        if ($local['local_'.$lang])
                                surcharger_langue($local['local_'.$lang]);
                        // ... puis (lang/)local.php
@@ -163,14 +167,14 @@ function inc_traduire_dist($ori, $lang) {
        // on essaie d'abord la langue du site, puis a defaut la langue fr
        $langue_retenue = $lang;
        if (!strlen($text)
-       AND $lang !== 'fr') {
+       AND $lang !== _LANGUE_PAR_DEFAUT) {
                if ($lang !== $GLOBALS['meta']['langue_site']) {
                        $text = inc_traduire_dist($ori, $GLOBALS['meta']['langue_site']);
                        $langue_retenue = (!strlen($text) ? $GLOBALS['meta']['langue_site'] : '');
                }
                else {
-                       $text = inc_traduire_dist($ori, 'fr');
-                       $langue_retenue = (!strlen($text) ? 'fr' : '');
+                       $text = inc_traduire_dist($ori, _LANGUE_PAR_DEFAUT);
+                       $langue_retenue = (!strlen($text) ? _LANGUE_PAR_DEFAUT : '');
                }
        }