在java.util.Lacale中使用了构造函数:
Locale(String language, String country)
根据语言和国家/地区构造一个语言环境。
程序是:import java.util.*;
public class ClassTest_3{
public static void main(String[] args){
Locale zh_locale=new Locale("zh","CN");
Locale en_locale=new Locale("en","US");
Locale fr_locale=new Locale("fr","FR");
ResourceBundle zh_bundle=ResourceBundle.getBundle("Message",zh_locale);
ResourceBundle en_bundle=ResourceBundle.getBundle("Message",en_locale);
ResourceBundle fr_bundle=ResourceBundle.getBundle("Message",fr_locale);
System.out.println(zh_bundle.getString("info"));
System.out.println(en_bundle.getString("info"));
System.out.println(fr_bundle.getString("info"));
}
}
|
|