应用实现国际化的做法

1、编写好配置文件:

文件名定义:??_zh_CN.properties或者??_en_US.properties

内容为:aaa=wbj

2.代码使用:

Locale locale = new Locale("zh", "CN"); 
ResourceBundle resb1 = ResourceBundle.getBundle("myres", locale); 
//ResourceBundle resb1 = ResourceBundle.getBundle("myres", Locale.getDefault()); 
System.out.println(resb1.getString("aaa")); 

结语:
需要国际化的文字直接写在配置文件properties中

posted @ 2016-02-24 13:20  亦真亦假,何必当真  阅读(135)  评论(0编辑  收藏  举报