Completed
Push — master ( 8c9753...71dce3 )
by cam
01:09
created
ecrire/inc/traduire.php 2 patches
Indentation   +206 added lines, -206 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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] ?? $lang;
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] ?? $lang;
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 	static $dirs = [];
42 42
 	$liste = [];
43 43
 	foreach (creer_chemin() as $dir) {
44
-		if (!isset($dirs[$a = $dir . $dirname])) {
44
+		if (!isset($dirs[$a = $dir.$dirname])) {
45 45
 			$dirs[$a] = (is_dir($a) || !$a);
46 46
 		}
47 47
 		if ($dirs[$a]) {
@@ -67,21 +67,21 @@  discard block
 block discarded – undo
67 67
  **/
68 68
 function chercher_module_lang($module, $lang = '') {
69 69
 	if ($lang) {
70
-		$lang = '_' . $lang;
70
+		$lang = '_'.$lang;
71 71
 	}
72 72
 
73 73
 	// 1) dans un repertoire nomme lang/ se trouvant sur le chemin
74 74
 	if (
75 75
 		$f = ($module == 'local'
76
-		? find_in_path($module . $lang . '.php', 'lang/')
77
-		: find_langs_in_path($module . $lang . '.php', 'lang/'))
76
+		? find_in_path($module.$lang.'.php', 'lang/')
77
+		: find_langs_in_path($module.$lang.'.php', 'lang/'))
78 78
 	) {
79 79
 		return is_array($f) ? $f : [$f];
80 80
 	}
81 81
 
82 82
 	// 2) directement dans le chemin (old style, uniquement pour local)
83 83
 	return (($module == 'local') or strpos($module, '/'))
84
-		? (($f = find_in_path($module . $lang . '.php')) ? [$f] : false)
84
+		? (($f = find_in_path($module.$lang.'.php')) ? [$f] : false)
85 85
 		: false;
86 86
 }
87 87
 
@@ -105,7 +105,7 @@  discard block
 block discarded – undo
105 105
  **/
106 106
 function charger_langue($lang, $module = 'spip') {
107 107
 	static $langs = [];
108
-	$var = 'i18n_' . $module . '_' . $lang;
108
+	$var = 'i18n_'.$module.'_'.$lang;
109 109
 	if (!isset($langs[$lang])) {
110 110
 		$langs[$lang] = [];
111 111
 		if ($lang) {
@@ -120,13 +120,13 @@  discard block
 block discarded – undo
120 120
 	}
121 121
 	foreach ($langs[$lang] as $l) {
122 122
 		if ($fichiers_lang = chercher_module_lang($module, $l)) {
123
-			$GLOBALS['idx_lang'] = 'i18n_' . $module . '_' . $l;
123
+			$GLOBALS['idx_lang'] = 'i18n_'.$module.'_'.$l;
124 124
 			$GLOBALS[$GLOBALS['idx_lang']] = lire_fichier_langue(array_shift($fichiers_lang));
125 125
 			surcharger_langue($fichiers_lang);
126 126
 			if ($l !== $lang) {
127
-				$GLOBALS[$var] = &$GLOBALS['i18n_' . $module . '_' . $l];
127
+				$GLOBALS[$var] = &$GLOBALS['i18n_'.$module.'_'.$l];
128 128
 			}
129
-			$GLOBALS['lang_' . $var] = $l;
129
+			$GLOBALS['lang_'.$var] = $l;
130 130
 			#spip_log("module de langue : ${module}_$l.php", 'traduire');
131 131
 			break;
132 132
 		}
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
  */
145 145
 function lire_fichier_langue(string $fichier): array {
146 146
 	$idx_lang_before = $GLOBALS['idx_lang'] ?? null;
147
-	$idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang') . '@temporaire';
147
+	$idx_lang_tmp = ($GLOBALS['idx_lang'] ?? 'lang').'@temporaire';
148 148
 	$GLOBALS['idx_lang'] = $idx_lang_tmp;
149 149
 	$idx_lang = include $fichier;
150 150
 	$GLOBALS['idx_lang'] = $idx_lang_before;
@@ -273,27 +273,27 @@  discard block
 block discarded – undo
273 273
 	} else {
274 274
 		$modules = ['spip', 'ecrire'];
275 275
 		$code = $ori;
276
-		$ori_complet = implode('|', $modules) . ':' . $ori;
276
+		$ori_complet = implode('|', $modules).':'.$ori;
277 277
 	}
278 278
 
279 279
 	$desc = new SPIP_Traductions_Description();
280 280
 
281 281
 	// parcourir tous les modules jusqu'a ce qu'on trouve
282 282
 	foreach ($modules as $module) {
283
-		$var = 'i18n_' . $module . '_' . $lang;
283
+		$var = 'i18n_'.$module.'_'.$lang;
284 284
 
285 285
 		if (empty($GLOBALS[$var])) {
286 286
 			charger_langue($lang, $module);
287 287
 			// surcharges persos -- on cherche
288 288
 			// (lang/)local_xx.php et/ou (lang/)local.php ...
289
-			if (!isset($local['local_' . $lang])) {
289
+			if (!isset($local['local_'.$lang])) {
290 290
 				// redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer)
291 291
 				$GLOBALS['idx_lang'] = $var;
292 292
 				// ... (lang/)local_xx.php
293
-				$local['local_' . $lang] = chercher_module_lang('local', $lang);
293
+				$local['local_'.$lang] = chercher_module_lang('local', $lang);
294 294
 			}
295
-			if ($local['local_' . $lang]) {
296
-				surcharger_langue($local['local_' . $lang]);
295
+			if ($local['local_'.$lang]) {
296
+				surcharger_langue($local['local_'.$lang]);
297 297
 			}
298 298
 			// ... puis (lang/)local.php
299 299
 			if (!isset($local['local'])) {
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		if (isset($GLOBALS[$var][$code])) {
308 308
 			$desc->code = $code;
309 309
 			$desc->module = $module;
310
-			$desc->langue = $GLOBALS['lang_' . $var] ?? $lang;
310
+			$desc->langue = $GLOBALS['lang_'.$var] ?? $lang;
311 311
 			$desc->texte = $GLOBALS[$var][$code];
312 312
 			break;
313 313
 		}
@@ -365,13 +365,13 @@  discard block
 block discarded – undo
365 365
 	if (!$desc->mode and $desc->texte) {
366 366
 		// ne pas modifier 2 fois l'affichage
367 367
 		$desc->mode = 'traduction';
368
-		$classe = 'debug-traduction' . ($desc->module == 'ecrire' ? '-prive' : '');
368
+		$classe = 'debug-traduction'.($desc->module == 'ecrire' ? '-prive' : '');
369 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 . ')>'
370
+			. 'lang='.$desc->langue
371
+			. ' class='.$classe
372
+			. ' data-module='.$desc->module
373
+			. ' data-code='.$desc->code
374
+			. ' title='.$modules.'('.$desc->langue.')>'
375 375
 			. $desc->texte
376 376
 			. '</span>';
377 377
 		$desc->texte = str_replace(
Please login to merge, or discard this patch.