diff --git a/html/inc/language_names.inc b/html/inc/language_names.inc
index 6db9b1f6a9..bf607b6343 100644
--- a/html/inc/language_names.inc
+++ b/html/inc/language_names.inc
@@ -55,42 +55,39 @@ $language_names = array(
array("zh_TW", "繁體中文", "Chinese (Taiwan)"),
);
-function language_select() {
+function language_select($cur_lang_name) {
global $language_names;
+ echo "cur lang: $cur_lang_name";
$supported_languages = get_supported_languages();
$supported_languages[] = "en";
- $bd = tra("Browser default");
+ $sel = $cur_lang_name?"":"selected";
echo "
-
"
;
diff --git a/html/user/set_language.php b/html/user/set_language.php
new file mode 100644
index 0000000000..24e94d2d97
--- /dev/null
+++ b/html/user/set_language.php
@@ -0,0 +1,31 @@
+.
+
+require_once("../inc/util.inc");
+require_once("../inc/translation.inc");
+
+$languages = get_supported_languages();
+$lang = sanitize_tags(get_str("lang", true));
+
+if (!in_array($lang, $languages) && $lang!="auto" && $lang!="en") {
+ echo "Language $lang is not supported";
+} else {
+ send_cookie('lang', $lang, true);
+ header('Location: index.php');
+}
+?>