[jsword-svn] r2144 - trunk/jsword/src/main/java/org/crosswire/common/util

dmsmith at crosswire.org dmsmith at crosswire.org
Mon Apr 4 16:56:35 MST 2011


Author: dmsmith
Date: 2011-04-04 16:56:35 -0700 (Mon, 04 Apr 2011)
New Revision: 2144

Modified:
   trunk/jsword/src/main/java/org/crosswire/common/util/Languages.java
Log:
JS-179 iso639full.properties is the fallback for codes that are not found in iso639.properties

Modified: trunk/jsword/src/main/java/org/crosswire/common/util/Languages.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/common/util/Languages.java	2011-04-03 11:49:51 UTC (rev 2143)
+++ trunk/jsword/src/main/java/org/crosswire/common/util/Languages.java	2011-04-04 23:56:35 UTC (rev 2144)
@@ -55,7 +55,7 @@
             if (DEFAULT_LANG_CODE.equals(code) || UNKNOWN_LANG_CODE.equals(code)) {
                 return true;
             }
-            languages.getString(code);
+            commonLangs.getString(code);
             return true;
         } catch (MissingResourceException e) {
             return false;
@@ -76,9 +76,13 @@
     public static String getLanguageName(String iso639Code) {
         String code = getLanguageCode(iso639Code);
         try {
-            return languages.getString(code);
+            return commonLangs.getString(code);
         } catch (MissingResourceException e) {
-            return code;
+            try {
+                return allLangs.getString(code);
+            } catch (MissingResourceException e1) {
+                return code;
+            }
         }
     }
 
@@ -119,12 +123,18 @@
     public static final String DEFAULT_LANG_CODE = "en";
     private static final String UNKNOWN_LANG_CODE = "und";
 
-    private static/* final */ResourceBundle languages;
+    private static/* final */ResourceBundle commonLangs;
+    private static/* final */ResourceBundle allLangs;
     static {
         try {
-            languages = ResourceBundle.getBundle("iso639", Locale.getDefault(), CWClassLoader.instance());
+            commonLangs = ResourceBundle.getBundle("iso639", Locale.getDefault(), CWClassLoader.instance());
         } catch (MissingResourceException e) {
             assert false;
         }
+        try {
+            commonLangs = ResourceBundle.getBundle("iso639full", Locale.getDefault(), CWClassLoader.instance());
+        } catch (MissingResourceException e) {
+            assert false;
+        }
     }
 }




More information about the jsword-svn mailing list