应用实现国际化的做法

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中

原文地址:https://www.cnblogs.com/wbjgogogo/p/5212608.html