We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit b9f2d38e authored by elleo's avatar elleo

Make the language selector element automatically select the currently used...

Make the language selector element automatically select the currently used language regardless of how it was chosen.
parent b5060165
......@@ -43,7 +43,7 @@ if($_GET['lang']) {
$languages[$i] = $languages[$i] . ".UTF-8";
}
}
setlocale(LC_ALL, $languages);
$current_lang = setlocale(LC_ALL, $languages);
bindtextdomain("nixtape", $install_path . '/themes/' . $default_theme . '/locale/');
textdomain("nixtape");
......@@ -53,10 +53,9 @@ $smarty->template_dir = $install_path . '/themes/'. $default_theme . '/templates
$smarty->compile_dir = $install_path. '/themes/' . $default_theme . '/templates_c/';
$smarty->cache_dir = $install_path. '/cache/';
$current_lang = isset($_GET['lang']) ? $_GET['lang'] : $_COOKIE['lang'];
$current_lang = preg_replace('/.UTF-8/', '', $current_lang);
$smarty->assign('current_lang', $current_lang);
$smarty->assign('current_lang_array', array($current_lang => 1));
$smarty->assign('base_url', $base_url);
$smarty->assign('this_page', $_SERVER['REQUEST_URI']);
$smarty->assign('this_page_absolute',
......
<form method='get' action=''>
<select name='lang' id='lang' onchange='this.form.submit()'>
<option {if $current_lang_array.en_US}selected="selected"{/if} value='en_US'>English (US)</option>
<option {if $current_lang_array.de_DE}selected="selected"{/if} value='de_DE'>Deutsch (Deutschland)</option>
<option {if $current_lang.en_US}selected="selected"{/if} value='en_US'>English (US)</option>
<option {if $current_lang.de_DE}selected="selected"{/if} value='de_DE'>Deutsch (Deutschland)</option>
</select>
<noscript>
<input type='submit' value='{t}Change Language{/t}' />
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment