Home

This Chapter
-Chapter 19: Internationalization
-Locales
-Internationalizing Applications
-An Internationalized Swing Application
-Summary
-Questions

Table of Contents
-Introduction
-Chapter 1: Your First Taste of Java
-Chapter 2: Language Fundamentals
-Chapter 3: Statements
-Chapter 4: Objects and Classes
-Chapter 5: Core Classes
-Chapter 6: Inheritance
-Chapter 7: Error Handling
-Chapter 8: Numbers and Dates
-Chapter 9: Interfaces and Abstract Classes
-Chapter 10: Enums
-Chapter 11: The Collections Framework
-Chapter 12: Generics
-Chapter 13: Input Output
-Chapter 14: Nested and Inner Classes
-Chapter 15: Swing Basics
-Chapter 16: Swinging Higher
-Chapter 17: Polymorphism
-Chapter 18: Annotations
-Chapter 19: Internationalization
-Chapter 20: Applets
-Chapter 21: Java Networking
-Chapter 22: Java Database Connectivity
-Chapter 23: Java Threads
-Chapter 24: Security
-Chapter 25: Java Web Applications
-Chapter 26: JavaServer Pages
-Chapter 27: Javadoc
-Chapter 28: Application Deployment
-Appendix A: javac
-Appendix B: java
-Appendix C: jar
-Appendix D: NetBeans
-Appendix E: Eclipse

Previous
Next

 

Chapter 19

Internationalization

In this era of globalization, it is now more compelling than before that you are able to write applications that can be deployed in different countries and regions that speak different languages. There are two terms you need to be familiar with in this regard. The first is internationalization, often abbreviated to i18n because the word starts with an i and ends with and n, and there are 18 characters between the first i and the last n. Internationalization is the technique for developing applications that support multiple languages and data formats without rewriting the programming logic. The second term in localization, which is the technique of adapting an internationalized application to support a specific locale. A locale is a specific geographical, political, or cultural region. An operation that takes a locale into consideration is said to be locale-sensitive. For example, displaying a date is locale-sensitive because the date must be in the format used by the country or region of the user. The fifteenth day of November 2006 is written 11/15/2006 in the US, but written as 15/11/2006 in Australia. For the same reason internationalization is abbreviated i18n, localization is abbreviated to l10n.

Java was designed with internationalization in mind, employing Unicode for characters and strings. Making international applications in Java is therefore very easy. How you internationalize your applications depends on how much static data needs to be presented in different languages. There are two approaches.

  1. If a large amount of data is static, create a separate version of the resource for each locale. This approach normally applies to Web application with lots of static HTML pages. It is straightforward and will not be discussed in this chapter.
  2. If the amount of static data that needs to be internationalized is limited, isolate textual elements such as component labels and error messages into text files. Each text file stores the translations of all textual elements for a locale. The application then retrieves each element dynamically. The advantage is clear. Each textual element can be edited easily without recompiling the application. This is the technique that will discussed in this chapter.

This chapter starts by explaining what a locale. Next comes the technique for internationalizing your applications, followed by a Swing application example.

Previous
Next