在一个普通的project项目中资源国际化
public class I18n {
public static void main(String[] args) {
//默认读取src下以app开头的配置文件
//ResourceBundle rb = ResourceBundle.getBundle("app",Locale.US);
ResourceBundle rb = ResourceBundle.getBundle("app",Locale.CHINA);
String msg = rb.getString("welcome.msg");
System.out.println(msg);
}
}
src下的配置文件:
app_en_US.properties:
welcome.msg=welcome to beijing
app_zh_CN.properties:
welcome.msg=u5317u4EACu6B22u8FCEu4F60