永中首页 | 产品聚焦 | 销售渠道 | 服务支持 | 教育专栏 | 二次开发 | 在线订购 | 产品注册 | 免费下载 | 新闻中心 | 关于永中
发新话题
打印

【转载】Internationalization

【转载】Internationalization

Before Internationalization
Suppose that you've written a program that displays three messages, as follows:
public class NotI18N {
    static public void main(String[] args) {
        System.out.println("Hello.");
        System.out.println("How are you?");
        System.out.println("Goodbye.");
    }
}
You've decided that this program needs to display these same messages for people living in France and Germany. Unfortunately your programming staff is not multilingual, so you'll need help translating the messages into French and German. Since the translators aren't programmers, you'll have to move the messages out of the source code and into text files that the translators can edit. Also, the program must be flexible enough so that it can display the messages in other languages, but right now no one knows what those languages will be.
It looks like the program needs to be internationalized.

TOP

【转载】Internationalization

做一张属性表,关键子为hello,等等。ResourceBundle bundel=ResourceBundle.getBundle("package.propertyFileName",Locale.getDefault());
System.out.println(""+bundel.getString("key"));
key为属性表关键字!
为人民服务!!!!!!!!!!!!!!!!!!!!

TOP

发新话题