在一个普通的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=\u5317\u4EAC\u6B22\u8FCE\u4F60