多语言测试

1.测试类
import java.util.Locale;
import java.util.ResourceBundle;

public class Test {
	public static void main(String[] args) {
		ResourceBundle rb = ResourceBundle.getBundle("app",Locale.CHINA);
		System.out.println(rb.getString("welcom.msg"));
	}
}


2.编写properties文件
app_en_US.properties:welcom.msg=welcom everyone!
app_zh_CN.properties:welcom.msg=欢迎每个人!

3.运行即可,如果汉语可能不支持,myeclipse8.5后可以支持
下载文件:jp.gr.java_conf.ussiy.app.propedit_5.3.3.zip解压,把features复制到eclipse安装目录eclipse/features目录下。plugins亦如此。

猜你喜欢

转载自javafu.iteye.com/blog/1983963
今日推荐