You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ad...@apache.org on 2008/09/24 07:50:43 UTC

svn commit: r698429 - /ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java

Author: adrianc
Date: Tue Sep 23 22:50:42 2008
New Revision: 698429

URL: http://svn.apache.org/viewvc?rev=698429&view=rev
Log:
Fixed quirky problem with UI labels - sometimes the fallback locale didn't work.


Modified:
    ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java

Modified: ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java?rev=698429&r1=698428&r2=698429&view=diff
==============================================================================
--- ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java (original)
+++ ofbiz/trunk/framework/base/src/org/ofbiz/base/util/UtilProperties.java Tue Sep 23 22:50:42 2008
@@ -842,14 +842,15 @@
                     while (candidateLocales.size() > 0) {
                         Locale candidateLocale = candidateLocales.removeLast();
                         // ResourceBundles are connected together as a singly-linked list
-                        String parentName = createResourceName(resource, candidateLocale, true);
-                        UtilResourceBundle lookupBundle = bundleCache.get(parentName);
+                        String lookupName = createResourceName(resource, candidateLocale, true);
+                        UtilResourceBundle lookupBundle = bundleCache.get(lookupName);
                         if (lookupBundle == null) {
                             Properties newProps = getProperties(resource, candidateLocale);
                             if (UtilValidate.isNotEmpty(newProps)) {
-                                bundle = new UtilResourceBundle(newProps, candidateLocale, parentBundle);
-                                bundleCache.put(parentName, bundle);
+                                // The last bundle we found becomes the parent of the new bundle
                                 parentBundle = bundle;
+                                bundle = new UtilResourceBundle(newProps, candidateLocale, parentBundle);
+                                bundleCache.put(lookupName, bundle);
                             }
                         } else {
                             parentBundle = bundle;