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

gestion des fichiers de lang dans le _SPIP_PATH

parent c4537744
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -16,32 +16,27 @@ if (!defined("_ECRIRE_INC_VERSION")) return;
// Charger un fichier langue
//
function include_lang($file) {
$file = _DIR_LANG . $file;
if (@$GLOBALS['included_files'][$file]++) return;
include($file);
}
function charger_langue($lang, $module = 'spip') {
$fichier_lang = $module.'_'.$lang._EXTENSION_PHP;
$fichier_lang_exists = @is_readable(_DIR_LANG . $fichier_lang);
if ($fichier_lang_exists) {
if ($fichier_lang = find_in_path($module.'_'.$lang._EXTENSION_PHP,
'AUTO', _DIR_LANG)) {
$GLOBALS['idx_lang']='i18n_'.$module.'_'.$lang;
include_lang($fichier_lang);
include_local($fichier_lang);
} else {
// si le fichier de langue du module n'existe pas, on se rabat sur
// la langue par defaut du site -- et au pire sur le francais, qui
// *par definition* doit exister, et on copie le tableau dans la
// var liee a la langue
$l = $GLOBALS['meta']['langue_site'];
if (!is_readable(_DIR_LANG . $module.'_'.$l._EXTENSION_PHP));
if (!$fichier_lang = find_lang_in_path($module.'_'.$l._EXTENSION_PHP,
'AUTO', _DIR_LANG)) {
$l = 'fr';
$fichier_lang = $module.'_' .$l . _EXTENSION_PHP;
if (is_readable(_DIR_LANG . $fichier_lang)) {
$fichier_lang = find_lang_in_path($module.'_'.$l._EXTENSION_PHP,
'AUTO', _DIR_LANG);
}
if ($fichier_lang) {
$GLOBALS['idx_lang']='i18n_'.$module.'_' .$l;
include_lang($fichier_lang);
include_local($fichier_lang);
$GLOBALS['i18n_'.$module.'_'.$lang]
= &$GLOBALS['i18n_'.$module.'_'.$l];
#spip_log("module de langue : ${module}_$l.php");
......
......@@ -69,11 +69,9 @@ function afficher_raccourcis($module = "public") {
global $couleur_foncee;
$lang = $module.'_'.$spip_lang;
$fichier_lang = $lang._EXTENSION_PHP;
if (@file_exists(_DIR_LANG . $fichier_lang)) {
if ($fichier_lang = find_in_path($lang._EXTENSION_PHP, 'AUTO', _DIR_LANG)) {
$GLOBALS['idx_lang'] = 'i18n_' . $lang;
include_lang($fichier_lang);
include_local($fichier_lang);
$tableau = $GLOBALS['i18n_' . $lang];
ksort($tableau);
......
......@@ -568,7 +568,7 @@ function texte_script($texte) {
// find_in_path() : chercher un fichier nomme x selon le chemin rep1:rep2:rep3
//
function find_in_path ($filename, $path='AUTO') {
function find_in_path ($filename, $path='AUTO', $sinon='') {
static $autopath;
// Chemin standard depuis l'espace public
......@@ -601,6 +601,10 @@ function find_in_path ($filename, $path='AUTO') {
return $f;
}
}
// sinon essayer $sinon
if ($sinon AND @is_readable($f = "$sinon$filename"))
return $f;
}
// charger les definitions des plugins
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter