aboutsummaryrefslogtreecommitdiffstats
path: root/langs.php
diff options
context:
space:
mode:
authorDamien Lallement <dams@mageia.org>2011-02-16 17:30:07 +0000
committerDamien Lallement <dams@mageia.org>2011-02-16 17:30:07 +0000
commit6f294f255cfc41731f5e7da27c973d8b787386c5 (patch)
treeb6770dbc35b46ecf63fdf8ebbaee3b43fc2a57b7 /langs.php
parent111049fa874fa355a9180a24f62d3bb4cbe2f028 (diff)
downloadwww-6f294f255cfc41731f5e7da27c973d8b787386c5.tar
www-6f294f255cfc41731f5e7da27c973d8b787386c5.tar.gz
www-6f294f255cfc41731f5e7da27c973d8b787386c5.tar.bz2
www-6f294f255cfc41731f5e7da27c973d8b787386c5.tar.xz
www-6f294f255cfc41731f5e7da27c973d8b787386c5.zip
fix locale_path and update banner to enable it to prevent 404
Diffstat (limited to 'langs.php')
-rw-r--r--langs.php34
1 files changed, 18 insertions, 16 deletions
diff --git a/langs.php b/langs.php
index 554a788a4..3ca594b7b 100644
--- a/langs.php
+++ b/langs.php
@@ -48,15 +48,17 @@ foreach ($langs as $k => $v)
}
// prevent 404 error on /{$locale}/ with missing translation
-function locale_path($loc,$path)
+function locale_path($path)
{
- $filename = "/".$loc."/".$path;
- $url = "/en/".$path;
- if (file_exists($filename))
- {
- $url = $filename;
- }
- return $url;
+ $pathtofile = "/home/projects/mageia/public_html";
+ $loc = $_SERVER['REQUEST_URI'];
+ $filename = "$pathtofile$loc$path";
+ $url = "/en/$path";
+ if (file_exists($filename))
+ {
+ $url = "$loc$path";
+ }
+ return $url;
}
// global nav
@@ -70,21 +72,21 @@ $nav_list = array(
'ru' => 'Блог'
),
//"/{$locale}/alpha" => 'Alpha',
- locale_path("{$locale}","alpha") => 'Alpha',
+ locale_path('alpha') => 'Alpha',
'/wiki/' => array(
'en' => 'Wiki',
'ru' => 'Вики'
),
//"/{$locale}/faq" => array(
- locale_path("{$locale}","faq") => array(
+ locale_path('faq') => array(
'en' => 'FAQ',
'es' => 'Preguntas Frecuentes',
'et' => 'KKK',
'tr' => 'S.S.S.',
'ro' => 'Întrebări frecvente'
),
- "/{$locale}/donate" => array(
- //locale_path("{$locale}","donate") => array(
+ //"/{$locale}/donate" => array(
+ locale_path('donate') => array(
//"http://www.mageia.org/en/donate//{$locale}/" => array(
'de' => 'Spenden',
'el' => 'Δωρεές',
@@ -109,8 +111,8 @@ $nav_list = array(
'ru' => 'Пресса',
'tr' => 'Basın'
),
- "/{$locale}/about/values" => array(
- //locale_path("{$locale}","about/values") => array(
+ //"/{$locale}/about/values" => array(
+ locale_path('about/values') => array(
'de' => 'Werte',
'el' => 'Αξίες',
'en' => 'Values',
@@ -122,8 +124,8 @@ $nav_list = array(
'ro' => 'Valori',
'ru' => 'Цели'
),
- "/{$locale}/about/code-of-conduct" => array(
- //locale_path("{$locale}","about/code-of-conduct") => array(
+ //"/{$locale}/about/code-of-conduct" => array(
+ locale_path('about/code-of-conduct') => array(
'de' => 'Verhaltenskodex',
'el' => 'Κώδικας συμπεριφοράς',
'en' => 'Code of Conduct',