fixed some bugs in url parsing, and in conf.pl
[squirrelmail.git] / functions / i18n.php
index 64c96762eee94ede491bb0641586571c9bd44fdb..889affd28fa245a24db14d3482451bb4a2b6c461 100644 (file)
@@ -1,4 +1,4 @@
-<?
+<?php
 
 /**
  ** i18n.php
@@ -6,30 +6,41 @@
  ** This file contains variuos functions that are needed to do
  ** internationalization of SquirrelMail.
  **
- ** Internally iso-8859-1 is used as character set. Other characters
- ** are encoded using Unicode entities according to HTML 4.0.
+ ** Internally the output character set is used. Other characters are
+ ** encoded using Unicode entities according to HTML 4.0.
  **
  **/
 
    $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";
-   $languages[2]["NAME"] = "Deutcsh";
-   $languages[2]["CODE"] = "de";
-   $languages[2]["NAME"] = "Russian KOI8-R";
-   $languages[2]["CODE"] = "ru";
+   $languages["en"]["NAME"]    = "English";
+   $languages["no"]["NAME"]    = "Norsk";
+   $languages["no"]["CHARSET"] = "iso-8859-1";
+   $languages["de"]["NAME"]    = "Deutsch";
+   $languages["de"]["CHARSET"] = "iso-8859-1";
+   $languages["ru"]["NAME"]    = "Russian KOI8-R";
+   $languages["ru"]["CHARSET"] = "koi8-r";
+   $languages["pl"]["NAME"]    = "Polish";
+   $languages["pl"]["CHARSET"] = "iso-8859-2";
+   $languages["sv"]["NAME"]    = "Swedish";
+   $languages["sv"]["CHARSET"] = "iso-8859-1";
+   $languages["nl"]["NAME"]    = "Dutch";
+   $languages["nl"]["CHARSET"] = "iso-8859-1";
+   $languages["pt_BR"]["NAME"] = "Portugese (Brazil)";
+   $languages["pt_BR"]["CHARSET"] = "iso-8859-1";
 
    // Decodes a string to the internal encoding from the given charset
    function charset_decode ($charset, $string) {
+      global $debug_mime;
+
       // All HTML special characters are 7 bit and can be replaced first
       $string = htmlspecialchars ($string);
 
       $charset = strtolower($charset);
 
+      if ($debug_mime) $string = $charset.":".$string;
+
       if (ereg("iso-8859-(.*)", $charset, $res)) {
          if ($res[1] == "1")
             return charset_decode_iso_8859_1 ($string);
@@ -44,7 +55,7 @@
       } else if ($charset == "koi8-r") {
         return charset_decode_koi8r ($string);
       } else
-         return "xx$charset:$string";
+         return "$string";
    }
 
    // iso-8859-1 is the same as Latin 1 and is normally used