Show TOC

Internationalizing the ApplicationLocate this document in the navigation structure

Prerequisites

You have created messages in the message pool of a Service or UI component.

More information: Programming User Messages

Context

Internationalization is a feature of mobile applications that display messages and other text strings in the selected language.

Language support for mobile applications uses the Java technology with resource bundles. The resource bundle contains the text strings that are displayed by the mobile application. Language for resource bundle evaluation is defined by the logon language of the mobile user according to the language (locale) settings.

The Java class PropertyResourceBundle, a class derived from the class java.util.ResourceBundle, serves to isolate the language-dependent resources (text elements) and to store the contents in language-specific properties files. You can develop mobile applications that can be easily internationalized and translated into several languages. At runtime, the relevant properties file is loaded dynamically, depending on the language ID of the current user.

Internationalization is supported for the Service and UI components of a mobile application. You can create messages in the message pool of a Service and UI component. Internationalization allows you to translate these messages into different languages.

Procedure

  1. Navigate to the Java perspective.
  2. On the Package Explorer tab page, expand the development component node.
  3. Expand the src node, and select the .xlf file.
    Note

    If you select a UI component, you have to expand the src/packages node.

  4. Copy the automatically generated .xlf file and save this under a new name in the same directory.
    1. Add the new name using the following convention:

      • <old name>_<language key>.xlf

        Enter the appropriate language key. For example, if you are creating .xlf for German, use the language key de.

  5. Select the new .xlf that you have created.
  6. In the S2X Editor , navigate to the Resource Text tab page.
  7. Select the message that you wish to translate, and choose Edit .
  8. Change the Text of the message.
  9. Choose Start of the navigation path File Next navigation step Save End of the navigation path.
  10. Build and Deploy the component.

Example

The following code snippet allows you to retrieve a particular message key and the text from the message pool. getResourceBundle() is generated in the view controller code.

            /**
         * Event handler [onActionButtonClick]
         */
        public void onActionButtonClick (Event wdEvent) {
//@@begin onActionButtonClick(ServerEvent)
//INVALIDEMPLOYEE is the message key in the message pool of the EmployeeAppComp UI Component
                String message = getResourceBundle().getString(IEmployeeAppCompMessages.MSG_KEY_INVALIDEMPLOYEE);
                WDLite.showStatusMessage(0,message;
//@@end
        }