WAS v8.5 > Develop applications > Develop Internationalization service > Tasks: Internationalizing interface strings (localizable-text API) > Compose language-specific strings > Generate localized text

Customize the behavior of a formatting method

Perform this task to change the runtime formatting of localized strings in an application component.

We can customize formatting behavior by passing our own formatter classes into a LocalizableTextFormatter instance through an array of optional values. This action enables you to consider variables other than locale and time zone when formatting localized text.

  1. Write our own formatter class. For more information about implementation, see "LocalizableTextFormatter class."
  2. In application code, create an instance of your formatter class as appropriate and pass it with any other optional localization values into an instance of LocalizableTextFormatter. When the LocalizableTextFormatter instance reads the instance that has been passed in, it attempts to call the format() method on the passed-in instance. The string returned is then processed with any other elements in the array.


Example

The localizable-text package provides an example of a user-defined class, called LocalizableTextDateTimeArgument. This class enables date and time information to be selectively formatted according to the style values defined in the java.text.DateFormat interface as well as the constants that are defined within the LocalizableTextDateTimeArgument class.


Related


Generate localized text


Reference:

LocalizableTextFormatter class


+

Search Tips   |   Advanced Search