Friday, May 28, 2004

Backing a ResourceBundle with Properties Files: "ResourceBundle labels =
ResourceBundle.getBundle('LabelsBundle', currentLocale);

The getBundle method first looks for a class file that matches the base name and the Locale. If it can't find a class file, it then checks for properties files. In the PropertiesDemo program we're backing the ResourceBundle with properties files instead of class files. When the getBundle method locates the correct properties file, it returns a PropertyResourceBundle object containing the key-value pairs from the properties file.
5. Fetch the Localized Text
To retrieve the translated value from the ResourceBundle, invoke the getString method as follows:
String value = labels.getString(key);"