X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fi18n.php;h=f9ba45074b85dde6624cb38fecbcd1d204e0c922;hb=b3c9b2de4190bf6a8d7a6e7437523d291442b093;hp=28bb04e430703821ee29f0a0d019d1c131cb577c;hpb=709a1a6d2b6881c1e57e542579436a8f9a909ac3;p=squirrelmail.git diff --git a/functions/i18n.php b/functions/i18n.php index 28bb04e4..f9ba4507 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -24,8 +24,15 @@ $languages['ca']['CHARSET'] = 'iso-8859-1'; $languages['ca_CA']['ALIAS'] = 'ca'; + /* PLEASE DON'T TOUCH!!! + * Correct locale name, which should be set by setlocale and/or putenv('LC_ALL='...) + * is 'cs_CZ' and NOT 'cs', this applies to all locale names, look into docs, if you + * don't believe me. Ondrej Sury, czech and slovak translator. + */ $languages['cs_CZ']['NAME'] = 'Czech'; $languages['cs_CZ']['CHARSET'] = 'iso-8859-2'; + $languages['cs']['ALIAS'] = 'cs_CZ'; + $languages['cz']['ALIAS'] = 'cs_CZ'; // set up by some ancient versions of IE $languages['da']['NAME'] = 'Danish'; $languages['da']['CHARSET'] = 'iso-8859-1'; @@ -112,7 +119,7 @@ $languages['sv_SV']['ALIAS'] = 'sv'; $languages['tr']['NAME'] = 'Turkish'; - $languages['tr']['CHARSET'] = 'iso-8859-1'; + $languages['tr']['CHARSET'] = 'iso-8859-9'; $languages['tr_TR']['ALIAS'] = 'tr'; $languages['tw']['NAME'] = 'Taiwan'; @@ -121,6 +128,18 @@ $languages['sk_SK']['NAME'] = 'Slovak'; $languages['sk_SK']['CHARSET'] = 'iso-8859-2'; + $languages['sk']['ALIAS'] = 'sk_SK'; + + $languages['ro']['NAME'] = 'Romanian'; + $languages['ro']['CHARSET'] = 'iso-8859-2'; + $languages['ro_RO']['ALIAS'] = 'ro'; + + $languages['th']['NAME'] = 'Thai'; + $languages['th']['CHARSET'] = 'tis-620'; + + $languages['lt']['NAME'] = 'Lithuanian'; + $languages['lt']['CHARSET'] = 'iso-8859-13'; + $languages['lt_LT']['ALIAS'] = 'lt'; // Decodes a string to the internal encoding from the given charset function charset_decode ($charset, $string) { @@ -307,7 +326,7 @@ // Only do the slow convert if there are 8-bit characters if (! ereg("[\200-\377]", $string)) return $string; - + // NO-BREAK SPACE $string = str_replace("\240", ' ', $string); // LATIN CAPITAL LETTER A WITH OGONEK @@ -510,11 +529,11 @@ if (strtolower($default_charset) == 'iso-8859-7') return $string; - + // Only do the slow convert if there are 8-bit characters if (!ereg("[\200-\377]", $string)) return $string; - + // Some diverse characters in the beginning $string = str_replace("\240", ' ', $string); $string = str_replace("\241", '‘', $string); @@ -550,7 +569,7 @@ // These are Unicode 900-902 while (ereg("([\270-\272])", $string, $res)) { $replace = '&#' . (ord($res[1])+720) . ";"; - $string = str_replace($res[1], $replace, $string); + $string = str_replace($res[1], $replace, $string); } // 11/11 (0xBB) Right angle quotation mark is the same as in @@ -560,7 +579,7 @@ // And now the rest of the charset while (ereg("([\274-\376])", $string, $res)) { $replace = '&#' . (ord($res[1])+720) . ';'; - $string = str_replace($res[1], $replace, $string); + $string = str_replace($res[1], $replace, $string); } return $string; @@ -635,7 +654,7 @@ if ($default_charset == 'koi8-r') return $string; - + // Convert to Unicode HTML entities. // This code is rather ineffective. $string = str_replace("\200", '─', $string); @@ -785,7 +804,7 @@ // If we can fake gettext, try that elseif ($gettext_flags == 0) { $use_gettext = true; - include('../functions/gettext.php'); + include_once('../functions/gettext.php'); } else { // Uh-ho. A weird install if (! $gettext_flags & 1) { @@ -803,12 +822,11 @@ // Set up the language to be output // if $do_search is true, then scan the browser information // for a possible language that we know - function set_up_language($sm_language, $do_search = false) - { + function set_up_language($sm_language, $do_search = false) { static $SetupAlready = 0; global $HTTP_ACCEPT_LANGUAGE, $use_gettext, $languages, $squirrelmail_language, $squirrelmail_default_language, - $sm_notAlias; + $sm_notAlias; if ($SetupAlready) return; @@ -820,22 +838,22 @@ if ($do_search && ! $sm_language && isset($HTTP_ACCEPT_LANGUAGE)) { $sm_language = substr($HTTP_ACCEPT_LANGUAGE, 0, 2); } - if (! $sm_language && isset($squirrelmail_default_language)) - $sm_language = $squirrelmail_default_language; + if (!$sm_language && isset($squirrelmail_default_language)) + $squirrelmail_language = $squirrelmail_default_language; $sm_notAlias = $sm_language; while (isset($languages[$sm_notAlias]['ALIAS'])) $sm_notAlias = $languages[$sm_notAlias]['ALIAS']; if (isset($sm_language) && $use_gettext && - $squirrelmail_language != '' && - isset($languages[$sm_notAlias]['CHARSET'])) { + $sm_language != '' && + isset($languages[$sm_notAlias]['CHARSET'])) { if ((ini_get('safe_mode') == FALSE) && (getenv('LC_ALL') != $sm_language)) { putenv('LC_ALL=' . $sm_notAlias); } setlocale('LC_ALL', $sm_notAlias); bindtextdomain('squirrelmail', '../locale/'); textdomain('squirrelmail'); - header ('Content-Type: text/html; charset=' . $languages[$sm_language]['CHARSET']); + header ('Content-Type: text/html; charset=' . $languages[$sm_notAlias]['CHARSET']); } }