svn commit: r979204 - /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r979204 - /ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java

jleroux@apache.org
Author: jleroux
Date: Mon Jul 26 09:01:56 2010
New Revision: 979204

URL: http://svn.apache.org/viewvc?rev=979204&view=rev
Log:
A patch from Deyan Tsvetanov "Service SaveLabelsToXmlFile omits labels for new locales that did not exist prior to calling service" (https://issues.apache.org/jira/browse/OFBIZ-3869) - OFBIZ-3869

1) Use LabelManagerFactory and try to add labels for a locale that does not exist in the resource bundles - for example en_US.
2) Invoke the service SaveLabelsToXmlFile

Expected behavior: the resource bundle should contain the newly added locales
Experienced behavior: the resource bundle does not contain the labels for the newly added locales.

Modified:
    ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java

Modified: ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java?rev=979204&r1=979203&r2=979204&view=diff
==============================================================================
--- ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java (original)
+++ ofbiz/trunk/framework/webtools/src/org/ofbiz/webtools/labelmanager/SaveLabelsToXmlFile.java Mon Jul 26 09:01:56 2010
@@ -81,6 +81,11 @@ public class SaveLabelsToXmlFile {
                 Map<String, LabelInfo> labels = factory.getLabels();
                 Set<String> labelsList = factory.getLabelsList();
                 Set<String> localesFound = factory.getLocalesFound();
+                for (String localeName : localeNames) {
+                    if (!localesFound.contains(localeName)) {
+                        localesFound.add(localeName);
+                   }
+                }
                 // Remove a Label
                 if (UtilValidate.isNotEmpty(removeLabel)) {
                     labels.remove(key + LabelManagerFactory.keySeparator + fileName);