svn commit: r1063423 - in /ofbiz/trunk/specialpurpose: googlebase/config/ googlebase/src/org/ofbiz/googlebase/ googlecheckout/config/ googlecheckout/src/org/ofbiz/googlecheckout/

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

svn commit: r1063423 - in /ofbiz/trunk/specialpurpose: googlebase/config/ googlebase/src/org/ofbiz/googlebase/ googlecheckout/config/ googlecheckout/src/org/ofbiz/googlecheckout/

mrisaliti
Author: mrisaliti
Date: Tue Jan 25 19:43:17 2011
New Revision: 1063423

URL: http://svn.apache.org/viewvc?rev=1063423&view=rev
Log:
Internationalization of java services for googlebase/googlecheckout components (OFBIZ-4091)

Modified:
    ofbiz/trunk/specialpurpose/googlebase/config/GoogleBaseUiLabels.xml
    ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java
    ofbiz/trunk/specialpurpose/googlecheckout/config/GoogleCheckoutUiLabels.xml
    ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java

Modified: ofbiz/trunk/specialpurpose/googlebase/config/GoogleBaseUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/config/GoogleBaseUiLabels.xml?rev=1063423&r1=1063422&r2=1063423&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/config/GoogleBaseUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/googlebase/config/GoogleBaseUiLabels.xml Tue Jan 25 19:43:17 2011
@@ -122,6 +122,14 @@
         <value xml:lang="th">ใช้การไม่ได้</value>
         <value xml:lang="zh">失效</value>
     </property>
+    <property key="GoogleBaseExportErrorCreatingXmlDocument">
+        <value xml:lang="en">IO Error creating XML document for Google: </value>
+        <value xml:lang="it">Errore I/O durante la creazione del documento XML per Google: </value>
+    </property>
+    <property key="GoogleBaseExportErrorLoadingResource">
+        <value xml:lang="en">IO Error loading resource: </value>
+        <value xml:lang="it">Errore I/O caricando la risorsa: </value>
+    </property>
     <property key="GoogleBaseExportNoTrackingRequested">
         <value xml:lang="en">Not Requested</value>
         <value xml:lang="fr">Non demandé</value>
@@ -157,6 +165,10 @@
         <value xml:lang="th">การส่งออกถึงฐานข้อมูลสาธารณะ</value>
         <value xml:lang="zh">导出到Google Base</value>
     </property>
+    <property key="GoogleBaseExportUnableToReadFromProduct">
+        <value xml:lang="en">Unable to read from product entity: </value>
+        <value xml:lang="it">Non è possibile leggere dall'entità product: </value>
+    </property>
     <property key="GoogleBaseViewPermissionError">
         <value xml:lang="en">You do not have permission to view this page. ("GOOGLEBASE_VIEW" needed)</value>
         <value xml:lang="fr">Vous n'avez pas la permission de voir cette page (nécessite l'autorisation "GOOGLEBASE_VIEW" )</value>

Modified: ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java?rev=1063423&r1=1063422&r2=1063423&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java (original)
+++ ofbiz/trunk/specialpurpose/googlebase/src/org/ofbiz/googlebase/ProductsExportToGoogle.java Tue Jan 25 19:43:17 2011
@@ -93,7 +93,7 @@ public class ProductsExportToGoogle {
                 return ServiceUtil.returnFailure(ServiceUtil.getErrorMessage(result));
             }
         } catch (IOException e) {
-            return ServiceUtil.returnFailure(ServiceUtil.getErrorMessage(result) + "IO Error loading resource :" + e.getMessage());
+            return ServiceUtil.returnFailure(ServiceUtil.getErrorMessage(result) + UtilProperties.getMessage(resource, "GoogleBaseExportErrorLoadingResource", locale) + e.getMessage());
         }
         return result;
     }
@@ -506,9 +506,9 @@ public class ProductsExportToGoogle {
             //Debug.logInfo("The value of generated String is ========\n" + UtilXml.writeXmlDocument(feedDocument), module);
             dataItemsXml.append(UtilXml.writeXmlDocument(feedDocument));
         } catch (IOException e) {
-            return ServiceUtil.returnError("IO Error creating XML document for Google :" + e.getMessage());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "GoogleBaseExportErrorCreatingXmlDocument", locale) + e.getMessage());
         } catch (GenericEntityException e) {
-            return ServiceUtil.returnError("Unable to read from product entity: "  + e.toString());
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "GoogleBaseExportUnableToReadFromProduct", locale) + e.toString());
         }
 
         Map<String, Object> result = ServiceUtil.returnSuccess();

Modified: ofbiz/trunk/specialpurpose/googlecheckout/config/GoogleCheckoutUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/config/GoogleCheckoutUiLabels.xml?rev=1063423&r1=1063422&r2=1063423&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlecheckout/config/GoogleCheckoutUiLabels.xml (original)
+++ ofbiz/trunk/specialpurpose/googlecheckout/config/GoogleCheckoutUiLabels.xml Tue Jan 25 19:43:17 2011
@@ -35,10 +35,26 @@
         <value xml:lang="en">OFBiz: Google Checkout</value>
         <value xml:lang="it">OFBiz: Google Checkout</value>
     </property>
+    <property key="GoogleCheckoutConfigurationError">
+        <value xml:lang="en">Google checkout configuration error</value>
+        <value xml:lang="it">Errore di configurazione di Google checkout</value>
+    </property>
     <property key="GoogleCheckoutGoogleCheckoutConfiguration">
         <value xml:lang="en">Google Checkout Configuration</value>
         <value xml:lang="it">Configurazione di Google Checkout</value>
     </property>
+    <property key="GoogleCheckoutOrderCannotBeModified">
+        <value xml:lang="en">Google Checkout orders cannot be modified. You may cancel orders/items only!</value>
+        <value xml:lang="it">Ordini di Google Checkout non possono essere modificati. Tu puoi cancellare solo gli ordini/righe!</value>
+    </property>
+    <property key="GoogleCheckoutResponseIsNull">
+        <value xml:lang="en">Google Checkout response was null</value>
+        <value xml:lang="it">Risposta da Google Checkout è nulla</value>
+    </property>
+    <property key="GoogleCheckoutShippingConfigurationInvalid">
+        <value xml:lang="en">Invalid Google Checkout Shipping Configuration! Carriers can only be UPS, FedEx or USPS.</value>
+        <value xml:lang="it">Configurazione spedizioni di Google Checkout invalida! Spedizioniere può essere solo UPS, FedEx o USPS.</value>
+    </property>
     <property key="GoogleCheckoutShippingMethods">
         <value xml:lang="en">Shipping Methods Configuration</value>
         <value xml:lang="it">Configurazione metodi di spedizioni</value>

Modified: ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java?rev=1063423&r1=1063422&r2=1063423&view=diff
==============================================================================
--- ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java (original)
+++ ofbiz/trunk/specialpurpose/googlecheckout/src/org/ofbiz/googlecheckout/GoogleRequestServices.java Tue Jan 25 19:43:17 2011
@@ -21,6 +21,7 @@ package org.ofbiz.googlecheckout;
 
 import java.math.BigDecimal;
 import java.util.List;
+import java.util.Locale;
 import java.util.Map;
 
 import javolution.util.FastList;
@@ -61,7 +62,7 @@ import com.google.checkout.orderprocessi
 import com.google.checkout.orderprocessing.lineitem.ShipItemsRequest;
 
 public class GoogleRequestServices {
-
+    private static final String resource = "GoogleCheckoutUiLabels";
     private static final String module = GoogleRequestServices.class.getName();
     private static int decimals = UtilNumber.getBigDecimalScale("invoice.decimals");
     private static int rounding = UtilNumber.getBigDecimalRoundingMode("invoice.rounding");
@@ -70,11 +71,12 @@ public class GoogleRequestServices {
         ShoppingCart cart = (ShoppingCart) context.get("shoppingCart");
         String productStoreId = cart.getProductStoreId();
         Delegator delegator = dctx.getDelegator();
+        Locale locale = (Locale) context.get("locale");
         GenericValue googleCfg = getGoogleConfiguration(delegator, productStoreId);
         MerchantInfo mInfo = getMerchantInfo(delegator, productStoreId);
         if (mInfo == null) {
             Debug.logError("Invalid Google Chechout Merchant settings, check your configuration!", module);
-            return ServiceUtil.returnError("Google checkout configuration error");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "GoogleCheckoutConfigurationError", locale));
         }
 
         // the checkout request object
@@ -166,10 +168,9 @@ public class GoogleRequestServices {
                         shippingCompany = "USPS";
                     }
                     if (shippingCompany == null) {
-                        return ServiceUtil.returnError("Invalid Google Checkout Shipping Configuration! Carriers can only be UPS, FedEx or USPS.");
+                        return ServiceUtil.returnError(UtilProperties.getMessage(resource, "GoogleCheckoutShippingConfigurationInvalid", locale));
                     }
-                    req.addCarrierCalculatedShippingOption(amount.floatValue(), shippingCompany, CarrierPickup.REGULAR_PICKUP,
-                             shippingName, additionalAmount.floatValue(), additionalPercent.floatValue());
+                    req.addCarrierCalculatedShippingOption(amount.floatValue(), shippingCompany, CarrierPickup.REGULAR_PICKUP, shippingName, additionalAmount.floatValue(), additionalPercent.floatValue());
                 }
             }
         }
@@ -211,7 +212,7 @@ public class GoogleRequestServices {
             return ServiceUtil.returnError(e.getMessage());
         }
         if (resp == null) {
-            return ServiceUtil.returnError("Checkout response was null");
+            return ServiceUtil.returnError(UtilProperties.getMessage(resource, "GoogleCheckoutResponseIsNull", locale));
         }
         if (!resp.isValidRequest()) {
             Debug.logError("Error returned from Google: " + resp.getErrorMessage(), module);
@@ -499,11 +500,12 @@ public class GoogleRequestServices {
     // special service to tigger off of events which prevent editing orders
     public static Map<String, Object> catchEditGoogleOrder(DispatchContext dctx, Map<String, ? extends Object> context) {
         Delegator delegator = dctx.getDelegator();
+        Locale locale = (Locale) context.get("locale");
         String orderId = (String) context.get("orderId");
         GenericValue order = findGoogleOrder(delegator, orderId);
         if (order != null) {
             Debug.log("Returning FAILURE; this IS an Google Checkout order and cannot be modified as requested!", module);
-            return ServiceUtil.returnFailure("Google Checkout orders cannot be modified. You may cancel orders/items only!");
+            return ServiceUtil.returnFailure(UtilProperties.getMessage(resource, "GoogleCheckoutOrderCannotBeModified", locale));
         }
         return ServiceUtil.returnSuccess();
     }