Chapter 8. Internationalization
Internationalization is the process of making a program flexible enough to run correctly in any locale. The required corollary to internationalization is localization—the process of arranging for a program to run in a specific locale.
There are several distinct steps to the task of internationalization. Java (1.1 and later) addresses these steps with several different mechanisms:
A program must be able to read, write, and manipulate localized text. Java uses the Unicode character encoding, which by itself is a huge step toward internationalization. In addition, the
InputStreamReader
andOutputStreamWriter
classes convert text from a locale-specific encoding to Unicode and from Unicode to a locale-specific encoding, respectively.A program must conform to local customs when displaying dates and times, formatting numbers, and sorting strings. Java addresses these issues with the classes in the
java.text
package.A program must display all user-visible text in the local language. Translating the messages a program displays is always one of the main tasks in localizing a program. A more important task is writing the program so that all user-visible text is fetched at runtime, rather than hardcoded directly into the program. Java facilitates this process with the
ResourceBundle
class and its subclasses in thejava.util
package.
This chapter discusses all three aspects of internationalization.
Get Java Examples in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.