使用native2ascii ,
native2 ascii -encoding gbk(gb2312) **.property
simple helloworld使用alt+shift+s ------>Externalize String
private static final String BUNDLE_NAME = "com.oval.research.international.messages";
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
private Messages() {
}
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
native2 ascii -encoding gbk(gb2312) **.property
Supported Encodings:
http://java.sun.com/j2se/1.3/docs/guide/intl/encoding.doc.html
eclipse使用flagement实现international eclipse plugin.simple helloworld使用alt+shift+s ------>Externalize String
private static final String BUNDLE_NAME = "com.oval.research.international.messages";
private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
.getBundle(BUNDLE_NAME);
private Messages() {
}
public static String getString(String key) {
try {
return RESOURCE_BUNDLE.getString(key);
} catch (MissingResourceException e) {
return '!' + key + '!';
}
}
本文介绍如何使用Java进行国际化设置,包括使用native2ascii工具转换属性文件编码,Eclipse中实现国际化的方法,以及如何通过ResourceBundle获取指定编码的资源文件。
852

被折叠的 条评论
为什么被折叠?



