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 Spring Resource bundle with ResourceBundleMessageSource example

Here is a simple ResourceBundle message files hello = "Hi \n \n Good Morning \n \n thanks" If we retrieve the resource bundle key “hello”, we expected the result as following Hi Good Morning thanks Unfortunately, Java doesn’t work in this way, “String” will not translate the \n into new line by default. If we […]

Read more How to insert a new line in resource bundle messages – java