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; |
Free forum by Nabble | Edit this page |