]> git.wh0rd.org Git - tt-rss.git/commitdiff
change language in login form on the fly
authorAndrew Dolgov <fox@bah.spb.su>
Sat, 11 Aug 2007 14:42:26 +0000 (15:42 +0100)
committerAndrew Dolgov <fox@bah.spb.su>
Sat, 11 Aug 2007 14:42:26 +0000 (15:42 +0100)
functions.php
login_form.php

index 1dd0f49353e8c7fc8d9b30a3209709baf179646d..f9d91e86ef5faf0f87f6169102ed139d1dd9822b 100644 (file)
                                $lang = _TRANSLATION_OVERRIDE_DEFAULT;
                        }
 
+                       if ($_COOKIE["ttrss_lang"]) {
+                               $lang = $_COOKIE["ttrss_lang"];
+                       }
+
                        if ($lang) {
                                _setlocale(LC_MESSAGES, $lang);
                                _bindtextdomain("messages", "locale");
index 46a7b084c24ea72f3684151713aa98c1d131418e..b12c7b89e5c122bdb3ed239b7e7aa62515f54529 100644 (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>