felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fmesc...@apache.org
Subject svn commit: r905638 - /felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
Date Tue, 02 Feb 2010 14:08:05 GMT
Author: fmeschbe
Date: Tue Feb  2 14:08:04 2010
New Revision: 905638

URL: http://svn.apache.org/viewvc?rev=905638&view=rev
Log:
FELIX-2029 Properly handle the default locale both for placing it at the root of the Locale
chain and for keeping it in the resource bundle entries map. Also ensure, that entires may
not be overwritten by fragments.

Modified:
    felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java

Modified: felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
URL: http://svn.apache.org/viewvc/felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java?rev=905638&r1=905637&r2=905638&view=diff
==============================================================================
--- felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
(original)
+++ felix/trunk/webconsole/src/main/java/org/apache/felix/webconsole/internal/i18n/ResourceBundleCache.java
Tue Feb  2 14:08:04 2010
@@ -134,7 +134,17 @@
                     final int end = entryPath.length() - 11; // .properties suffix
                     entryPath = entryPath.substring( start, end );
 
-                    resourceBundleEntries.put( entryPath, entry );
+                    // the default language is "name.properties" thus the entry
+                    // path is empty and must default to "_"
+                    if (entryPath.length() == 0) {
+                        entryPath = "_";
+                    }
+
+                    // only add this entry, if the "language" is not provided
+                    // by the main bundle or an earlier bound fragment
+                    if (!resourceBundleEntries.containsKey( entryPath )) {
+                        resourceBundleEntries.put( entryPath, entry );
+                    }
                 }
             }
 
@@ -155,7 +165,7 @@
         {
             return new Locale( locale.getLanguage() );
         }
-        else if ( locale.getLanguage().equals( DEFAULT_LOCALE.getLanguage() ) )
+        else if ( !locale.getLanguage().equals( DEFAULT_LOCALE.getLanguage() ) )
         {
             return DEFAULT_LOCALE;
         }



Mime
View raw message