Formatting Text

Besides the wording of elements, such as error messages, GUI component labels, log messages, and the like, there are many items in data that must be formatted for a specific locale. These include currency, dates, time, measurements, titles (like Mr. or Mrs.), numbers, phone numbers, and postal addresses.

Tip

Avoid long, multielement messages that require translation of several items. Because numerous languages have a distinctive word order, it can be difficult to translate these messages.

You can also check to see which locales are supported to a locale-sensitive class. You can do this with the following code:

 Locale localeList[] = DateFormat.getAvailableLocales(); for (int i = 0; i < localeList.length; i++) { System.out.println(localeList[i].toString()) ...

Get PURE Java™ 2 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.