|
Author: mrisaliti
Date: Wed Feb 9 22:00:40 2011 New Revision: 1069136 URL: http://svn.apache.org/viewvc?rev=1069136&view=rev Log: Internationalization of return messages of java services of content component (OFBIZ-4091) Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java Modified: ofbiz/trunk/applications/content/config/ContentUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/config/ContentUiLabels.xml?rev=1069136&r1=1069135&r2=1069136&view=diff ============================================================================== --- ofbiz/trunk/applications/content/config/ContentUiLabels.xml (original) +++ ofbiz/trunk/applications/content/config/ContentUiLabels.xml Wed Feb 9 22:00:40 2011 @@ -831,6 +831,10 @@ <value xml:lang="zh">å¾å</value> <value xml:lang="zh_TW">åå</value> </property> + <property key="ContentDataResourceIsNull"> + <value xml:lang="en">dataResourceId is null.</value> + <value xml:lang="it">dataResourceId è nullo.</value> + </property> <property key="ContentDataResourceNotFound"> <value xml:lang="en">No data resource found for ID: ${parameters.dataResourceId}</value> <value xml:lang="it">Nessuna risorsa dati trovata con ID: ${parameters.dataResourceId}</value> @@ -1498,6 +1502,10 @@ <value xml:lang="zh">PDFå 容æ è¯</value> <value xml:lang="zh_TW">PDFå §å®¹ID</value> </property> + <property key="ContentPDFGeneratingError"> + <value xml:lang="en">Error generating PDF: ${errorString}</value> + <value xml:lang="it">Errore di generazione PDF: ${errorString}</value> + </property> <property key="ContentPDFFile"> <value xml:lang="da">PDF fil</value> <value xml:lang="en">PDF File</value> Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java?rev=1069136&r1=1069135&r2=1069136&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/data/DataServices.java Wed Feb 9 22:00:40 2011 @@ -358,9 +358,8 @@ public class DataServices { String contentId = (String) context.get("contentId"); result.put("contentId", contentId); if (UtilValidate.isEmpty(dataResourceId)) { - String errMsg = "dataResourceId is null."; - Debug.logError(errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError("dataResourceId is null.", module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentDataResourceIsNull", locale)); } String textData = (String) context.get("textData"); if (Debug.verboseOn()) { Modified: ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java?rev=1069136&r1=1069135&r2=1069136&view=diff ============================================================================== --- ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java (original) +++ ofbiz/trunk/applications/content/src/org/ofbiz/content/survey/PdfSurveyServices.java Wed Feb 9 22:00:40 2011 @@ -40,6 +40,7 @@ import org.ofbiz.base.util.GeneralExcept import org.ofbiz.base.util.UtilDateTime; import org.ofbiz.base.util.UtilGenerics; import org.ofbiz.base.util.UtilMisc; +import org.ofbiz.base.util.UtilProperties; import org.ofbiz.base.util.UtilValidate; import org.ofbiz.content.data.DataResourceWorker; import org.ofbiz.entity.Delegator; @@ -72,6 +73,7 @@ import com.lowagie.text.pdf.PdfWriter; public class PdfSurveyServices { public static final String module = PdfSurveyServices.class.getName(); + public static final String resource = "ContentUiLabels"; /** * @@ -80,6 +82,7 @@ public class PdfSurveyServices { Delegator delegator = dctx.getDelegator(); LocalDispatcher dispatcher = dctx.getDispatcher(); GenericValue userLogin = (GenericValue) context.get("userLogin"); + Locale locale = (Locale) context.get("locale"); Timestamp nowTimestamp = UtilDateTime.nowTimestamp(); String surveyId = null; try { @@ -221,16 +224,14 @@ public class PdfSurveyServices { survey.store(); } } catch (GenericEntityException e) { - String errMsg = "Error generating PDF: " + e.toString(); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Error generating PDF: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); } catch (GeneralException e) { - System.err.println(e.getMessage()); - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e, "Error generating PDF: " + e.getMessage(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.getMessage()), locale)); } catch (Exception e) { - String errMsg = "Error generating PDF: " + e.toString(); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Error generating PDF: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); } Map<String, Object> results = ServiceUtil.returnSuccess(); @@ -243,6 +244,7 @@ public class PdfSurveyServices { */ public static Map<String, Object> buildSurveyResponseFromPdf(DispatchContext dctx, Map<String, ? extends Object> context) { String surveyResponseId = null; + Locale locale = (Locale) context.get("locale"); try { Delegator delegator = dctx.getDelegator(); String partyId = (String)context.get("partyId"); @@ -293,16 +295,14 @@ public class PdfSurveyServices { } s.close(); } catch (GenericEntityException e) { - String errMsg = "Error generating PDF: " + e.toString(); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Error generating PDF: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); } catch (GeneralException e) { - System.err.println(e.getMessage()); - return ServiceUtil.returnError(e.getMessage()); + Debug.logError(e, "Error generating PDF: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.getMessage()), locale)); } catch (Exception e) { - String errMsg = "Error generating PDF: " + e.toString(); - Debug.logError(e, errMsg, module); - return ServiceUtil.returnError(errMsg); + Debug.logError(e, "Error generating PDF: " + e.toString(), module); + return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ContentPDFGeneratingError", UtilMisc.toMap("errorString", e.toString()), locale)); } Map<String, Object> results = ServiceUtil.returnSuccess(); @@ -587,9 +587,7 @@ public class PdfSurveyServices { ctx.put("contentId", acroFormContentId); Map<String, Object> map = dispatcher.runSync("setAcroFields", ctx); if (ServiceUtil.isError(map)) { - String errMsg = ServiceUtil.makeErrorMessage(map, null, null, null, null); - System.err.println(errMsg); - return ServiceUtil.returnError(errMsg); + return ServiceUtil.returnError(ServiceUtil.makeErrorMessage(map, null, null, null, null)); } String pdfFileNameOut = (String) context.get("pdfFileNameOut"); ByteBuffer outByteBuffer = (ByteBuffer) map.get("outByteBuffer"); |
| Free forum by Nabble | Edit this page |
