29.11. Chapter Summary

 
[Page 861]

Chapter 26. Internationalization

Mayan God Shel, Mexico. Photographer: Philip Coblentz. Courtesy Brand X Pictures.

Objectives

  • To describe Java's internationalization features ( §26.1).

  • To construct a locale with language, country, and variant ( §26.2).

  • To display date and time based on locale ( §26.3).

  • To display numbers , currencies, and percentages based on locale ( §26.4).

  • (Optional) To develop applications for international audiences using resource bundles ( §26.5).

  • (Optional) To specify encoding schemes for text I/O ( §26.6).


[Page 862]

26.1. Introduction

Many websites maintain several versions of Web pages so that readers can choose one written in a language they understand. Because there are so many languages in the world, it would be highly problematic to create and maintain enough different versions to meet the needs of all clients everywhere. Java comes to the rescue. Java is the first language designed from the ground up to support internationalization. In consequence, it allows your programs to be customized for any number of countries or languages without requiring cumbersome changes in the code.

Here are the major Java features that support internationalization:

  • Java characters use Unicode , a 16-bit encoding scheme established by the Unicode Consortium to support the interchange, processing, and display of written texts in the world's diverse languages. The use of Unicode encoding makes it easy to write Java programs that can manipulate strings in any international language. (To see all the Unicode characters, visit http://mindprod.com/jgloss/reuters.html.)

  • Java provides the Locale class to encapsulate information about a specific locale . A Locale object determines how locale-sensitive information, such as date, time, and number, is displayed, and how locale-sensitive operations, such as sorting strings, are performed. The classes for formatting date, time, and numbers, and for sorting strings are grouped in the java.text package.

  • Java uses the ResourceBundle class to separate locale-specific information, such as status messages and GUI component labels, from the program. The information is stored outside the source code and can be accessed and loaded dynamically at runtime from a ResourceBundle , rather than hard-coded into the program.

In this chapter, you will learn how to format dates, numbers, currencies, and percentages for different regions , countries, and languages. You will also learn how to use resource bundles to define which images and strings are used by a component, depending on the user 's locale and preferences.

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net