Java – ResourceBundle example

The java.util.ResourceBundle is a library used for internationalization (multiple languages). It is able to return messages as per the default Locale configured for the system. Such a functionality is used when one develops systems to be used all over the world. 1. How it works? The library reads a property file based on the locale and name …

Read more

JSF 2.0 and Resource Bundles example

In this tutorial, we demonstrate the use of resource bundle to display messages in JSF 2.0. For maintainability concern, it’s always recommended to put all the messages in properties file, instead of hard-code the message in page directly. 1. Properties File Create a properties file, contains message for the page, and put it into the …

Read more

Spring Resource bundle with ResourceBundleMessageSource example

In Spring, you can use ResourceBundleMessageSource to resolve text messages from properties file, base on the selected locales. See following example : 1. Directory Structure Review directory structure of this example. 2. Properties file Create two properties files, one for English characters (messages_en_US.properties), other one for Chinese characters (messages_zh_CN.properties). Put it into the project class …

Read more