Skip to content
Extraits de code Groupes Projets
Valider 28c8f01f rédigé par ARNO*'s avatar ARNO*
Parcourir les fichiers

Modif config langue: ajout simplifi'e

parent 33099a35
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -26,6 +26,24 @@ debut_droite(); ...@@ -26,6 +26,24 @@ debut_droite();
lire_metas(); lire_metas();
/// Recuperer liste des fichiers de langue
$myDir = opendir("lang");
while($entryName = readdir($myDir)) {
if (is_file("lang/".$entryName)) {
if (ereg("^spip\_([^\.]*)", $entryName, $match)) {
$ext = $match[1];
$langues_toutes[] = "$ext";
}
}
}
closedir($myDir);
$sauver_langues_ok = join ($langues_toutes,",");
ecrire_meta('sauver_langues_ok', $sauver_langues_ok);
echo "<form action='config-lang.php3' method='post'>"; echo "<form action='config-lang.php3' method='post'>";
echo "<input type='hidden' name='changer_config' value='oui'>"; echo "<input type='hidden' name='changer_config' value='oui'>";
...@@ -34,6 +52,7 @@ echo "<input type='hidden' name='changer_config' value='oui'>"; ...@@ -34,6 +52,7 @@ echo "<input type='hidden' name='changer_config' value='oui'>";
// Configuration i18n // Configuration i18n
// //
debut_cadre_relief("langues-24.gif"); debut_cadre_relief("langues-24.gif");
$langues_prop = split(",",lire_meta("langues_proposees")); $langues_prop = split(",",lire_meta("langues_proposees"));
...@@ -51,11 +70,11 @@ echo "</TD></TR>"; ...@@ -51,11 +70,11 @@ echo "</TD></TR>";
echo "<TR><TD ALIGN='left' class='verdana2'>"; echo "<TR><TD ALIGN='left' class='verdana2'>";
echo _T('info_langue_defaut'); echo _T('info_langue_defaut');
echo "\n<select name='langue_site' class='fondl'>\n"; echo "\n<select name='langue_site' class='fondl'>\n";
echo "<option value='$langue_site' style='background-image: url(lang/drap_$langue_site.gif); background-repeat: no-repeat; background-position: 3px 3px; padding-left: 20px;' selected>"._T("langue_".$langue_site)."</option>\n"; echo "<option value='$langue_site' style='background-image: url(lang/drap_$langue_site.gif); background-repeat: no-repeat; background-position: 3px 3px; padding-left: 20px;' selected>".traduire_nom_langue($langue_site)."</option>\n";
reset ($langues_prop); reset ($langues_prop);
while (list(,$l) = each ($langues_prop)) { while (list(,$l) = each ($langues_prop)) {
if ($l <> $langue_site) if ($l <> $langue_site)
echo "<option value='$l' style='background-image: url(lang/drap_$l.gif); background-repeat: no-repeat; background-position: 3px 3px; padding-left: 20px;'>"._T("langue_".$l)."</option>\n"; echo "<option value='$l' style='background-image: url(lang/drap_$l.gif); background-repeat: no-repeat; background-position: 3px 3px; padding-left: 20px;'>".traduire_nom_langue($l)."</option>\n";
} }
echo "</select><br>\n"; echo "</select><br>\n";
echo "</TD></TR>"; echo "</TD></TR>";
...@@ -64,17 +83,17 @@ echo "</TD></TR>"; ...@@ -64,17 +83,17 @@ echo "</TD></TR>";
// langues proposees // langues proposees
echo "<TR><TD ALIGN='left' class='verdana2'>"; echo "<TR><TD ALIGN='left' class='verdana2'>";
echo _T('info_langues_proposees'); echo _T('info_langues_proposees');
$langues_toutes = split(',',$all_langs); //$langues_toutes = split(',',$all_langs);
$langues_proposees = lire_meta('langues_proposees'); $langues_proposees = lire_meta('langues_proposees');
$test = (ereg(",$langue_site,", ",$langues_tests,")) ? _T('info_en_test_1') : ""; $test = (ereg(",$langue_site,", ",$langues_tests,")) ? _T('info_en_test_1') : "";
echo "<input type='checkbox' name='langues_prop[]' value='$langue_site' checked id='lang_$langue_site'><label for='lang_$langue_site'>&nbsp;<b>"._T("langue_".$langue_site).'</b>'.$test."</label>\n"; echo "<input type='checkbox' name='langues_prop[]' value='$langue_site' checked id='lang_$langue_site'><label for='lang_$langue_site'>&nbsp;<b>".traduire_nom_langue($langue_site).'</b>'.$test."</label>\n";
while (list(,$l) = each ($langues_toutes)) { while (list(,$l) = each ($langues_toutes)) {
if ($l AND ($l <> $langue_site)) { if ($l AND ($l <> $langue_site)) {
$test = (ereg(",$l,", ",$langues_tests,")) ? _T('info_en_test_2') : ""; $test = (ereg(",$l,", ",$langues_tests,")) ? _T('info_en_test_2') : "";
if (ereg(",$l,", ",$langues_proposees,")) if (ereg(",$l,", ",$langues_proposees,"))
echo "<br>&nbsp; <input type='checkbox' name='langues_prop[]' value='$l' checked id='lang_$l'><label for='lang_$l'>&nbsp;<b>"._T("langue_".$l).'</b>'.$test.'</label>'; echo "<br>&nbsp; <input type='checkbox' name='langues_prop[]' value='$l' checked id='lang_$l'><label for='lang_$l'>&nbsp;<b>".traduire_nom_langue($l).'</b>'.$test.'</label>';
else else
echo "<br>&nbsp; <input type='checkbox' name='langues_prop[]' value='$l' id='lang_$l'> <label for='lang_$l'>"._T("langue_".$l).$test.'</label>'; echo "<br>&nbsp; <input type='checkbox' name='langues_prop[]' value='$l' id='lang_$l'> <label for='lang_$l'>".traduire_nom_langue($l).$test.'</label>';
} }
} }
echo "</TD></TR>"; echo "</TD></TR>";
......
...@@ -65,12 +65,33 @@ function traduire_chaine($text, $args) { ...@@ -65,12 +65,33 @@ function traduire_chaine($text, $args) {
} }
function traduire_nom_langue($lang) {
$retour = _T("langue_".$lang);
if (strlen($retour) == 0) {
include_ecrire("inc_liste_lang.php3");
$retour = $GLOBALS['codes_langues'][$lang];
}
if (strlen($retour) == 0) {
$retour = $lang;
}
return $retour;
}
// //
// Initialisation // Initialisation
// //
$GLOBALS['langues_ok'] = 'fr'; $GLOBALS['langues_ok'] = 'fr';
$GLOBALS['langues_tests'] = 'en,ro,eo,es,ar,br'; $GLOBALS['langues_tests'] = 'en,ro,eo,es,ar,br';
$GLOBALS['all_langs'] = $GLOBALS['langues_ok'].",".$GLOBALS['langues_tests']; //$GLOBALS['all_langs'] = $GLOBALS['langues_ok'].",".$GLOBALS['langues_tests'];
$GLOBALS['all_langs'] = lire_meta('sauver_langues_ok');
if (strlen($GLOBALS['all_langs']) == 0) $GLOBALS['all_langs'] = $GLOBALS['langues_ok'].",".$GLOBALS['langues_tests'];
$GLOBALS['spip_lang'] = 'fr'; $GLOBALS['spip_lang'] = 'fr';
if (!regler_langue_navigateur()) if (!regler_langue_navigateur())
...@@ -78,4 +99,7 @@ if (!regler_langue_navigateur()) ...@@ -78,4 +99,7 @@ if (!regler_langue_navigateur())
if ($GLOBALS['prefs']['spip_lang']) if ($GLOBALS['prefs']['spip_lang'])
changer_langue($GLOBALS['prefs']['spip_lang']); changer_langue($GLOBALS['prefs']['spip_lang']);
?> ?>
<?php
// Ce fichier ne sera execute qu'une fois
if (defined("_ECRIRE_INC__LISTE_LANG")) return;
define("_ECRIRE_INC__LISTE_LANG", "1");
$GLOBALS['codes_langues'] = array (
'aa' => 'Afar',
'ab' => 'Abkhazian',
'af' => 'Afrikaans',
'am' => 'Amharic',
'ar' => 'Arabic',
'as' => 'Assamese',
'ay' => 'Aymara',
'az' => 'Azerbaijani',
'ba' => 'Bashkir',
'be' => 'Byelorussian',
'bg' => 'Bulgarian',
'bh' => 'Bihari',
'bi' => 'Bislama',
'bn' => 'Bengali; Bangla',
'bo' => 'Tibetan',
'br' => 'Breton',
'ca' => 'Catalan',
'co' => 'Corsican',
'cs' => 'Czech',
'cy' => 'Welsh',
'da' => 'Danish',
'de' => 'Deutch',
'dz' => 'Bhutani',
'el' => 'Greek',
'en' => 'English',
'eo' => 'Esperanto',
'es' => 'Spanish',
'et' => 'Estonian',
'eu' => 'Basque',
'fa' => 'Persian',
'fi' => 'Finnish',
'fj' => 'Fiji',
'fo' => 'Faroese',
'fr' => 'Fran&ccedil;ais',
'fy' => 'Frisian',
'ga' => 'Irish',
'gd' => 'Scots Gaelic',
'gl' => 'Galician',
'gn' => 'Guarani',
'gu' => 'Gujarati',
'ha' => 'Hausa',
'he' => 'Hebrew',
'hi' => 'Hindi',
'hr' => 'Croatian',
'hu' => 'Hungarian',
'hy' => 'Armenian',
'ia' => 'Interlingua',
'id' => 'Indonesian',
'ie' => 'Interlingue',
'ik' => 'Inupiak',
'is' => 'Icelandic',
'it' => 'Italian',
'iu' => 'Inuktitut',
'ja' => 'Japanese',
'jw' => 'Javanese',
'ka' => 'Georgian',
'kk' => 'Kazakh',
'kl' => 'Greenlandic',
'km' => 'Cambodian',
'kn' => 'Kannada',
'ko' => 'Korean',
'ks' => 'Kashmiri',
'ku' => 'Kurdish',
'ky' => 'Kirghiz',
'la' => 'Latin',
'ln' => 'Lingala',
'lo' => 'Laothian',
'lt' => 'Lithuanian',
'lv' => 'Latvian, Lettish',
'mg' => 'Malagasy',
'mi' => 'Maori',
'mk' => 'Macedonian',
'ml' => 'Malayalam',
'mn' => 'Mongolian',
'mo' => 'Moldavian',
'mr' => 'Marathi',
'ms' => 'Malay',
'mt' => 'Maltese',
'my' => 'Burmese',
'na' => 'Nauru',
'ne' => 'Nepali',
'nl' => 'Dutch',
'no' => 'Norwegian',
'oc' => 'Occitan',
'om' => '(Afan) Oromo',
'or' => 'Oriya',
'pa' => 'Punjabi',
'pl' => 'Polish',
'ps' => 'Pashto, Pushto',
'pt' => 'Portuguese',
'qu' => 'Quechua',
'rm' => 'Rhaeto-Romance',
'rn' => 'Kirundi',
'ro' => 'Romanian',
'ru' => 'Russian',
'rw' => 'Kinyarwanda',
'sa' => 'Sanskrit',
'sd' => 'Sindhi',
'sg' => 'Sangho',
'sh' => 'Serbo-Croatian',
'si' => 'Sinhalese',
'sk' => 'Slovak',
'sl' => 'Slovenian',
'sm' => 'Samoan',
'sn' => 'Shona',
'so' => 'Somali',
'sq' => 'Albanian',
'sr' => 'Serbian',
'ss' => 'Siswati',
'st' => 'Sesotho',
'su' => 'Sundanese',
'sv' => 'Swedish',
'sw' => 'Swahili',
'ta' => 'Tamil',
'te' => 'Telugu',
'tg' => 'Tajik',
'th' => 'Thai',
'ti' => 'Tigrinya',
'tk' => 'Turkmen',
'tl' => 'Tagalog',
'tn' => 'Setswana',
'to' => 'Tonga',
'tr' => 'Turkish',
'ts' => 'Tsonga',
'tt' => 'Tatar',
'tw' => 'Twi',
'ug' => 'Uighur',
'uk' => 'Ukrainian',
'ur' => 'Urdu',
'uz' => 'Uzbek',
'vi' => 'Vietnamese',
'vo' => 'Volapuk',
'wo' => 'Wolof',
'xh' => 'Xhosa',
'yi' => 'Yiddish',
'yo' => 'Yoruba',
'za' => 'Zhuang',
'zh' => 'Chinese',
'zu' => 'Zulu') ;
?>
\ No newline at end of file
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