/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
- * Copyright (c) 2001-2012 *
+ * Copyright (c) 2001-2014 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
static $deja_vu = array();
static $local = array();
- if (isset($deja_vu[$lang][$ori]))
+ if (isset($deja_vu[$lang][$ori]) AND (_request('var_mode') != 'traduction'))
return $deja_vu[$lang][$ori];
// modules demandes explicitement <xxx|yyy|zzz:code> cf MODULES_IDIOMES
if (strpos($ori,':')) {
list($modules,$code) = explode(':',$ori,2);
$modules = explode('|', $modules);
+ $ori_complet = $ori;
} else {
$modules = array('spip', 'ecrire');
$code = $ori;
+ $ori_complet = implode('|', $modules) . ':' . $ori;
}
$text = '';
// parcourir tous les modules jusqu'a ce qu'on trouve
foreach ($modules as $module) {
$var = "i18n_".$module."_".$lang;
+
if (empty($GLOBALS[$var])) {
charger_langue($lang, $module);
if ($local['local'])
surcharger_langue($local['local']);
}
+
if (isset($GLOBALS[$var][$code])) {
+ $module_retenu = $module;
$text = $GLOBALS[$var][$code];
break;
}
// Retour aux sources si la chaine est absente dans la langue cible ;
// on essaie d'abord la langue du site, puis a defaut la langue fr
+ $langue_retenue = $lang;
if (!strlen($text)
AND $lang !== 'fr') {
- if ($lang !== $GLOBALS['meta']['langue_site'])
+ if ($lang !== $GLOBALS['meta']['langue_site']) {
$text = inc_traduire_dist($ori, $GLOBALS['meta']['langue_site']);
- else
+ $langue_retenue = (!strlen($text) ? $GLOBALS['meta']['langue_site'] : '');
+ }
+ else {
$text = inc_traduire_dist($ori, 'fr');
+ $langue_retenue = (!strlen($text) ? 'fr' : '');
+ }
}
// Supprimer la mention <NEW> ou <MODIF>
$text = charset2unicode($text,'utf-8');
}
- $deja_vu[$lang][$ori] = $text;
+ if (_request('var_mode') == 'traduction') {
+ if ($text) {
+ $classe = 'debug-traduction' . ($module_retenu == 'ecrire' ? '-prive' : '');
+ $text = '<span lang=' . $langue_retenue . ' class=' . $classe . ' title=' . $ori_complet . '(' . $langue_retenue . ')>' . $text . '</span>';
+ $text = str_replace($module_retenu, "*$module_retenu*", $text);
+ }
+ }
+ else {
+ $deja_vu[$lang][$ori] = $text;
+ }
return $text;
}
-?>
+?>
\ No newline at end of file