[dev] Default Lang

Nuno Loureiro nuno@co.eth.pt
17 Jun 2002 20:12:22 +0100


Hello!

Right now, it seems that is not possible to force a non-english language to Horde/IMP.
And that's because of the login page. 
If the user doesn't have set accept language in his browser, he will see the login page in english.
I did a patch for Lang::select() check if the language preference is set and locked. 
If so, it uses its value. That way, if we want to force a language, we can set it in prefs and lock it.

Comments? Other solutions?

Regards,

   Nuno


Index: Lang.php
===================================================================
RCS file: /repository/horde/lib/Lang.php,v
retrieving revision 1.35
diff -u -u -r1.35 Lang.php
--- Lang.php	23 Apr 2002 09:28:10 -0000	1.35
+++ Lang.php	17 Jun 2002 18:57:18 -0000
@@ -21,13 +21,16 @@
      */
     function select()
     {
-        global $nls;
+        global $nls, $prefs;
 
-        /* First see if the user selected a language from the login screen */
         $lang = Horde::getFormData('new_lang');
-        if (!empty($lang)) {
-            $language = $lang;
 
+        /* First, check if language pref is locked and if so set it to its value */
+        if (isset($prefs) && $prefs->isLocked('language')) {
+            $language = $prefs->getValue('language');
+        /* Check if the user selected a language from the login screen */
+        } elseif (!empty($lang)) {
+            $language = $lang;
         /* Check if we have a language set in a cookie */
         } elseif (isset($_SESSION['horde_language'])) {
             $language = $_SESSION['horde_language'];


-- 
Nuno Loureiro <nuno@eth.pt>
Ethernet, Soluções Informáticas, LDA
http://www.eth.pt