Test
import java.util.Locale;
import java.util.ResourceBundle;
public class Test {
public static void main(String[] args) {
ResourceBundle bundle = ResourceBundle.getBundle("app", Locale.CHINA);
ResourceBundle bundleEn = ResourceBundle.getBundle("app", Locale.US);
System.out.println(bundle.getString("welcome")+"====="+bundleEn.getString("welcome"));
}
}
app_en_US.properties(配置文件的后两个单词,比如en_US,它的大小写和内容都是约定好的)
welcome=welcome to china \!
app_zh_CN.properties(中文用手动添加的方式,它自己会转换为字符)
welcome=\u6B22\u8FCE\u6765\u5230\u8FD9\u6837\uFF0C\u54C8\u54C8\u54C8\u54C8\u3002