How java localizer works with Resource Bundles - Java Localization

Describe how java localizer works with Resource Bundles.

Localizer is the most popular way for localizing a Java application. The localizable information is persisted in “ .properties “ files. The localizer ‘Lingobit’ translates the required files into another language. For instance, the file MyResources.properties would be translated into the following files:

- MyResources_DE.properties for German,
- MyResources_FR.properties for French
- MyResources_ES.properties for Spanish.

The resource bundle file MyResources.properties will have the following statements:

#MyResources.properties file – a comment in properties file starts with #
OkKey=Ok
CancelKey=Cancel

The code for loading the string for a specific code is as follows:
ResourceBundle myResources = ResourceBundle.getBundle("MyResources", currentLocale);
button1 = new Button(myResources.getString("OkKey"));
button2 = new Button(myResources.getString("CancelKey"));
How to extract strings to Resource Bundle files - Java Localization
Strings can extract to a Resource Bundle file by using the method getString()...
How to load a resource bundle from a file resource? - Java Localization
A property resource bundle can be loaded by using FileInputStream object, sent as a parameter t the PropertyResourceBundle constructor...
Explain how Java application use multiple locales - Java Localization
Multiple locales can actually be active by a Java application at the same time. A U.S. date format can be used and a German number format within a single / same application...
Post your comment