svn commit: r1787048 - in /ofbiz/branches/release16.11: ./ 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: r1787048 - in /ofbiz/branches/release16.11: ./ framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java

jleroux@apache.org
Author: jleroux
Date: Wed Mar 15 13:57:10 2017
New Revision: 1787048

URL: http://svn.apache.org/viewvc?rev=1787048&view=rev
Log:
"Applied fix from trunk framework for revision: 1787047"
------------------------------------------------------------------------
r1787047 | jleroux | 2017-03-15 14:56:38 +0100 (mer. 15 mars 2017) | 19 lignes

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/branches/release16.11/   (props changed)
    ofbiz/branches/release16.11/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java

Propchange: ofbiz/branches/release16.11/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Mar 15 13:57:10 2017
@@ -10,5 +10,5 @@
 /ofbiz/branches/json-integration-refactoring:1634077-1635900
 /ofbiz/branches/multitenant20100310:921280-927264
 /ofbiz/branches/release13.07:1547657
-/ofbiz/ofbiz-framework/trunk:1783202,1783388,1784549,1784558,1784708,1785882,1785925,1786079,1786214,1786525
+/ofbiz/ofbiz-framework/trunk:1783202,1783388,1784549,1784558,1784708,1785882,1785925,1786079,1786214,1786525,1787047
 /ofbiz/trunk:1770481,1770490,1770540,1771440,1771448,1771516,1771935,1772346,1772880,1774772,1775441,1779724,1780659,1781109,1781125,1781979,1782498,1782520

Modified: ofbiz/branches/release16.11/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release16.11/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java?rev=1787048&r1=1787047&r2=1787048&view=diff
==============================================================================
--- ofbiz/branches/release16.11/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java (original)
+++ ofbiz/branches/release16.11/framework/webtools/src/main/java/org/apache/ofbiz/webtools/labelmanager/LabelManagerFactory.java Wed Mar 15 13:57:10 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());