svn commit: r1065776 - in /ofbiz/trunk/framework/common: config/CommonUiLabels.xml src/org/ofbiz/common/CommonServices.java

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

svn commit: r1065776 - in /ofbiz/trunk/framework/common: config/CommonUiLabels.xml src/org/ofbiz/common/CommonServices.java

mrisaliti
Author: mrisaliti
Date: Mon Jan 31 20:52:14 2011
New Revision: 1065776

URL: http://svn.apache.org/viewvc?rev=1065776&view=rev
Log:
Internationalization of return messages of CommonServices.java (OFBIZ-4091)

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

Modified: ofbiz/trunk/framework/common/config/CommonUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/config/CommonUiLabels.xml?rev=1065776&r1=1065775&r2=1065776&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/config/CommonUiLabels.xml (original)
+++ ofbiz/trunk/framework/common/config/CommonUiLabels.xml Mon Jan 31 20:52:14 2011
@@ -2528,6 +2528,10 @@
         <value xml:lang="zh">下级固定资产</value>
         <value xml:lang="zh_TW">下級固定資產</value>
     </property>
+    <property key="CommonEntityTestFailure">
+        <value xml:lang="en">Unable to create test entity</value>
+        <value xml:lang="it">Non è possibile creare un test entità</value>
+    </property>
     <property key="CommonEntries">
         <value xml:lang="ar">مداخيل</value>
         <value xml:lang="de">Einträge</value>
@@ -5336,6 +5340,10 @@
         <value xml:lang="zh_CN">当前没有任务,需要你的关注。</value>
         <value xml:lang="zh_TW">現在沒有任務需要處理。</value>
     </property>
+    <property key="CommonNoteCannotBeUpdated">
+        <value xml:lang="en">Could update note data (write failure): ${errorString}</value>
+        <value xml:lang="it">Non è possibile aggiornare i dati della nota (scrittura fallita): ${errorString}</value>
+    </property>
     <property key="CommonNoUomConversionFound">
         <value xml:lang="ar">علاقة تحويل وحدات القياس غير موجودة</value>
         <value xml:lang="de">Die Beziehung der Einheit für die Konversion wurde nicht gefunden</value>
@@ -6125,6 +6133,14 @@
         <value xml:lang="zh_CN">人</value>
         <value xml:lang="zh_TW">人員</value>
     </property>
+    <property key="CommonPingDatasourceCannotConnect">
+        <value xml:lang="en">Unable to connect to datasource!</value>
+        <value xml:lang="it">Non è possibile connettersi al datasource!</value>
+    </property>
+    <property key="CommonPingDatasourceInvalidCount">
+        <value xml:lang="en">Invalid count returned from database</value>
+        <value xml:lang="it">Contantore invalido restituito dal database</value>
+    </property>
     <property key="CommonPleaseEnterValidNumberInThisField">
         <value xml:lang="en">Please enter a valid number in this field.</value>
         <value xml:lang="pt_BR">Por favor insira um número válido neste campo.</value>
@@ -7514,6 +7530,10 @@
         <value xml:lang="zh_CN">序列编号</value>
         <value xml:lang="zh_TW">序號數</value>
     </property>
+    <property key="CommonServiceReturnError">
+        <value xml:lang="en">Return Error Service : Returning Error</value>
+        <value xml:lang="it">Servizio ha restituito un'errore: errore restituito</value>
+    </property>
     <property key="CommonSet">
         <value xml:lang="ar">وضع</value>
         <value xml:lang="de">Setzen</value>
@@ -8164,6 +8184,10 @@
         <value xml:lang="zh_CN">测试</value>
         <value xml:lang="zh_TW">測試</value>
     </property>
+    <property key="CommonTestRollingBack">
+        <value xml:lang="en">Rolling back!</value>
+        <value xml:lang="it">Rolling back!</value>
+    </property>
     <property key="CommonText">
         <value xml:lang="ar">نص</value>
         <value xml:lang="de">Text</value>

Modified: ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java?rev=1065776&r1=1065775&r2=1065776&view=diff
==============================================================================
--- ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java (original)
+++ ofbiz/trunk/framework/common/src/org/ofbiz/common/CommonServices.java Mon Jan 31 20:52:14 2011
@@ -50,6 +50,7 @@ import org.ofbiz.base.util.UtilValidate;
 import static org.ofbiz.base.util.UtilGenerics.checkList;
 import static org.ofbiz.base.util.UtilGenerics.checkMap;
 import org.ofbiz.base.util.UtilMisc;
+import org.ofbiz.base.util.UtilProperties;
 import org.ofbiz.entity.Delegator;
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
@@ -69,6 +70,7 @@ import org.ofbiz.service.mail.MimeMessag
 public class CommonServices {
 
     public final static String module = CommonServices.class.getName();
+    public static final String resource = "CommonUiLabels";
 
     /**
      * Generic Test Service
@@ -135,6 +137,7 @@ public class CommonServices {
     }
 
     public static Map<String, Object> testRollbackListener(DispatchContext dctx, Map<String, ?> context) {
+        Locale locale = (Locale) context.get("locale");
         ServiceXaWrapper xar = new ServiceXaWrapper(dctx);
         xar.setRollbackService("testScv", context);
         try {
@@ -142,7 +145,7 @@ public class CommonServices {
         } catch (XAException e) {
             Debug.logError(e, module);
         }
-        return ServiceUtil.returnError("Rolling back!");
+        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonTestRollingBack", locale));
     }
 
     public static Map<String, Object> testCommitListener(DispatchContext dctx, Map<String, ?> context) {
@@ -170,6 +173,7 @@ public class CommonServices {
         String noteName = (String) context.get("noteName");
         String note = (String) context.get("note");
         String noteId = delegator.getNextSeqId("NoteData");
+        Locale locale = (Locale) context.get("locale");
         if (noteDate == null) {
             noteDate = UtilDateTime.nowTimestamp();
         }
@@ -189,7 +193,7 @@ public class CommonServices {
 
             delegator.create(newValue);
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError("Could update note data (write failure): " + e.getMessage());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonNoteCannotBeUpdated", UtilMisc.toMap("errorString", e.getMessage()), locale));
         }
         Map<String, Object> result = ServiceUtil.returnSuccess();
 
@@ -253,7 +257,8 @@ public class CommonServices {
      * Return Error Service; Used for testing error handling
      */
     public static Map<String, Object> returnErrorService(DispatchContext dctx, Map<String, ?> context) {
-        return ServiceUtil.returnError("Return Error Service : Returning Error");
+        Locale locale = (Locale) context.get("locale");
+        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonServiceReturnError", locale));
     }
 
     /**
@@ -277,6 +282,7 @@ public class CommonServices {
     /** Cause a Referential Integrity Error */
     public static Map<String, Object> entityFailTest(DispatchContext dctx, Map<String, ?> context) {
         Delegator delegator = dctx.getDelegator();
+        Locale locale = (Locale) context.get("locale");
 
         // attempt to create a DataSource entity w/ an invalid dataSourceTypeId
         GenericValue newEntity = delegator.makeValue("DataSource");
@@ -287,7 +293,7 @@ public class CommonServices {
             delegator.create(newEntity);
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
-            return ServiceUtil.returnError("Unable to create test entity");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonEntityTestFailure", locale));
         }
 
         /*
@@ -514,6 +520,7 @@ public class CommonServices {
     public static Map<String, Object> ping(DispatchContext dctx, Map<String, ?> context) {
         Delegator delegator = dctx.getDelegator();
         String message = (String) context.get("message");
+        Locale locale = (Locale) context.get("locale");
         if (message == null) {
             message = "PONG";
         }
@@ -523,7 +530,7 @@ public class CommonServices {
             count = delegator.findCountByCondition("SequenceValueItem", null, null, null);
         } catch (GenericEntityException e) {
             Debug.logError(e.getMessage(), module);
-            return ServiceUtil.returnError("Unable to connect to datasource!");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonPingDatasourceCannotConnect", locale));
         }
 
         if (count > 0) {
@@ -531,7 +538,7 @@ public class CommonServices {
             result.put("message", message);
             return result;
         } else {
-            return ServiceUtil.returnError("Invalid count returned from database");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "CommonPingDatasourceInvalidCount", locale));
         }
     }