svn commit: r1787047 - /ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java

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

svn commit: r1787047 - /ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java

jleroux@apache.org
Author: jleroux
Date: Wed Mar 15 13:56:38 2017
New Revision: 1787047

URL: http://svn.apache.org/viewvc?rev=1787047&view=rev
Log:
Improved: Handle only labels with the "_" separator between languages and
countries
(OFBIZ-9261)

This is handled in LabelManagerFactory.java

    Element valueElem = (Element) valueNode;
    // Support old way of specifying xml:lang value.
    // Old way: en_AU, new way: en-AU
    String localeName = valueElem.getAttribute("xml:lang");
    if( localeName.contains("_")) {
        localeName = localeName.replace('_', '-');
    }

I replaces this snippet by throwing an exception in order to now to
automatically detect issues

Moreover I notices that there are no longer reasons to bypass the
ExampleEntityLabels and ProductPromoUiLabels files

Modified:
    ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java

Modified: ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java?rev=1787047&r1=1787046&r2=1787047&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java Wed Mar 15 13:56:38 2017
@@ -114,11 +114,6 @@ public class LabelManagerFactory {
             if (UtilValidate.isNotEmpty(fileName) && !fileName.equals(fileInfo.getFileName())) {
                 continue;
             }
-            if ("ExampleEntityLabels.xml".equals(fileInfo.getFileName())
-                    || "ProductPromoUiLabels.xml".equals(fileInfo.getFileName())
-                    ) {
-                continue;
-            }
             if (Debug.infoOn()) {
                 Debug.logInfo("Current file : " + fileInfo.getFileName(), module);
             }
@@ -157,11 +152,12 @@ public class LabelManagerFactory {
                     for (Node valueNode : UtilXml.childNodeList(propertyElem.getFirstChild())) {
                         if (valueNode instanceof Element) {
                             Element valueElem = (Element) valueNode;
-                            // Support old way of specifying xml:lang value.
+                            // No longer supporting old way of specifying xml:lang value.
                             // Old way: en_AU, new way: en-AU
                             String localeName = valueElem.getAttribute("xml:lang");
                             if( localeName.contains("_")) {
-                                localeName = localeName.replace('_', '-');
+                                GeneralException e = new GeneralException("Confusion in labels with the separator used between languages and countries. Please use a dash instead of an underscore.");
+                                throw e;  
                             }
                             String labelValue = UtilCodec.canonicalize(UtilXml.nodeValue(valueElem.getFirstChild()));
                             LabelInfo label = labels.get(labelKey + keySeparator + fileInfo.getFileName());