From d30d79f24098bb0e09a68467539912208434ac2f Mon Sep 17 00:00:00 2001 From: gustavf Date: Wed, 1 Mar 2000 14:42:32 +0000 Subject: [PATCH] Added setting of language and a brief Norwegian translation. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@257 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/i18n.php | 6 ++++++ functions/page_header.php | 20 ++++++++++++++++++++ src/load_prefs.php | 4 +++- src/login.php | 9 ++++++--- src/options.php | 22 ++++++++++++++++++++++ src/options_submit.php | 1 + 6 files changed, 58 insertions(+), 4 deletions(-) diff --git a/functions/i18n.php b/functions/i18n.php index c93750ae..11f1f64d 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -13,6 +13,12 @@ $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 diff --git a/functions/page_header.php b/functions/page_header.php index 2887a9a4..29cf853f 100644 --- a/functions/page_header.php +++ b/functions/page_header.php @@ -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, "."); diff --git a/src/load_prefs.php b/src/load_prefs.php index 8b251e8e..8a827c63 100644 --- a/src/load_prefs.php +++ b/src/load_prefs.php @@ -1,6 +1,8 @@ - - + +\n"; // let's check to see if they compiled with gettext support diff --git a/src/options.php b/src/options.php index e13c7710..914e1e62 100644 --- a/src/options.php +++ b/src/options.php @@ -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 "\n"; echo " "; echo " "; + // LANGUAGE + echo " "; + echo " "; + echo " "; + echo " "; echo "
\n"; @@ -95,6 +98,25 @@ echo " "; echo "
"; + echo " "; + echo _("Language:"); + echo " "; + echo " "; + + echo " "; + echo "
"; diff --git a/src/options_submit.php b/src/options_submit.php index 21bd2399..81ce4aad 100644 --- a/src/options_submit.php +++ b/src/options_submit.php @@ -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)); -- 2.25.1