Title: [commits] (vajda) [15974] merged with trunk:15973
Revision
15974
Author
vajda
Date
2007-11-29 20:07:38 -0800 (Thu, 29 Nov 2007)

Log Message

merged with trunk:15973

Modified Paths

Diff

Modified: branches/64/chandler/i18n/i18nmanager.py (15973 => 15974)

--- branches/64/chandler/i18n/i18nmanager.py	2007-11-30 01:29:49 UTC (rev 15973)
+++ branches/64/chandler/i18n/i18nmanager.py	2007-11-30 04:07:38 UTC (rev 15974)
@@ -249,15 +249,26 @@
         """
         assert(self._init, True)
 
+        locale = None
+
         if wxIsAvailable():
+            # Try to get the Locale from WxPython
             locale = I18nLocale(wx.LANGUAGE_DEFAULT, i18nMan=self).GetName()
 
-        else:
+        if locale is None or len(locale.strip()) == 0:
+            # Try to ge the Locale from PyICU
             locale = Locale.getDefault().getName()
 
-        if locale is None:
-            raise I18nException("Unable to retrieve default " \
-                                "System Locale")
+        if locale is None or len(locale.strip()) == 0:
+            # Try to get the Locale from a System environmental
+            # variable
+            locale = os.getenv("LANG")
+
+        if locale is None or len(locale.strip()) == 0:
+            # Try to get the Locale from a System environmental
+            # variable
+            locale = os.getenv("LANGUAGE")
+
         return locale
 
     def setLocaleSet(self, localeSet=None, fallback=True):
@@ -332,7 +343,19 @@
         discover = localeSet is None
 
         if discover:
-            localeSet = self.discoverLocaleSet()
+            try:
+                localeSet = self.discoverLocaleSet()
+            except:
+                # Just in case an error is raised in the
+                # discovering of the localeSet, capture
+                # it here and keep the localeSet variable
+                # as None. This will result in the
+                # locale being set to "en" later in the
+                # code. In the discovery case Chandler
+                # should do everything possible to
+                # still load the application even
+                # if an error was raised.
+                pass
         else:
             assert(type(localeSet) == ListType or
                    type(localeSet) == UnicodeType or
@@ -342,10 +365,16 @@
                 localeSet = ['en_US']
                 self._testing = True
 
+        # If the localeSet is Unicode or a String
+        # then wrap the value in a list
         if type(localeSet) != ListType:
-            # If the localeSet is Unicode or a String
-            # then wrap the value in a list
-            localeSet = [localeSet]
+            if localeSet is None or len(localeSet.strip()) == 0:
+                # The locale is empty so do not include it
+                # in the localeSet list. This will default
+                # the locale to 'en' later in the code.
+                localeSet = []
+            else:
+                localeSet = [localeSet]
 
         found = False
 
@@ -459,8 +488,8 @@
             setWxLocale(stripCountryCode(primaryLocale), self)
 
         setPyICULocale(primaryLocale)
-        setPythonLocale(primaryLocale)
         setEnvironmentLocale(primaryLocale)
+        setPythonLocale()
 
     def getText(self, project, name, msgid, *args):
         """
@@ -1050,17 +1079,15 @@
 
     return langCode
 
-def setPythonLocale(lc):
+def setPythonLocale():
     """
-      Sets the Python locale object to
-      the value in lc.
-
-      @param locale: a c{str} locale
-      @type locale: ASCII c{str}
+       Set the Python locale to 'C'.
+       This ensures that the Python
+       env is portable across platforms
+       and locales.
     """
     try:
-        # Set the Python locale
-        locale.setlocale(locale.LC_ALL, lc)
+        locale.setlocale(locale.LC_ALL, 'C')
     except locale.Error:
        pass
 

Modified: branches/64/external/openjdk/README (15973 => 15974)

--- branches/64/external/openjdk/README	2007-11-30 01:29:49 UTC (rev 15973)
+++ branches/64/external/openjdk/README	2007-11-30 04:07:38 UTC (rev 15974)
@@ -31,7 +31,11 @@
 to do full builds on Ubuntu and Windows. You need to very carefully make sure
 all these requirements are met. 
 
+For more entertainment, reading
+http://today.java.net/pub/a/today/2007/11/29/building-the-jdk.html
+is highly recommended as well.
 
+
  Installing the bootstrap java JDK on Ubuntu
  -------------------------------------------
 sudo apt-get install sun-java-6-jdk




_______________________________________________
Commits mailing list
[email protected]
http://lists.osafoundation.org/mailman/listinfo/commits

Reply via email to