svn commit: r1055172 - in /ofbiz/trunk/applications/marketing: config/MarketingUiLabels.xml src/org/ofbiz/sfa/vcard/VCard.java

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

svn commit: r1055172 - in /ofbiz/trunk/applications/marketing: config/MarketingUiLabels.xml src/org/ofbiz/sfa/vcard/VCard.java

mrisaliti
Author: mrisaliti
Date: Tue Jan  4 20:29:26 2011
New Revision: 1055172

URL: http://svn.apache.org/viewvc?rev=1055172&view=rev
Log:
Internazionalization of ServiceUtil.returnSuccess, ServiceUtil.returnFailure, ServiceUtil.returnError (OFBIZ-4091)

Modified:
    ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml
    ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java

Modified: ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml?rev=1055172&r1=1055171&r2=1055172&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml (original)
+++ ofbiz/trunk/applications/marketing/config/MarketingUiLabels.xml Tue Jan  4 20:29:26 2011
@@ -2413,6 +2413,18 @@
         <value xml:lang="zh">事件</value>
         <value xml:lang="zh_TW">事件</value>
     </property>
+    <property key="SfaExportVCardError">
+        <value xml:lang="en">Error during export data from VCard: ${errorString}</value>
+        <value xml:lang="it">Errore durante l'esportazione dei dati da VCard: ${errorString}</value>
+    </property>
+    <property key="SfaExportVCardErrorOpeningFile">
+        <value xml:lang="en">Error during export data from VCard, unable to open file for writing: ${errorString}</value>
+        <value xml:lang="it">Errore durante l'esportazione dei dati da VCard, non è possibile aprire il file in scrittura: ${errorString}</value>
+    </property>
+    <property key="SfaExportVCardErrorWritingFile">
+        <value xml:lang="en">Error during export data from VCard, unable to write data to: ${errorString}</value>
+        <value xml:lang="it">Errore durante l'esportazione dei dati da VCard, non è possibile scrivere i dati in: ${errorString}</value>
+    </property>
     <property key="SfaFindAccountLeads">
         <value xml:lang="en">Find Account Leads</value>
         <value xml:lang="pt_BR">Buscar contas de Leads</value>
@@ -2494,6 +2506,10 @@
         <value xml:lang="zh">导入线索</value>
         <value xml:lang="zh_TW">導入線索</value>
     </property>
+    <property key="SfaImportVCardError">
+        <value xml:lang="en">Error during import data from VCard: ${errorString}</value>
+        <value xml:lang="it">Errore durante l'importazione dei dati da VCard: ${errorString}</value>
+    </property>
     <property key="SfaInitialAccount">
         <value xml:lang="en">Initial Account</value>
         <value xml:lang="fr">Compte initial</value>

Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java?rev=1055172&r1=1055171&r2=1055172&view=diff
==============================================================================
--- ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java (original)
+++ ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java Tue Jan  4 20:29:26 2011
@@ -28,6 +28,7 @@ import java.io.InputStream;
 import java.nio.ByteBuffer;
 import java.util.Iterator;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import javolution.util.FastMap;
@@ -70,10 +71,12 @@ import org.ofbiz.service.ServiceUtil;
 
 public class VCard {
     public static final String module = VCard.class.getName();
+ public static final String resourceError = "MarketingUiLabels";
 
     public static Map<String, Object> importVCard(DispatchContext dctx, Map<String, ? extends Object> context) {
         LocalDispatcher dispatcher = dctx.getDispatcher();
         Delegator delegator = dctx.getDelegator();
+ Locale locale = (Locale) context.get("locale");
         Map<String, Object> result = ServiceUtil.returnSuccess();
         Address workAddress = null;
         String email = null;
@@ -204,10 +207,12 @@ public class VCard {
             }
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
-            return ServiceUtil.returnError(e.getMessage());
+ return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                    "SfaImportVCardError", UtilMisc.toMap("errorString", e.getMessage()), locale));
         } catch (GenericServiceException e) {
             Debug.logError(e, module);
-            return ServiceUtil.returnError(e.getMessage());
+ return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                    "SfaImportVCardError", UtilMisc.toMap("errorString", e.getMessage()), locale));
         }
         return result;
     }
@@ -215,6 +220,7 @@ public class VCard {
     public static Map<String, Object> exportVCard(DispatchContext dctx, Map<String, ? extends Object> context) {
         Delegator delegator = dctx.getDelegator();
         String partyId = (String) context.get("partyId");
+ Locale locale = (Locale) context.get("locale");
         File file = null;
         try {
             ContactModelFactory cmf = Pim.getContactModelFactory();
@@ -274,12 +280,15 @@ public class VCard {
             outputStream.close();
         } catch (FileNotFoundException e) {
             Debug.logError(e, module);
-            return ServiceUtil.returnError("Unable to open file for writing: " + file.getAbsolutePath());
+ return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                    "SfaExportVCardErrorOpeningFile", UtilMisc.toMap("errorString", file.getAbsolutePath()), locale));
         } catch (IOException e) {
             Debug.logError(e, module);
-            return ServiceUtil.returnError("Unable to write data to: " + file.getAbsolutePath());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                    "SfaExportVCardErrorWritingFile", UtilMisc.toMap("errorString", file.getAbsolutePath()), locale));
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError(e.getMessage());
+ return ServiceUtil.returnError(UtilProperties.getMessage(resourceError,
+                    "SfaExportVCardError", UtilMisc.toMap("errorString", e.getMessage()), locale));
         }
         return ServiceUtil.returnSuccess();
     }