[jsword-svn] r1373 - trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Fri Jun 1 07:19:10 MST 2007


Author: dmsmith
Date: 2007-06-01 07:19:10 -0700 (Fri, 01 Jun 2007)
New Revision: 1373

Modified:
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
   trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Translations.java
Log:
Fixed a bug with the locale being set to English too aggressively.

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java	2007-06-01 13:47:54 UTC (rev 1372)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Desktop.java	2007-06-01 14:19:10 UTC (rev 1373)
@@ -146,37 +146,14 @@
      */
     public Desktop()
     {
-        // Allow the setting of user.language and user.country to influence the default locale
-//        String language = System.getProperty("user.language"); //$NON-NLS-1$
-//        String locale = null;
-//        if (language != null)
-//        {
-//            locale = language;
-//        }
-
-//        LATER(DMS): support country based locales
-//        String country = System.getProperty("user.country"); //$NON-NLS-1$
-//        if (country != null)
-//        {
-//            if (locale != null)
-//            {
-//                locale += '_';
-//            }
-//            locale += country;
-//        }
-
-//        if (locale != null && !"en".equals(locale)) //$NON-NLS-1$
-//        {
-//            Locale.setDefault(new Locale(locale));
-//        }
-
         // Load the configuration.
-        // This has to be done before any gui components are created.
-        // (Including the splash)
+        // This has to be done before any gui components are created
+        // (Including the splash) and before setting the locale.
         // This includes code that is invoked by it.
         generateConfig();
 
-        Locale.setDefault(Translations.getCurrentLocale());
+        // Now set the locale to the one the user chose, if any.
+        Translations.setLocale();
 
         // Make this be the root frame of optiondialogs
         JOptionPane.setRootFrame(this);

Modified: trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Translations.java
===================================================================
--- trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Translations.java	2007-06-01 13:47:54 UTC (rev 1372)
+++ trunk/bibledesktop/src/main/java/org/crosswire/bibledesktop/desktop/Translations.java	2007-06-01 14:19:10 UTC (rev 1373)
@@ -96,6 +96,24 @@
         Translations.translation = lang;
     }
 
+    /**
+     * Set the locale for the program to the one the user has selected.
+     * But don't set it to the default translation, so that the user's
+     * actual locale, is used for Bible book names.
+     * 
+     * This only makes sense after config has called setCurrentTranslation.
+     */
+    public static void setLocale()
+    {
+        if (!translation.equals(Translations.DEFAULT_TRANSLATION))
+        {
+            Locale.setDefault(Translations.getCurrentLocale());
+        }
+    }
+
+    /**
+     * Register this class with the common config engine.
+     */
     public static void register()
     {
         ChoiceFactory.getDataMap().put(TRANSLATION_KEY, getSupportedTranslations());
@@ -109,7 +127,7 @@
     /**
      * The default translation, if the user has not chosen anything else.
      */
-    private static final String DEFAULT_TRANSLATION = "en"; //$NON-NLS-1$
+    public static final String DEFAULT_TRANSLATION = "en"; //$NON-NLS-1$
 
     /**
      * The language that BibleDesktop should use.




More information about the jsword-svn mailing list