Wednesday, April 29, 2015

How to handle localized resources with resource bundle

Generally, there are 2 ways to handle localized resources.
1. Append the locale name to the end of the file name. eg, logo_en_US.jpg, flag_zh_CN.png
2. Save the resources of the locale to individual resource bundle.

Solution 1 is kind of straight forward,
thus, in this post, we will be focusing on Solution 2. 

Normally, in java development, we have different resource bundle to handle localized messages, labels for different locales. 
eg,,, etc

1. define the resource key, eg. jquery.validation.path
2. define the value of the key based on different locale.

3. use the bundle key to retrieve value for the resource path.

<script src="#{msg['jquery.validation.path']}" type="text/javascript">



Related Posts Plugin for WordPress, Blogger...