@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -38,20 +38,20 @@ discard block |
||
| 38 | 38 | * Liste des fichiers de langue trouvés, dans l'ordre des chemins |
| 39 | 39 | */ |
| 40 | 40 | function find_langs_in_path($file, $dirname = 'lang') { |
| 41 | - static $dirs = []; |
|
| 42 | - $liste = []; |
|
| 43 | - foreach (creer_chemin() as $dir) { |
|
| 44 | - if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 45 | - $dirs[$a] = (is_dir($a) || !$a); |
|
| 46 | - } |
|
| 47 | - if ($dirs[$a]) { |
|
| 48 | - if (is_readable($a .= $file)) { |
|
| 49 | - $liste[] = $a; |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - } |
|
| 41 | + static $dirs = []; |
|
| 42 | + $liste = []; |
|
| 43 | + foreach (creer_chemin() as $dir) { |
|
| 44 | + if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 45 | + $dirs[$a] = (is_dir($a) || !$a); |
|
| 46 | + } |
|
| 47 | + if ($dirs[$a]) { |
|
| 48 | + if (is_readable($a .= $file)) { |
|
| 49 | + $liste[] = $a; |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - return array_reverse($liste); |
|
| 54 | + return array_reverse($liste); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -66,23 +66,23 @@ discard block |
||
| 66 | 66 | * Liste des fichiers touvés pour ce module et cette langue. |
| 67 | 67 | **/ |
| 68 | 68 | function chercher_module_lang($module, $lang = '') { |
| 69 | - if ($lang) { |
|
| 70 | - $lang = '_' . $lang; |
|
| 71 | - } |
|
| 69 | + if ($lang) { |
|
| 70 | + $lang = '_' . $lang; |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - // 1) dans un repertoire nomme lang/ se trouvant sur le chemin |
|
| 74 | - if ( |
|
| 75 | - $f = ($module == 'local' |
|
| 76 | - ? find_in_path($module . $lang . '.php', 'lang/') |
|
| 77 | - : find_langs_in_path($module . $lang . '.php', 'lang/')) |
|
| 78 | - ) { |
|
| 79 | - return is_array($f) ? $f : [$f]; |
|
| 80 | - } |
|
| 73 | + // 1) dans un repertoire nomme lang/ se trouvant sur le chemin |
|
| 74 | + if ( |
|
| 75 | + $f = ($module == 'local' |
|
| 76 | + ? find_in_path($module . $lang . '.php', 'lang/') |
|
| 77 | + : find_langs_in_path($module . $lang . '.php', 'lang/')) |
|
| 78 | + ) { |
|
| 79 | + return is_array($f) ? $f : [$f]; |
|
| 80 | + } |
|
| 81 | 81 | |
| 82 | - // 2) directement dans le chemin (old style, uniquement pour local) |
|
| 83 | - return (($module == 'local') or strpos($module, '/')) |
|
| 84 | - ? (($f = find_in_path($module . $lang . '.php')) ? [$f] : false) |
|
| 85 | - : false; |
|
| 82 | + // 2) directement dans le chemin (old style, uniquement pour local) |
|
| 83 | + return (($module == 'local') or strpos($module, '/')) |
|
| 84 | + ? (($f = find_in_path($module . $lang . '.php')) ? [$f] : false) |
|
| 85 | + : false; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | /** |
@@ -104,33 +104,33 @@ discard block |
||
| 104 | 104 | * @return void |
| 105 | 105 | **/ |
| 106 | 106 | function charger_langue($lang, $module = 'spip') { |
| 107 | - static $langs = []; |
|
| 108 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 109 | - if (!isset($langs[$lang])) { |
|
| 110 | - $langs[$lang] = []; |
|
| 111 | - if ($lang) { |
|
| 112 | - $langs[$lang][] = $lang; |
|
| 113 | - if (strpos($lang, '_') !== false) { |
|
| 114 | - $l = explode('_', $lang); |
|
| 115 | - $langs[$lang][] = reset($l); |
|
| 116 | - } |
|
| 117 | - } |
|
| 118 | - $langs[$lang][] = $GLOBALS['meta']['langue_site']; |
|
| 119 | - $langs[$lang][] = _LANGUE_PAR_DEFAUT; |
|
| 120 | - } |
|
| 121 | - foreach ($langs[$lang] as $l) { |
|
| 122 | - if ($fichiers_lang = chercher_module_lang($module, $l)) { |
|
| 123 | - $GLOBALS['idx_lang'] = 'i18n_' . $module . '_' . $l; |
|
| 124 | - $GLOBALS[$GLOBALS['idx_lang']] = lire_fichier_langue(array_shift($fichiers_lang)); |
|
| 125 | - surcharger_langue($fichiers_lang); |
|
| 126 | - if ($l !== $lang) { |
|
| 127 | - $GLOBALS[$var] = &$GLOBALS['i18n_' . $module . '_' . $l]; |
|
| 128 | - } |
|
| 129 | - $GLOBALS['lang_' . $var] = $l; |
|
| 130 | - #spip_log("module de langue : ${module}_$l.php", 'traduire'); |
|
| 131 | - break; |
|
| 132 | - } |
|
| 133 | - } |
|
| 107 | + static $langs = []; |
|
| 108 | + $var = 'i18n_' . $module . '_' . $lang; |
|
| 109 | + if (!isset($langs[$lang])) { |
|
| 110 | + $langs[$lang] = []; |
|
| 111 | + if ($lang) { |
|
| 112 | + $langs[$lang][] = $lang; |
|
| 113 | + if (strpos($lang, '_') !== false) { |
|
| 114 | + $l = explode('_', $lang); |
|
| 115 | + $langs[$lang][] = reset($l); |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | + $langs[$lang][] = $GLOBALS['meta']['langue_site']; |
|
| 119 | + $langs[$lang][] = _LANGUE_PAR_DEFAUT; |
|
| 120 | + } |
|
| 121 | + foreach ($langs[$lang] as $l) { |
|
| 122 | + if ($fichiers_lang = chercher_module_lang($module, $l)) { |
|
| 123 | + $GLOBALS['idx_lang'] = 'i18n_' . $module . '_' . $l; |
|
| 124 | + $GLOBALS[$GLOBALS['idx_lang']] = lire_fichier_langue(array_shift($fichiers_lang)); |
|
| 125 | + surcharger_langue($fichiers_lang); |
|
| 126 | + if ($l !== $lang) { |
|
| 127 | + $GLOBALS[$var] = &$GLOBALS['i18n_' . $module . '_' . $l]; |
|
| 128 | + } |
|
| 129 | + $GLOBALS['lang_' . $var] = $l; |
|
| 130 | + #spip_log("module de langue : ${module}_$l.php", 'traduire'); |
|
| 131 | + break; |
|
| 132 | + } |
|
| 133 | + } |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -143,21 +143,21 @@ discard block |
||
| 143 | 143 | * @return array<string, string> |
| 144 | 144 | */ |
| 145 | 145 | function lire_fichier_langue(string $fichier): array { |
| 146 | - $idx_lang_before = $GLOBALS['idx_lang'] ?? null; |
|
| 147 | - $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang') . '@temporaire'; |
|
| 148 | - $GLOBALS['idx_lang'] = $idx_lang_tmp; |
|
| 149 | - $idx_lang = include $fichier; |
|
| 150 | - $GLOBALS['idx_lang'] = $idx_lang_before; |
|
| 151 | - if (!is_array($idx_lang)) { |
|
| 152 | - if (isset($GLOBALS[$idx_lang_tmp]) and is_array($GLOBALS[$idx_lang_tmp])) { |
|
| 153 | - $idx_lang = $GLOBALS[$idx_lang_tmp]; |
|
| 154 | - } else { |
|
| 155 | - $idx_lang = []; |
|
| 156 | - spip_log(sprintf('Fichier de langue incorrect : %s', $fichier), _LOG_ERREUR); |
|
| 157 | - } |
|
| 158 | - unset($GLOBALS[$idx_lang_tmp]); |
|
| 159 | - } |
|
| 160 | - return $idx_lang; |
|
| 146 | + $idx_lang_before = $GLOBALS['idx_lang'] ?? null; |
|
| 147 | + $idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang') . '@temporaire'; |
|
| 148 | + $GLOBALS['idx_lang'] = $idx_lang_tmp; |
|
| 149 | + $idx_lang = include $fichier; |
|
| 150 | + $GLOBALS['idx_lang'] = $idx_lang_before; |
|
| 151 | + if (!is_array($idx_lang)) { |
|
| 152 | + if (isset($GLOBALS[$idx_lang_tmp]) and is_array($GLOBALS[$idx_lang_tmp])) { |
|
| 153 | + $idx_lang = $GLOBALS[$idx_lang_tmp]; |
|
| 154 | + } else { |
|
| 155 | + $idx_lang = []; |
|
| 156 | + spip_log(sprintf('Fichier de langue incorrect : %s', $fichier), _LOG_ERREUR); |
|
| 157 | + } |
|
| 158 | + unset($GLOBALS[$idx_lang_tmp]); |
|
| 159 | + } |
|
| 160 | + return $idx_lang; |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | /** |
@@ -177,46 +177,46 @@ discard block |
||
| 177 | 177 | * Liste des chemins de fichiers de langue à surcharger. |
| 178 | 178 | **/ |
| 179 | 179 | function surcharger_langue($fichiers) { |
| 180 | - static $surcharges = []; |
|
| 181 | - if (!isset($GLOBALS['idx_lang'])) { |
|
| 182 | - return; |
|
| 183 | - } |
|
| 180 | + static $surcharges = []; |
|
| 181 | + if (!isset($GLOBALS['idx_lang'])) { |
|
| 182 | + return; |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - if (!is_array($fichiers)) { |
|
| 186 | - $fichiers = [$fichiers]; |
|
| 187 | - } |
|
| 188 | - if (!count($fichiers)) { |
|
| 189 | - return; |
|
| 190 | - } |
|
| 191 | - foreach ($fichiers as $fichier) { |
|
| 192 | - if (!isset($surcharges[$fichier])) { |
|
| 193 | - $surcharges[$fichier] = lire_fichier_langue($fichier); |
|
| 194 | - } |
|
| 195 | - if (is_array($surcharges[$fichier])) { |
|
| 196 | - $GLOBALS[$GLOBALS['idx_lang']] ??= []; |
|
| 197 | - $GLOBALS[$GLOBALS['idx_lang']] = array_merge( |
|
| 198 | - $GLOBALS[$GLOBALS['idx_lang']], |
|
| 199 | - $surcharges[$fichier] |
|
| 200 | - ); |
|
| 201 | - } |
|
| 202 | - } |
|
| 185 | + if (!is_array($fichiers)) { |
|
| 186 | + $fichiers = [$fichiers]; |
|
| 187 | + } |
|
| 188 | + if (!count($fichiers)) { |
|
| 189 | + return; |
|
| 190 | + } |
|
| 191 | + foreach ($fichiers as $fichier) { |
|
| 192 | + if (!isset($surcharges[$fichier])) { |
|
| 193 | + $surcharges[$fichier] = lire_fichier_langue($fichier); |
|
| 194 | + } |
|
| 195 | + if (is_array($surcharges[$fichier])) { |
|
| 196 | + $GLOBALS[$GLOBALS['idx_lang']] ??= []; |
|
| 197 | + $GLOBALS[$GLOBALS['idx_lang']] = array_merge( |
|
| 198 | + $GLOBALS[$GLOBALS['idx_lang']], |
|
| 199 | + $surcharges[$fichier] |
|
| 200 | + ); |
|
| 201 | + } |
|
| 202 | + } |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | |
| 207 | 207 | class SPIP_Traductions_Description { |
| 208 | - /** @var string code de langue (hors module) */ |
|
| 209 | - public $code; |
|
| 210 | - /** @var string nom du module de langue */ |
|
| 211 | - public $module; |
|
| 212 | - /** @var string langue de la traduction */ |
|
| 213 | - public $langue; |
|
| 214 | - /** @var string traduction */ |
|
| 215 | - public $texte; |
|
| 216 | - /** @var string var mode particulier appliqué ? */ |
|
| 217 | - public $mode; |
|
| 218 | - /** @var bool Corrections des textes appliqué ? */ |
|
| 219 | - public $corrections = false; |
|
| 208 | + /** @var string code de langue (hors module) */ |
|
| 209 | + public $code; |
|
| 210 | + /** @var string nom du module de langue */ |
|
| 211 | + public $module; |
|
| 212 | + /** @var string langue de la traduction */ |
|
| 213 | + public $langue; |
|
| 214 | + /** @var string traduction */ |
|
| 215 | + public $texte; |
|
| 216 | + /** @var string var mode particulier appliqué ? */ |
|
| 217 | + public $mode; |
|
| 218 | + /** @var bool Corrections des textes appliqué ? */ |
|
| 219 | + public $corrections = false; |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
@@ -258,99 +258,99 @@ discard block |
||
| 258 | 258 | * - SPIP_Traductions_Description : traduction et description (texte, module, langue) |
| 259 | 259 | **/ |
| 260 | 260 | function inc_traduire_dist($ori, $lang, $raw = false) { |
| 261 | - static $deja_vu = []; |
|
| 262 | - static $local = []; |
|
| 261 | + static $deja_vu = []; |
|
| 262 | + static $local = []; |
|
| 263 | 263 | |
| 264 | - if (isset($deja_vu[$lang][$ori]) and (_request('var_mode') != 'traduction')) { |
|
| 265 | - return $raw ? $deja_vu[$lang][$ori] : $deja_vu[$lang][$ori]->texte; |
|
| 266 | - } |
|
| 264 | + if (isset($deja_vu[$lang][$ori]) and (_request('var_mode') != 'traduction')) { |
|
| 265 | + return $raw ? $deja_vu[$lang][$ori] : $deja_vu[$lang][$ori]->texte; |
|
| 266 | + } |
|
| 267 | 267 | |
| 268 | - // modules demandes explicitement <xxx|yyy|zzz:code> cf MODULES_IDIOMES |
|
| 269 | - if (strpos($ori, ':')) { |
|
| 270 | - [$modules, $code] = explode(':', $ori, 2); |
|
| 271 | - $modules = explode('|', $modules); |
|
| 272 | - $ori_complet = $ori; |
|
| 273 | - } else { |
|
| 274 | - $modules = ['spip', 'ecrire']; |
|
| 275 | - $code = $ori; |
|
| 276 | - $ori_complet = implode('|', $modules) . ':' . $ori; |
|
| 277 | - } |
|
| 268 | + // modules demandes explicitement <xxx|yyy|zzz:code> cf MODULES_IDIOMES |
|
| 269 | + if (strpos($ori, ':')) { |
|
| 270 | + [$modules, $code] = explode(':', $ori, 2); |
|
| 271 | + $modules = explode('|', $modules); |
|
| 272 | + $ori_complet = $ori; |
|
| 273 | + } else { |
|
| 274 | + $modules = ['spip', 'ecrire']; |
|
| 275 | + $code = $ori; |
|
| 276 | + $ori_complet = implode('|', $modules) . ':' . $ori; |
|
| 277 | + } |
|
| 278 | 278 | |
| 279 | - $desc = new SPIP_Traductions_Description(); |
|
| 279 | + $desc = new SPIP_Traductions_Description(); |
|
| 280 | 280 | |
| 281 | - // parcourir tous les modules jusqu'a ce qu'on trouve |
|
| 282 | - foreach ($modules as $module) { |
|
| 283 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 281 | + // parcourir tous les modules jusqu'a ce qu'on trouve |
|
| 282 | + foreach ($modules as $module) { |
|
| 283 | + $var = 'i18n_' . $module . '_' . $lang; |
|
| 284 | 284 | |
| 285 | - if (empty($GLOBALS[$var])) { |
|
| 286 | - charger_langue($lang, $module); |
|
| 287 | - // surcharges persos -- on cherche |
|
| 288 | - // (lang/)local_xx.php et/ou (lang/)local.php ... |
|
| 289 | - if (!isset($local['local_' . $lang])) { |
|
| 290 | - // redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer) |
|
| 291 | - $GLOBALS['idx_lang'] = $var; |
|
| 292 | - // ... (lang/)local_xx.php |
|
| 293 | - $local['local_' . $lang] = chercher_module_lang('local', $lang); |
|
| 294 | - } |
|
| 295 | - if ($local['local_' . $lang]) { |
|
| 296 | - surcharger_langue($local['local_' . $lang]); |
|
| 297 | - } |
|
| 298 | - // ... puis (lang/)local.php |
|
| 299 | - if (!isset($local['local'])) { |
|
| 300 | - $local['local'] = chercher_module_lang('local'); |
|
| 301 | - } |
|
| 302 | - if ($local['local']) { |
|
| 303 | - surcharger_langue($local['local']); |
|
| 304 | - } |
|
| 305 | - } |
|
| 285 | + if (empty($GLOBALS[$var])) { |
|
| 286 | + charger_langue($lang, $module); |
|
| 287 | + // surcharges persos -- on cherche |
|
| 288 | + // (lang/)local_xx.php et/ou (lang/)local.php ... |
|
| 289 | + if (!isset($local['local_' . $lang])) { |
|
| 290 | + // redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer) |
|
| 291 | + $GLOBALS['idx_lang'] = $var; |
|
| 292 | + // ... (lang/)local_xx.php |
|
| 293 | + $local['local_' . $lang] = chercher_module_lang('local', $lang); |
|
| 294 | + } |
|
| 295 | + if ($local['local_' . $lang]) { |
|
| 296 | + surcharger_langue($local['local_' . $lang]); |
|
| 297 | + } |
|
| 298 | + // ... puis (lang/)local.php |
|
| 299 | + if (!isset($local['local'])) { |
|
| 300 | + $local['local'] = chercher_module_lang('local'); |
|
| 301 | + } |
|
| 302 | + if ($local['local']) { |
|
| 303 | + surcharger_langue($local['local']); |
|
| 304 | + } |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | - if (isset($GLOBALS[$var][$code])) { |
|
| 308 | - $desc->code = $code; |
|
| 309 | - $desc->module = $module; |
|
| 310 | - $desc->langue = $GLOBALS['lang_' . $var]; |
|
| 311 | - $desc->texte = $GLOBALS[$var][$code]; |
|
| 312 | - break; |
|
| 313 | - } |
|
| 314 | - } |
|
| 307 | + if (isset($GLOBALS[$var][$code])) { |
|
| 308 | + $desc->code = $code; |
|
| 309 | + $desc->module = $module; |
|
| 310 | + $desc->langue = $GLOBALS['lang_' . $var]; |
|
| 311 | + $desc->texte = $GLOBALS[$var][$code]; |
|
| 312 | + break; |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | - if (!$desc->corrections) { |
|
| 317 | - $desc->corrections = true; |
|
| 318 | - // Retour aux sources si la chaine est absente dans la langue cible ; |
|
| 319 | - // on essaie d'abord la langue du site, puis a defaut la langue fr |
|
| 320 | - if ( |
|
| 321 | - ($desc->texte === null || !strlen($desc->texte)) |
|
| 322 | - and $lang !== _LANGUE_PAR_DEFAUT |
|
| 323 | - ) { |
|
| 324 | - if ($lang !== $GLOBALS['meta']['langue_site']) { |
|
| 325 | - $desc = inc_traduire_dist($ori, $GLOBALS['meta']['langue_site'], true); |
|
| 326 | - } else { |
|
| 327 | - $desc = inc_traduire_dist($ori, _LANGUE_PAR_DEFAUT, true); |
|
| 328 | - } |
|
| 329 | - } |
|
| 316 | + if (!$desc->corrections) { |
|
| 317 | + $desc->corrections = true; |
|
| 318 | + // Retour aux sources si la chaine est absente dans la langue cible ; |
|
| 319 | + // on essaie d'abord la langue du site, puis a defaut la langue fr |
|
| 320 | + if ( |
|
| 321 | + ($desc->texte === null || !strlen($desc->texte)) |
|
| 322 | + and $lang !== _LANGUE_PAR_DEFAUT |
|
| 323 | + ) { |
|
| 324 | + if ($lang !== $GLOBALS['meta']['langue_site']) { |
|
| 325 | + $desc = inc_traduire_dist($ori, $GLOBALS['meta']['langue_site'], true); |
|
| 326 | + } else { |
|
| 327 | + $desc = inc_traduire_dist($ori, _LANGUE_PAR_DEFAUT, true); |
|
| 328 | + } |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - // Supprimer la mention <NEW> ou <MODIF> |
|
| 332 | - if ($desc->texte && substr($desc->texte, 0, 1) === '<') { |
|
| 333 | - $desc->texte = str_replace(['<NEW>', '<MODIF>'], [], $desc->texte); |
|
| 334 | - } |
|
| 331 | + // Supprimer la mention <NEW> ou <MODIF> |
|
| 332 | + if ($desc->texte && substr($desc->texte, 0, 1) === '<') { |
|
| 333 | + $desc->texte = str_replace(['<NEW>', '<MODIF>'], [], $desc->texte); |
|
| 334 | + } |
|
| 335 | 335 | |
| 336 | - // Si on n'est pas en utf-8, la chaine peut l'etre... |
|
| 337 | - // le cas echeant on la convertit en entites html &#xxx; |
|
| 338 | - if ( |
|
| 339 | - (!isset($GLOBALS['meta']['charset']) or $GLOBALS['meta']['charset'] !== 'utf-8') |
|
| 340 | - and preg_match(',[\x7f-\xff],S', $desc->texte) |
|
| 341 | - ) { |
|
| 342 | - include_spip('inc/charsets'); |
|
| 343 | - $desc->texte = charset2unicode($desc->texte, 'utf-8'); |
|
| 344 | - } |
|
| 345 | - } |
|
| 336 | + // Si on n'est pas en utf-8, la chaine peut l'etre... |
|
| 337 | + // le cas echeant on la convertit en entites html &#xxx; |
|
| 338 | + if ( |
|
| 339 | + (!isset($GLOBALS['meta']['charset']) or $GLOBALS['meta']['charset'] !== 'utf-8') |
|
| 340 | + and preg_match(',[\x7f-\xff],S', $desc->texte) |
|
| 341 | + ) { |
|
| 342 | + include_spip('inc/charsets'); |
|
| 343 | + $desc->texte = charset2unicode($desc->texte, 'utf-8'); |
|
| 344 | + } |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | - if (_request('var_mode') == 'traduction') { |
|
| 348 | - $desc = definir_details_traduction($desc, $ori_complet); |
|
| 349 | - } else { |
|
| 350 | - $deja_vu[$lang][$ori] = $desc; |
|
| 351 | - } |
|
| 347 | + if (_request('var_mode') == 'traduction') { |
|
| 348 | + $desc = definir_details_traduction($desc, $ori_complet); |
|
| 349 | + } else { |
|
| 350 | + $deja_vu[$lang][$ori] = $desc; |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | - return $raw ? $desc : $desc->texte; |
|
| 353 | + return $raw ? $desc : $desc->texte; |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | /** |
@@ -362,23 +362,23 @@ discard block |
||
| 362 | 362 | * @return SPIP_Traductions_Description |
| 363 | 363 | */ |
| 364 | 364 | function definir_details_traduction($desc, $modules) { |
| 365 | - if (!$desc->mode and $desc->texte) { |
|
| 366 | - // ne pas modifier 2 fois l'affichage |
|
| 367 | - $desc->mode = 'traduction'; |
|
| 368 | - $classe = 'debug-traduction' . ($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 369 | - $desc->texte = '<span ' |
|
| 370 | - . 'lang=' . $desc->langue |
|
| 371 | - . ' class=' . $classe |
|
| 372 | - . ' data-module=' . $desc->module |
|
| 373 | - . ' data-code=' . $desc->code |
|
| 374 | - . ' title=' . $modules . '(' . $desc->langue . ')>' |
|
| 375 | - . $desc->texte |
|
| 376 | - . '</span>'; |
|
| 377 | - $desc->texte = str_replace( |
|
| 378 | - ["$desc->module:", "$desc->module|"], |
|
| 379 | - ["*$desc->module*:", "*$desc->module*|"], |
|
| 380 | - $desc->texte |
|
| 381 | - ); |
|
| 382 | - } |
|
| 383 | - return $desc; |
|
| 365 | + if (!$desc->mode and $desc->texte) { |
|
| 366 | + // ne pas modifier 2 fois l'affichage |
|
| 367 | + $desc->mode = 'traduction'; |
|
| 368 | + $classe = 'debug-traduction' . ($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 369 | + $desc->texte = '<span ' |
|
| 370 | + . 'lang=' . $desc->langue |
|
| 371 | + . ' class=' . $classe |
|
| 372 | + . ' data-module=' . $desc->module |
|
| 373 | + . ' data-code=' . $desc->code |
|
| 374 | + . ' title=' . $modules . '(' . $desc->langue . ')>' |
|
| 375 | + . $desc->texte |
|
| 376 | + . '</span>'; |
|
| 377 | + $desc->texte = str_replace( |
|
| 378 | + ["$desc->module:", "$desc->module|"], |
|
| 379 | + ["*$desc->module*:", "*$desc->module*|"], |
|
| 380 | + $desc->texte |
|
| 381 | + ); |
|
| 382 | + } |
|
| 383 | + return $desc; |
|
| 384 | 384 | } |