Skip to main content
Version: v10.15

Localization of Error Messages

App Localization is the process of rendering your app in multiple languages. WaveMaker allows you to create a dictionary of localized messages so that users can change the language of the application to experience the application in their language.

This capability can be extended to error messages returned by the server. This document explains the approach to be followed to set and display the error messages returned by the web service server as localized messages.Prerequisite

Ensure that the error message returned by the web service server meets the following criteria:

  • It is mandatory that the error message contains error object, JSON object, with the errors object, as shown in the example below.
  • messageKey is the key value that should be defined in the i18n file as shown in the steps below.
  • id, message and parameters are optional and can be sent for detailed logging of exception.

{ "errors": { "error": [ { "id": null, "messageKey": "com.wavemaker.studio.json$UnexpectedError", "message": null, "parameters": [ "org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: asdasd near line 1, column 52 [select count(*) from com.testing.hrdb.User where asdasd]" ] } ] } }

Steps

  1. The messageKey sent in the above error format needs to be added in the localization i.e., i18n dialog

    • for this open the [I18N Dialog](http://[supsystic-show-popup id=125])
    • add language using the Manage Language option, if not added already
    • add the message key and the appropriate message for the multiple languages.

  2. As can be seen in the above screenshot, the English version of the error message is “Unexpected error "${0}",please check server logs for more information” where “${0}” in the message will be replaced by the “parameters” key returned in the error message JSON. Hence, as per the above sample error response shown, the message would be displayed as: “Unexpected error "org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected AST node: asdasd near line 1, column 52 [select count(*) from com.testing.hrdb.User where asdasd]" ,please check server logs for more information

Localization Cases