From 6ef7145f17c8a0c3b277c083a34cb2f2ae50fca8 Mon Sep 17 00:00:00 2001 From: fidian Date: Thu, 17 May 2001 13:57:36 +0000 Subject: [PATCH] * Added default language option to config script * Added default language option to sample config file * Added default language (last resort) to i18n.php git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@1374 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- config/conf.pl | 21 ++++++++++++++++++++- config/config_default.php | 10 +++++++++- functions/i18n.php | 4 +++- 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/config/conf.pl b/config/conf.pl index cc066358..6e4ed0d0 100755 --- a/config/conf.pl +++ b/config/conf.pl @@ -6,7 +6,7 @@ # # $Id$ ############################################################ -$conf_pl_version = "x62"; +$conf_pl_version = "x63"; ############################################################ # Some people try to run this as a CGI. That's wrong! @@ -283,6 +283,7 @@ while (($command ne "q") && ($command ne "Q")) { print "2. Organization Logo : $WHT$org_logo$NRM\n"; print "3. Organization Title : $WHT$org_title$NRM\n"; print "4. Signout Page : $WHT$signout_page$NRM\n"; + print "5. Default Language : $WHT$squirrelmail_default_language$NRM\n"; print "\n"; print "R Return to Main Menu\n"; } elsif ($menu == 2) { @@ -452,6 +453,7 @@ while (($command ne "q") && ($command ne "Q")) { elsif ($command == 2) { $org_logo = command2 (); } elsif ($command == 3) { $org_title = command3 (); } elsif ($command == 4) { $signout_page = command4 (); } + elsif ($command == 5) { $squirrelmail_default_language = command5(); } } elsif ($menu == 2) { if ($command == 1) { $domain = command11 (); } elsif ($command == 2) { $imapServerAddress = command12 (); } @@ -568,6 +570,23 @@ sub command4 { return $new_signout_page; } +# Default language +sub command5 { + print "SquirrelMail attempts to set the language in many ways. If it\n"; + print "can not figure it out in another way, it will default to this\n"; + print "language. Please use the two-letter code for the desired language.\n"; + print "\n"; + print "[$WHT$squirrelmail_default_language$NRM]: $WHT"; + $new_signout_page = ; + if ($new_signout_page eq "\n") { + $new_signout_page = $squirrelmail_default_language; + } else { + $new_signout_page =~ s/[\r|\n]//g; + $new_signout_page =~ s/^\s+$//g; + } + return $new_signout_page; +} + #################################################################################### # domain diff --git a/config/config_default.php b/config/config_default.php index 3b31ce39..c1d4fc49 100644 --- a/config/config_default.php +++ b/config/config_default.php @@ -16,7 +16,7 @@ // don't change global $config_version; - $config_version = "x62"; + $config_version = "x63"; // Organization's logo picture (blank if none) global $org_logo; @@ -30,6 +30,13 @@ // This is the title that goes at the top of the browser window global $org_title; $org_title = "SquirrelMail $version"; + +// Default language +// This is the default language. It is used as a last resort if SquirrelMail +// can't figure out which language to display. +// Use the two-letter code. + global $squirrelmail_default_language; + $squirrelmail_default_language = 'en'; // The server that your imap server is on global $imapServerAddress, $imapPort; @@ -70,6 +77,7 @@ // cyrus // exchange // uw +// other global $imap_server_type; $imap_server_type = "cyrus"; diff --git a/functions/i18n.php b/functions/i18n.php index 0c30fa19..17c74909 100644 --- a/functions/i18n.php +++ b/functions/i18n.php @@ -770,7 +770,7 @@ { static $SetupAlready = 0; global $HTTP_ACCEPT_LANGUAGE, $use_gettext, $languages, - $squirrelmail_language; + $squirrelmail_language, $squirrelmail_default_language; if ($SetupAlready) return; @@ -782,6 +782,8 @@ 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 (isset($sm_language) && $use_gettext && $squirrelmail_language != '' && -- 2.25.1