From a0530a6ec0cb464ec6eaa63fd211c2ffbe6db9ad Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Sun, 08 Jun 2008 14:17:09 -0400
Subject: [PATCH] - option to disable autocompletion from selected LDAP address books (#1484922

---
 program/include/rcmail.php |   20 ++++++++++++++------
 1 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/program/include/rcmail.php b/program/include/rcmail.php
index 85f775a..0b5bcdb 100644
--- a/program/include/rcmail.php
+++ b/program/include/rcmail.php
@@ -162,9 +162,9 @@
     }
     
     $_SESSION['language'] = $this->user->language = $this->language_prop($this->config->get('language'));
-    
+
     // set localization
-    setlocale(LC_ALL, $_SESSION['language']);
+    setlocale(LC_ALL, $_SESSION['language'] . '.utf8');
   }
   
   
@@ -181,15 +181,23 @@
     if (empty($rcube_languages)) {
       @include(INSTALL_PATH . 'program/localization/index.inc');
     }
-
+    
     // check if we have an alias for that language
     if (!isset($rcube_languages[$lang]) && isset($rcube_language_aliases[$lang])) {
       $lang = $rcube_language_aliases[$lang];
     }
-
     // try the first two chars
-    if (!isset($rcube_languages[$lang]) && strlen($lang)>2) {
-      $lang = $this->language_prop(substr($lang, 0, 2));
+    else if (!isset($rcube_languages[$lang])) {
+      $short = substr($lang, 0, 2);
+     
+      // check if we have an alias for the short language code
+      if (!isset($rcube_languages[$short]) && isset($rcube_language_aliases[$short])) {
+        $lang = $rcube_language_aliases[$short];
+      }
+      // expand 'nn' to 'nn_NN'
+      else if (!isset($rcube_languages[$short])) {
+        $lang = $short.'_'.strtoupper($short);
+      }
     }
 
     if (!isset($rcube_languages[$lang]) || !is_dir(INSTALL_PATH . 'program/localization/' . $lang)) {

--
Gitblit v1.9.1