Free since 2005 · No login required
AT

Academic Tutorials

Learn at your own pace

site-mobile-top-banner · 320x50

Globalize your embedded apps

Added 31 Jul 2008

This article covers the two aspects of a globalization solution -- internationalization and localization -- on embedded devices. For internationalization, learn how to design your code structure to support multiple languages. For localization, learn how to customize the number, date, time, and currency format.

As the Internet's rapid growth opens up unprecedented opportunities for businesses beyond national borders, the multilingual and multiplatform releases of software products begin to play a key role in the success of any global business. However, while initial Web development was mainly based on the English language, people who speak languages other than English understandably prefer to see software interfaces in their native languages and sensitive to their cultural and national conventions. Consequently, a growing number of globalization demands will inevitably fall on e-business applications.

When it comes to globalization support on pervasive devices, developers face the challenge of how to utilize the limited support of run times and resources to meet the various globalization needs. Here, we address these challenges on the Java™ 2 Platform, Micro Edition (J2ME) platform.

Generally speaking, to develop a globalized application you need to take several steps, which we group into two categories: internationalization and localization. Internationalization means that the application design and development should be flexible enough to satisfy the requirement of multiple language and cultural differences. To make this possible, you should separate textual data from codes, and separate codes relating to cultural convention from the basic application that deals with business logic. This basic, globalized application is called a single executable. It can run in all language versions and can invoke the corresponding textual data and culture-sensitive codes that generate a user interface (UI) to meet the current user locale's requirements.

Localization refers to the generation of code that supports globalization features by translating textual data and setting culture-related configurations, such as name and address formats. You store the translation and configuration files in different directories or folders based on different locales, so that the globalized application program can invoke them at any time. You can greatly enhance the efficiency of localization if you provide all the textual data in a uniform format, such as the OASIS XML Localisation Interchange File Format (XLIFF).

In an application supporting globalization, you often have a function named Select language, which displays a different language on the user interface according to a user's selection. You can implement the support for a multilingual feature with the help of Java.util.ResourceBundle. Through a Messages class implemented using a ResourceBundle, you can easily get a multilingual text from the corresponding properties file. We will give the detailed information of the Messages class in Listing 1. There are three methods in the Messages class: setBundle(), getString(), and getLocale(). By using setBundle(String propertyFileName), the class associates ResourceBundle with a new properties file and a corresponding locale. When using getString(String key), the class returns the text related with the corresponding locale.