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 c93750ae374c44450bff97b0edcae18c8e55e8b0..11f1f64d16bb88da6392391d00aaee5797e65aad 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 2887a9a44c947ddc0acf8273c6253c0fd6f68947..29cf853fe44119094c692401af5ee215917cfb48 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 8b251e8e36a0d36c342f049a458516137a07440d..8a827c63fed91de4bf8d5d03997b984622c126dd 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 1367b92ffa1782f9f429c9a75dd394e28e630001..7c185581f476aec24ff551ac29dbe428c2b02cdc 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 e13c771057fbf5d191971467464435884f4f6757..914e1e628f3caea0c90027ac1a548db204194e6b 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 21bd2399efea4c7297b61896eff54fc6c3996e8f..81ce4aad29a8cf7220a7cafc9ac8ce5dd9bf16e8 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));