From f2374580ee6f3f70c7cd14caffec4dc65e6ff790 Mon Sep 17 00:00:00 2001 From: tokul Date: Sat, 12 Jul 2003 09:01:49 +0000 Subject: [PATCH 1/1] Bug. 765828. Rewrote patch in order to process locales correctly. If locale is processed incorrectly, it is enough to add $languages['xx_XX']['LOCALE'] variable with full locale name. Fixed only ru_RU and lt_LT. Tested on Linux Debian Woody and php 4.1.2, 4.2.3, 4.3.0, 4.3.2 git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5265 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/i18n.php | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/functions/i18n.php b/functions/i18n.php index fcd29cd8..2dc92d23 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -215,14 +215,19 @@ function set_up_language($sm_language, $do_search = false, $default = false) { if (function_exists('bind_textdomain_codeset')) { bind_textdomain_codeset ("squirrelmail", $languages[$sm_notAlias]['CHARSET'] ); } + if (isset($languages[$sm_notAlias]['LOCALE'])){ + $longlocale=$languages[$sm_notAlias]['LOCALE']; + } else { + $longlocale=$sm_notAlias; + } if ( !ini_get('safe_mode') && - getenv( 'LC_ALL' ) != $sm_notAlias ) { - putenv( "LC_ALL=$sm_notAlias" ); - putenv( "LANG=$sm_notAlias" ); - putenv( "LANGUAGE=$sm_notAlias" ); + getenv( 'LC_ALL' ) != $longlocale ) { + putenv( "LC_ALL=$longlocale" ); + putenv( "LANG=$longlocale" ); + putenv( "LANGUAGE=$longlocale" ); } - setlocale(LC_ALL, $sm_notAlias); - $squirrelmail_language = $sm_notAlias; + setlocale(LC_ALL, $longlocale); + $squirrelmail_language = $sm_notAlias; if ($squirrelmail_language == 'ja_JP' && function_exists('mb_detect_encoding') ) { header ('Content-Type: text/html; charset=EUC-JP'); if (!function_exists('mb_internal_encoding')) { @@ -378,6 +383,7 @@ $languages['pt']['ALIAS'] = 'pt_PT'; $languages['ru_RU']['NAME'] = 'Russian'; $languages['ru_RU']['CHARSET'] = 'koi8-r'; +$languages['ru_RU']['LOCALE'] = 'ru_RU.KOI8-R'; $languages['ru']['ALIAS'] = 'ru_RU'; $languages['sr_YU']['NAME'] = 'Serbian'; @@ -414,6 +420,7 @@ $languages['th']['ALIAS'] = 'th_TH'; $languages['lt_LT']['NAME'] = 'Lithuanian'; $languages['lt_LT']['CHARSET'] = 'windows-1257'; +$languages['lt_LT']['LOCALE'] = 'lt_LT.CP1257'; $languages['lt']['ALIAS'] = 'lt_LT'; $languages['sl_SI']['NAME'] = 'Slovenian'; -- 2.25.1