美文网首页
ResourceBundle

ResourceBundle

作者: chaofeng | 来源:发表于2015-09-10 12:50 被阅读22次

    ResourceBundle bundle = ResourceBundle.getBundle("myApp");
    ** 默认读取根目录下myApp.properties **

    • 英文(读取myApp_en.properties)
      ResourceBundle bundle = ResourceBundle.getBundle("myApp", Locale.ENGLISH);
      String nameEng = bundle.getString("name");
    • 中文(读取myApp_ch.properties)
      ResourceBundle bundle = ResourceBundle.getBundle("myApp", Locale.CHINA);
      String nameChn = bundle.getString("name");

    相关文章

      网友评论

          本文标题:ResourceBundle

          本文链接:https://www.haomeiwen.com/subject/nrjpcttx.html