change language in login form on the fly

This commit is contained in:
Andrew Dolgov 2007-08-11 15:42:26 +01:00
parent f8c612d483
commit 68659d9896
2 changed files with 12 additions and 2 deletions

View File

@ -30,6 +30,10 @@
$lang = _TRANSLATION_OVERRIDE_DEFAULT;
}
if ($_COOKIE["ttrss_lang"]) {
$lang = $_COOKIE["ttrss_lang"];
}
if ($lang) {
_setlocale(LC_MESSAGES, $lang);
_bindtextdomain("messages", "locale");

View File

@ -7,6 +7,7 @@
<script type="text/javascript" src="pngfix.js"></script>
<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script type="text/javascript" src="functions.js"></script>
</head>
<body>
@ -22,6 +23,11 @@ function init() {
login.focus();
}
function languageChange(elem) {
var lang = elem[elem.selectedIndex].value;
setCookie("ttrss_lang", lang);
window.location.reload();
}
</script>
<script type="text/javascript">
@ -53,8 +59,8 @@ window.onload = init;
<tr><td align="right"><?php echo __("Language:") ?></td>
<td align="right">
<?php
print_select_hash("language", "", get_translations(),
"style='width : 100%'");
print_select_hash("language", $_COOKIE["ttrss_lang"], get_translations(),
"style='width : 100%' onchange='languageChange(this)'");
?>
</td></tr>