Jelajahi Sumber

* Added default language option to config script
* Added default language option to sample config file
* Added default language (last resort) to i18n.php

Tyler Akins 24 tahun lalu
induk
melakukan
a968c8de5f
3 mengubah file dengan 32 tambahan dan 3 penghapusan
  1. 20 1
      config/conf.pl
  2. 9 1
      config/config_default.php
  3. 3 1
      functions/i18n.php

+ 20 - 1
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 = <STDIN>;
+   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

+ 9 - 1
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";
 

+ 3 - 1
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 != '' &&