Added setting of language and a brief Norwegian translation.
authorgustavf <gustavf@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 1 Mar 2000 14:42:32 +0000 (14:42 +0000)
committergustavf <gustavf@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Wed, 1 Mar 2000 14:42:32 +0000 (14:42 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@257 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/i18n.php
functions/page_header.php
src/load_prefs.php
src/login.php
src/options.php
src/options_submit.php

index c93750a..11f1f64 100644 (file)
 
    $i18n_php = true;
 
+   // This array specifies the available languages.
+   $languages[0]["NAME"] = "English";
+   $languages[0]["CODE"] = "en";
+   $languages[1]["NAME"] = "Norsk";
+   $languages[1]["CODE"] = "no";
+
    // Decodes a string to the internal encoding from the given charset
    function charset_decode ($charset, $string) {
       // All HTML special characters are 7 bit and can be replaced first
index 2887a9a..29cf853 100644 (file)
@@ -8,10 +8,30 @@
 
    $page_header_php = true;
 
+   if (!isset($prefs_php))
+      include ("../functions/prefs.php");
+
    // This is done to ensure that the character set is correct when
    // receiving input from HTTP forms
    header ("Content-Type: text/html; charset=iso-8859-1");
 
+   // Setting the language to use for gettext if it is not English
+   // (the default language) or empty.
+   if (!isset($squirrelmail_language))
+      $squirrelmail_language = getPref ($data_dir, $username, "language");
+
+   if ($squirrelmail_language != "en" && $squirrelmail_language != "") {
+      putenv("LANG=$use_language");
+      bindtextdomain("squirrelmail", "../locale/");
+      textdomain("squirrelmail");
+
+      // Setting cookie to use on the login screen the next time the
+      // same user logs in.
+      if (!isset($HTTP_COOKIE_VARS["squirrelmail_language"]))
+         setcookie("squirrelmail_language", $squirrelmail_language, 
+                   time()+2592000);
+   }
+
    function displayPageHeader($color, $mailbox) {
       /** Here is the header and wrapping table **/
       $shortBoxName = readShortMailboxName($mailbox, ".");
index 8b251e8..8a827c6 100644 (file)
@@ -1,6 +1,8 @@
 <?
    include("../config/config.php");
-   include("../functions/prefs.php");
+
+   if (!isset($prefs_php))
+      include("../functions/prefs.php");
 
    checkForPrefs($data_dir, $username);
 
index 1367b92..7c18558 100644 (file)
@@ -9,14 +9,17 @@
    setcookie("username", "", time(), "/");
    setcookie("key", "", time(), "/");
    setcookie("logged_in", 0, time(), "/");
-?>
-<HTML>
-<?
+
    if (!isset($config_php))
       include("../config/config.php");
    if (!isset($strings_php))
       include("../functions/strings.php");
+   if (!isset($page_header_php))
+      include("../functions/page_header.php");
 
+?>
+<HTML>
+<?
    echo "<BODY TEXT=000000 BGCOLOR=FFFFFF LINK=0000CC VLINK=0000CC ALINK=0000CC>\n";
  
    // let's check to see if they compiled with gettext support
index e13c771..914e1e6 100644 (file)
@@ -11,6 +11,8 @@
       include("../functions/imap.php");
    if (!isset($array_php))
       include("../functions/array.php");
+   if (!isset($i18n_php))
+      include("../functions/i18n.php");
 
    include("../src/load_prefs.php");
 
@@ -26,6 +28,7 @@
    $fullname = getPref($data_dir, $username, "full_name");
    $replyto = getPref($data_dir, $username, "reply_to");
    $email_address  = getPref($data_dir, $username, "email_address");
+   $chosen_language = getPref($data_dir, $username, "language");
 
    echo "<TABLE WIDTH=100% COLS=1 ALIGN=CENTER>\n";
    echo "   <TR><TD BGCOLOR=\"$color[0]\" ALIGN=CENTER>\n";
    echo "         </SELECT></TT>";
    echo "      </TD>";
    echo "   </TR>";
+   // LANGUAGE
+   echo "   <TR>";
+   echo "      <TD WIDTH=20% ALIGN=RIGHT>";
+   echo "         <FONT FACE=\"Arial,Helvetica\">";
+   echo           _("Language:");
+   echo "         </FONT>";
+   echo "      </TD>";
+   echo "      <TD WIDTH=80% ALIGN=LEFT>";
+
+   echo "         <TT><SELECT NAME=language>\n";
+   for ($i = 0; $i < count($languages); $i++) {
+      if ($languages[$i]["CODE"] == $chosen_language)
+         echo "         <OPTION SELECTED VALUE=\"".$languages[$i]["CODE"]."\">".$languages[$i]["NAME"]."\n";
+      else
+         echo "         <OPTION VALUE=\"".$languages[$i]["CODE"]."\">".$languages[$i]["NAME"]."\n";
+   }
+   echo "         </SELECT></TT>";
+   echo "      </TD>";
+   echo "   </TR>";
    echo "</TABLE>";
 
 
index 21bd239..81ce4aa 100644 (file)
@@ -24,6 +24,7 @@
    setPref($data_dir, $username, "editor_size", $editorsize);
    setPref($data_dir, $username, "use_signature", $usesignature);
    setPref($data_dir, $username, "left_refresh", $leftrefresh);
+   setPref($data_dir, $username, "language", $language);
 
    setSig($data_dir, $username, stripslashes($signature_edit));