You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by de...@apache.org on 2016/09/03 09:05:46 UTC

svn commit: r1759061 - in /ofbiz/trunk/framework/common: config/CommonUiLabels.xml src/main/java/org/apache/ofbiz/common/CommonServices.java src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java

Author: deepak
Date: Sat Sep  3 09:05:46 2016
New Revision: 1759061

URL: http://svn.apache.org/viewvc?rev=1759061&view=rev
Log:
(OFBIZ-7980) Applied slightly modified patch from jira issue
=====================================
Add UI labels for success / error messages in common component
=====================================
Thanks Tanmay for your contribution.

Modified:
    ofbiz/trunk/framework/common/config/CommonUiLabels.xml
    ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
    ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java

Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=1759061&r1=1759060&r2=1759061&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Sat Sep  3 09:05:46 2016
@@ -3815,6 +3815,9 @@
         <value xml:lang="zh-CN">事件日期</value>
         <value xml:lang="zh-TW">事件日期</value>
     </property>
+        <property key="CommonExceptionThrownWhileDecodingMetric">
+        <value xml:lang="en">Exception thrown while decoding metric name ${originalName}</value>
+    </property>
     <property key="CommonExclude">
         <value xml:lang="ar">إستثناء</value>
         <value xml:lang="cs">Vyjmout</value>
@@ -6680,6 +6683,9 @@
         <value xml:lang="zh-CN">方法</value>
         <value xml:lang="zh-TW">方法</value>
     </property>
+    <property key="CommonMetricNotFound">
+        <value xml:lang="en">Metric ${name} not found</value>
+    </property>
     <property key="CommonMilliSecond">
         <value xml:lang="ar">واحد بالألف من الثانية</value>
         <value xml:lang="cs">Milisekunda</value>
@@ -8234,6 +8240,9 @@
         <value xml:lang="zh">其它</value>
         <value xml:lang="zh-TW">其他</value>
     </property>
+    <property key="CommonOutputFileCouldNotBeCreated">
+        <value xml:lang="en">The Outputfile could not be created: ${errorString}</value>
+    </property>
     <property key="CommonOverridesSelection">
         <value xml:lang="ar">تفنيد  أحد الإختيارين في الأعلى</value>
         <value xml:lang="cs">(přepíše některou z předchozích voleb)</value>
@@ -15510,5 +15519,4 @@
         <value xml:lang="zh-CN">中文</value>
         <value xml:lang="zh-TW">中文</value>
     </property>
-
 </resource>

Modified: ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java?rev=1759061&r1=1759060&r2=1759061&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java (original)
+++ ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/CommonServices.java Sat Sep  3 09:05:46 2016
@@ -547,15 +547,16 @@ public class CommonServices {
 
     public static Map<String, Object> resetMetric(DispatchContext dctx, Map<String, ?> context) {
         String originalName = (String) context.get("name");
+        Locale locale = (Locale)context.get("locale");
         String name = UtilCodec.getDecoder("url").decode(originalName);
         if (name == null) {
-            return ServiceUtil.returnError("Exception thrown while decoding metric name \"" + originalName + "\"");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonExceptionThrownWhileDecodingMetric", UtilMisc.toMap("originalName", originalName), locale));
         }
         Metrics metric = MetricsFactory.getMetric(name);
         if (metric != null) {
             metric.reset();
             return ServiceUtil.returnSuccess();
         }
-        return ServiceUtil.returnError("Metric \"" + name + "\" not found.");
+        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonMetricNotFound", UtilMisc.toMap("name", name), locale));
     }
 }

Modified: ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java?rev=1759061&r1=1759060&r2=1759061&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java (original)
+++ ofbiz/trunk/framework/common/src/main/java/org/apache/ofbiz/common/JsLanguageFileMappingCreator.java Sat Sep  3 09:05:46 2016
@@ -32,6 +32,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.ofbiz.base.util.Debug;
 import org.apache.ofbiz.base.util.FileUtil;
 import org.apache.ofbiz.base.util.UtilMisc;
+import org.apache.ofbiz.base.util.UtilProperties;
 import org.apache.ofbiz.base.util.template.FreeMarkerWorker;
 import org.apache.ofbiz.service.DispatchContext;
 import org.apache.ofbiz.service.ServiceUtil;
@@ -197,7 +198,7 @@ public class JsLanguageFileMappingCreato
         }
         catch (Exception e) {
             Debug.logError(e, module);
-            return ServiceUtil.returnError("The Outputfile could not be created: " + e.getMessage());
+            return ServiceUtil.returnError(UtilProperties.getMessage("CommonUiLabels", "CommonOutputFileCouldNotBeCreated", UtilMisc.toMap("errorString", e.getMessage()), (Locale)context.get("locale")));
         }
 
         return result;