From fe48c80808083e3d0901a89f451eefd549fae2a4 Mon Sep 17 00:00:00 2001 From: tokul Date: Tue, 31 Aug 2004 17:27:10 +0000 Subject: [PATCH] removed language codes from conf.pl. List is too big. $default_charset can be used to change charset of English translation. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@7993 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- ChangeLog | 2 ++ config/conf.pl | 24 +++++------------------- config/config_default.php | 12 +++++------- functions/i18n.php | 10 ++++++---- 4 files changed, 18 insertions(+), 30 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9dcfe87e..d02a34ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -93,6 +93,8 @@ Version 1.5.1 -- CVS - $agresive_decoding configuration option changed to $aggressive_decoding. Fixed spelling. - Added $loosy_encoding option (provides fix for #806698) + - Reenabled use of $default_charset option. Option works only with en_US + translation in order to prevent language/charset misconfiguration. Version 1.5.0 -------------------- diff --git a/config/conf.pl b/config/conf.pl index 64a48fd6..5fb802bc 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -2784,13 +2784,10 @@ sub commandA1 { } # Default Charset sub commandA2 { -# print "This option controls what character set is used when sending\n"; -# print "mail and when sending HTML to the browser. Do not set this\n"; -# print "to US-ASCII, use ISO-8859-1 instead. For cyrillic, it is best\n"; -# print "to use KOI8-R, since this implementation is faster than most\n"; -# print "of the alternatives\n"; - print "This option is obsolate. Default charset depends on language\n"; - print "you have selected in \"Default language\" option.\n"; + print "This option controls what character set is used when sending\n"; + print "mail and when sending HTML to the browser. Option works only\n"; + print "with US English (en_US) translation. Other translations use\n"; + print "charsets that are set in functions/i18n.php.\n"; print "\n"; print "[$WHT$default_charset$NRM]: $WHT"; @@ -2834,18 +2831,7 @@ sub commandA4 { print "listed. If you enter special key \'none\' - user won't be able to change"; print "language and interface will use language set it \"Default language\" option.\n"; print "\n"; - print "Valid language names are:\n"; - print " ar (Arabic), bg_BG (Bulgarian), ca_ES (Catalan), cy_GB (Welsh)\n"; - print " cs_CZ (Chech), da_DK (Danish), de_DE (German), el_GR (Greek),\n"; - print " en_US (English), es_ES (Spanish), et_EE (Estonian), fi_FI (Finnish),\n"; - print " fo_FO (Faroese), fr_FR (French), he_IL (Hebrew), hr_HR (Croatian),\n"; - print " hu_HU (Hungarian), id_ID (Indonesian), is_IS (Icelandic), it_IT (Italian),\n"; - print " ja_JP (Japanese), ko_KR (Korean), lt_LT (Lithuanian), ms_MY (Malay),\n"; - print " nl_NL (Dutch), nn_NO (Norwegian (Nynorsk)), no_NO (Norwegian (Bokmal)),\n"; - print " pl_PL (Polish), pt_BR (Portuguese (Brazil)), pt_PT (Portuguese (Portugal)),\n"; - print " ro_RO (Romanian), ru_RU (Russian), sk_SK (Slovak), sl_SI (Slovenian),\n"; - print " sr_YU (Serbian), sv_SE (Swedish), th_TH (Thai), tr_TR (Turkish),\n"; - print " zh_CN (Chinese Simplified), zh_TW (Chinese Traditional).\n"; + print "You can find valid language names in doc/i18n.txt.\n"; print "\n"; print "[$WHT$available_languages$NRM]: $WHT"; $new_available_languages = ; diff --git a/config/config_default.php b/config/config_default.php index b93b36c6..cb69b50e 100644 --- a/config/config_default.php +++ b/config/config_default.php @@ -803,13 +803,11 @@ $squirrelmail_default_language = 'en_US'; /** * Default Charset * - * This option controls what character set is used when sending mail - * and when sending HTML to the browser. Do not set this to US-ASCII, - * use ISO-8859-1 instead. - * - * You can set this option, only if $squirrelmail_default_language setting - * contains 'en_US' string. In any other case system does not allow - * making mistakes with incorrect language and charset combinations. + * This option controls what character set is used when sending + * mail and when sending HTML to the browser. Option works only + * with US English (en_US) translation. Other translations use + * charsets that are set in functions/i18n.php. + * * @global string $default_charset */ $default_charset = 'iso-8859-1'; diff --git a/functions/i18n.php b/functions/i18n.php index fd850229..5d5d818e 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -196,7 +196,7 @@ function set_up_language($sm_language, $do_search = false, $default = false) { static $SetupAlready = 0; global $use_gettext, $languages, - $squirrelmail_language, $squirrelmail_default_language, + $squirrelmail_language, $squirrelmail_default_language, $default_charset, $sm_notAlias, $username, $data_dir; if ($SetupAlready) { @@ -296,10 +296,12 @@ function set_up_language($sm_language, $do_search = false, $default = false) { } mb_internal_encoding('EUC-JP'); mb_http_output('pass'); + } elseif ($squirrelmail_language == 'en_US') { + header( 'Content-Type: text/html; charset=' . $default_charset ); } else { - header( 'Content-Type: text/html; charset=' . $languages[$sm_notAlias]['CHARSET'] ); + header( 'Content-Type: text/html; charset=' . $languages[$sm_notAlias]['CHARSET'] ); + } } -} return 0; } @@ -333,7 +335,7 @@ function set_my_charset(){ $my_language = $languages[$my_language]['ALIAS']; } $my_charset = $languages[$my_language]['CHARSET']; - if ($my_charset) { + if ($my_language!='en_US') { $default_charset = $my_charset; } } -- 2.25.1