integration du renommage des url english
This commit is contained in:
parent
f5b61564e4
commit
c77448b51c
@ -2,8 +2,26 @@
|
||||
|
||||
register_lang ('fr',
|
||||
array (
|
||||
'name' => 'Français',
|
||||
'loc' => '/',
|
||||
'name' => 'Français',
|
||||
'loc' => '/',
|
||||
'pages' => [
|
||||
/* Conserver l'ordre !! */
|
||||
'a-propos-april-et-expolibre.php',
|
||||
'a-propos.php',
|
||||
'contact.php',
|
||||
'credits.php',
|
||||
'enjeux-du-logiciel-libre.php',
|
||||
'exposer.php',
|
||||
'exposition.php',
|
||||
'formats-ouverts.php',
|
||||
'index.php',
|
||||
'licences-logiciels-libres.php',
|
||||
'logiciel-libre-au-quotidien.php',
|
||||
'logiciel-libre.php',
|
||||
'logiciels-libres-pour-education.php',
|
||||
'modeles-libres.php',
|
||||
'telecharger.php',
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
@ -11,22 +29,25 @@ register_lang ('en',
|
||||
array (
|
||||
'name' => 'English',
|
||||
'loc' => '/en/',
|
||||
/* Conserver l'ordre !! */
|
||||
'pages' => [
|
||||
'about-april-and-libreexpo.php',
|
||||
'about.php',
|
||||
'contact.php',
|
||||
'credits.php',
|
||||
'what-is-at-stake-with-free-software.php',
|
||||
'exhibit.php',
|
||||
'exhibition.php',
|
||||
'open-formats.php',
|
||||
'index.php',
|
||||
'free-licenses.php',
|
||||
'free-libre-software-in-daily-life.php',
|
||||
'free-libre-software.php',
|
||||
'free-libre-software-in-education.php',
|
||||
'beyond-free-software.php',
|
||||
'download.php',
|
||||
],
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
register_lang ('es',
|
||||
array (
|
||||
'name' => 'Español',
|
||||
'loc' => '/es/',
|
||||
)
|
||||
);
|
||||
|
||||
register_lang ('eo',
|
||||
array (
|
||||
'name' => 'Esperanto',
|
||||
'loc' => '/eo/',
|
||||
)
|
||||
);
|
||||
*/
|
||||
?>
|
||||
|
@ -27,6 +27,25 @@ function prefered_language () {
|
||||
return locale_lookup (array_keys ($registered_languages), $locale, true, 'fr');
|
||||
}
|
||||
|
||||
/*
|
||||
* URL translation
|
||||
*/
|
||||
|
||||
function url_translate ($url, $to) {
|
||||
global $registered_languages;
|
||||
|
||||
$current_dir= basename (getcwd ());
|
||||
if ($current_dir == "htdocs")
|
||||
$from= 'fr';
|
||||
else
|
||||
$from= $current_dir;
|
||||
|
||||
$name= basename ($url);
|
||||
$index= array_search ($name, $registered_languages[$from]['pages']);
|
||||
return $registered_languages[$to]['loc'] . $registered_languages[$to]['pages'][$index];
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Redirect to prefered language, if needed, when referer is none or ourself
|
||||
*/
|
||||
@ -39,4 +58,5 @@ if (!isset ($_SERVER['HTTP_REFERER']) or strrpos ($_SERVER['HTTP_REFERER'], $_SE
|
||||
exit ();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user