1 static text internationalization, that is, such as the page in Chinese display user name is the user name, for display is username.
Where static file naming follows: Basic Name _ language abbreviation _ country abbreviation. properties
The class you need to use is
1) Import Java.util.Locale; Localization
2) Import Java.util.ResourceBundle; Resource loading
For how to find the language abbreviation, the country abbreviation can find the language through the internate option. As shown
Examples are as follows:
Create a new two properties file to store the corresponding value for internationalization
Msg_zh_cn.properties file contents are as follows
Msg_en_us.properties file contents are as follows
The test code is as follows
" com.huitong.test.bundle.msg " ; = Resourcebundle.getbundle (baseName, Locale.china); System. out. println (bundle.getstring ("username"));
Internationalization in Java development