|Internationalization? Localization? Arg!|
The WordMatch applet, written by Pat Chan, guarantees you'll be a polyglot in minutes or your money back.
This applet is, seemingly, an obvious candidate for internationalization. Let's investigate the problems we would encounter if we attempted to internationalize it.
While running the WordMatch applet and playing with it, several features jump out as candidates for localization:
Many of these items present some programming problems. Indeed, these problems are the ones that most programmers will encounter when writing a global program, or transforming an existing program into a global program.
- The words (lips, Java, television, dog, and so on).
- The corresponding sounds.
- The list of languages.
- The status messages that appear at the bottom of the window.
Problem One: Identifying the UserThe first thing the program will have to do when invoked is to identify the user's locale. This provides the program with the information necessary to choose the language in which to display text, how to format data, how to layout text, what fonts to use, and so on.
Problem Two: Locale-Sensitive DataAll of the text in the applet that is visible to the user, including the list of languages, the list of words, the GUI labels and the status messages, represent a relatively large set of data that is language dependent. Ideally, this information should be isolated from the other parts of the program that are not language dependent. Doing this compartmentalizes the program and makes it easier to translate and maintain the program.
Additionally, non-text language-dependent data, such as the audio clips in the WordMatch applet, should also be treated in this way.
Problem Three: Data FormattingAs you play the WordMatch applet, various status messages appear beneath the playing area:
The first two messages can be translated into different languages in a straightforward manner but the third message is more complex. In English, this message has 3 parts that are concatenated in this order: "There are", 2, and "correct matches". However, in other languages the number and order of the message parts may change, thereby complicating the code that generates the message. The message needs to be formatted in an internationally-sensitive way without comprising the language-independent nature of the rest of the program.
- Congratulations, they're all right!
- You have not yet matched all the words.
- There are 2 correct matches.
Displaying numbers poses a similar formatting problem. The number displayed in the "correct matches" message is a small integer number. Even this number may have a different representation in different languages. Certainly, larger numbers, decimal numbers, currency numbers, or percentages, must be formatted differently for different areas of the world.
Dates and times are another category of data type that requires internationally-sensitive formatting.
All of these, messages, numbers, and dates, should be formatted in a style consistent with the user's locale and in a way that doesn't compromise the language-independence of the actual program.
Problem Four: Sortable ListsThe list of language names on the left side of the applet should be translated into the currently selected language--the names should be in Japanese when Japanese is selected and so on. When a list such as the language list is translated from language to language, the items in the list become unsorted from one language to the next and need to be re-sorted according to the rules of the new language. Building this type of functionality into your program requires expertise in every language in the list and lots of programming time and maintenance.
Problem Five: Non-Roman AlphabetsSeveral languages in the language list use a non-Roman alphabet, Japanese, Mandarin, and Hindi for example. When one of these languages is selected, all text should appear in those alphabets.The next page of this lesson shows you how the JDK 1.1 solves these and other problems that you may encounter when writing a global Java program.
For the transformation of the WordMatch applet into a global program, see the Internationalizing an Existing Program: Step by Step lesson.
|Internationalization? Localization? Arg!|