Go AVDN
Lesson: Writing Internationalizable Java Code
Writing Internationalizable Java Code
Writing Message Facility enabled internalizable Java program is easy, you define the messages with a constant String variable and its comment, then use the constant string to get formatted result according to user preferred Locale.

Define Messages

Create messages by writing String constants with comment.

Reference Messages Defined Otherwhere

A message definition is shared by referencing its constant value from where needed.

Use Defined Messages

Obtain a Messager and format messages with it.

Be Locale Sensitive

Be Locale sensitive is the basic requirement for an I18n ready application. And Locales need to be received and used in proper manners.

Compiling

Thanks to JSR 269 released with JDK 6 as a standard, Annotation Processing has been seamlessly integrated into the normal Java Compilation process. Steps to compile the tutorial examples are shown in this section, you'll see no different than normal Java compilation.