读书人

ResourceBundle加载资料的顺序

发布时间: 2012-09-19 13:43:53 作者: rapoo

ResourceBundle加载文件的顺序

If a ResourceBundle class for the specified Locale does not exist, getBundle tries to find the closest match. For example, if ButtonLabel_fr_CA_UNIX is the desired class and the default Locale is en_US, getBundle will look for classes in the following order:

ButtonLabel_fr_CA_UNIXButtonLabel_fr_CAButtonLabel_frButtonLabel_en_USButtonLabel_enButtonLabel

Note that getBundle looks for classes based on the default Locale before it selects the base class (ButtonLabel). If getBundle fails to find a match in the preceding list of classes, it throws a MissingResourceException. To avoid throwing this exception, you should always provide a base class with no suffixes.

?

http://docs.oracle.com/javase/tutorial/i18n/resbundle/concept.html

?

读书人网 >编程

热点推荐