Skip to content
Extraits de code Groupes Projets
Valider 30766c14 rédigé par Fil's avatar Fil
Parcourir les fichiers

Une version probablement plus rapide (pas mesuré) et prenant moins de mémoire...

Une version probablement plus rapide (pas mesuré) et prenant moins de mémoire au chargement de la langue.
parent 5c440a6b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -5,16 +5,26 @@ ...@@ -5,16 +5,26 @@
if (defined("_ECRIRE_I18N_EN")) return; if (defined("_ECRIRE_I18N_EN")) return;
define("_ECRIRE_I18N_EN", "1"); define("_ECRIRE_I18N_EN", "1");
global $i18n; $GLOBALS['i18n_en'] = Array
(
//
// ecrire/inc_presentation.php3 // ecrire/inc_presentation.php3
// 'Auteurs' =>
$i18n['en']['Auteurs'] = 'Authors'; 'Authors',
$i18n['en']['Informations personnelles'] = 'Personal data';
$i18n['en']['1 nouveau message'] = 'YOU HAVE A NEW MESSAGE'; 'Informations personnelles' =>
$i18n['en']['@n@ nouveaux messages'] = 'YOU HAVE @n@ NEW MESSAGES'; 'Personal data',
'1 nouveau message' =>
'YOU HAVE A NEW MESSAGE',
'@n@ nouveaux messages' =>
'YOU HAVE @n@ NEW MESSAGES',
// etc. // etc.
// fin
'');
?> ?>
\ No newline at end of file
...@@ -5,16 +5,26 @@ ...@@ -5,16 +5,26 @@
if (defined("_ECRIRE_I18N_FR")) return; if (defined("_ECRIRE_I18N_FR")) return;
define("_ECRIRE_I18N_FR", "1"); define("_ECRIRE_I18N_FR", "1");
global $i18n; $GLOBALS['i18n_fr'] = Array
(
//
// ecrire/inc_presentation.php3 // ecrire/inc_presentation.php3
// 'Auteurs' =>
$i18n['fr']['Auteurs'] = 'Auteurs'; 'Auteurs',
$i18n['fr']['Informations personnelles'] = 'Informations personnelles';
$i18n['fr']['1 nouveau message'] = 'VOUS AVEZ UN NOUVEAU MESSAGE'; 'Informations personnelles' =>
$i18n['fr']['@n@ nouveaux messages'] = 'VOUS AVEZ @n@ NOUVEAUX MESSAGES'; 'Informations personnelles',
'1 nouveau message' =>
'VOUS AVEZ UN NOUVEAU MESSAGE',
'@n@ nouveaux messages' =>
'VOUS AVEZ @n@ NOUVEAUX MESSAGES',
// etc. // etc.
// fin
'');
?> ?>
\ No newline at end of file
...@@ -21,11 +21,10 @@ function text_merge($text, $args) { ...@@ -21,11 +21,10 @@ function text_merge($text, $args) {
// i18n : our own small gettext // i18n : our own small gettext
// //
function spip_gettext($text, $args, $lang) { function spip_gettext($text, $args, $lang) {
global $i18n;
global $dir_ecrire; global $dir_ecrire;
// load the language file // load the language file
if (!$i18n[$lang]) { if (!$GLOBALS["i18n_$lang"]) {
if (file_exists($dir_ecrire."i18n/spip_$lang.php3")) if (file_exists($dir_ecrire."i18n/spip_$lang.php3"))
include_ecrire ("i18n/spip_$lang.php3"); include_ecrire ("i18n/spip_$lang.php3");
else { else {
...@@ -35,14 +34,14 @@ function spip_gettext($text, $args, $lang) { ...@@ -35,14 +34,14 @@ function spip_gettext($text, $args, $lang) {
} }
// get the french text if the translation file is not complete // get the french text if the translation file is not complete
if (!$i18n[$lang][$text]) { if (!$GLOBALS["i18n_$lang"][$text]) {
$lang = 'fr'; $lang = 'fr';
include_ecrire ("i18n/spip_fr.php3"); include_ecrire ("i18n/spip_fr.php3");
} }
// use the translated text if found // use the translated text if found
if ($i18n[$lang][$text]) if ($GLOBALS["i18n_$lang"][$text])
$text = $i18n[$lang][$text]; $text = $GLOBALS["i18n_$lang"][$text];
// merge it with the variables // merge it with the variables
return text_merge($text, $args); return text_merge($text, $args);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter