aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--index.php18
-rw-r--r--langs.php24
2 files changed, 38 insertions, 4 deletions
diff --git a/index.php b/index.php
index e10f5d0be..9293c754f 100644
--- a/index.php
+++ b/index.php
@@ -3,10 +3,26 @@
*/
require_once 'langs.inc.php';
+
+if (isset($_GET['flang']))
+{
+ $lang = array_key_exists($_GET['flang'], $langs) ? $_GET['flang'] : 'en';
+ if (isset($_GET['furl']))
+ {
+ $url = substr_replace($_GET['furl'], $lang, 1, 2);
+ }
+ else
+ $url = '/' . $lang . '/';
+
+ header(sprintf('Location: %s', $url));
+ die;
+}
+
require_once 'localeDetection.class.php';
$locale = new ChooseLocale(array_keys($langs));
$locale->setDefaultLocale('en');
-header(sprintf('Location: /%s/', $locale->getCompatibleLocale())); \ No newline at end of file
+header(sprintf('Location: /%s/', $locale->getCompatibleLocale()));
+die; \ No newline at end of file
diff --git a/langs.php b/langs.php
index 158b5c00f..e03134786 100644
--- a/langs.php
+++ b/langs.php
@@ -22,15 +22,19 @@ foreach ($langs as $k => $v)
$page != null ? implode('/', array($k, $page)) : $k,
$k == $locale ? ' class="sel"' : '',
$v);
+
+ $options[] = sprintf('<option value="%s"%s>%s</option>',
+ $k,
+ $k == $locale ? ' selected="selected"' : '',
+ $v);
}
// global nav
$nav_list = array(
"/{$locale}/" => 'Mageia',
"http://blog.mageia.org/{$locale}" => 'Blog',
- '/wiki' => 'Wiki &ndash; Join us!',
+ '/wiki' => 'Wiki',
"/{$locale}/faq/" => 'FAQ',
- "/{$locale}/#contact" => 'IRC, mailing-lists',
"http://donate.mageia.org/{$locale}/" => 'Donations',
"http://mageia.org/wiki/doku.php?id=press" => 'Press',
"/{$locale}/about/values/" => 'Values',
@@ -46,6 +50,20 @@ foreach ($nav_list as $k => $v)
$v);
}
-echo sprintf('<div class="nav"><p class="loc">%s</p></div>', implode(' | ', $list_menu));
+echo sprintf('<div class="nav"><div class="nav2"><p class="loc">%s</p>', implode(' | ', $list_menu));
+$options = implode($options);
+echo <<<H
+<form id="lang_form" dir="ltr" method="get" action="/">
+ <!--<label for="flang">Autres langues&nbsp;:</label>-->
+ <input type="hidden" name="furl" value="{$_SERVER['REQUEST_URI']}" />
+ <select id="flang" name="flang" dir="ltr" onchange="this.form.submit()">
+ {$options}
+ </select>
+ <noscript><div><input type="submit" id="lang_submit" value="Hop!" /></div></noscript>
+</form>
+</div></div>
+H;
+/*
echo sprintf('<p class="loc">%s</p>', implode(' | ', $list_langs));
+*/ \ No newline at end of file