package com.i18n;
import java.util.Locale;
public class Test1
{
public static void main(String[] args)
{
Locale[] locales = Locale.getAvailableLocales();
for(Locale locale : locales)
{
// System.out.println(locale.getDisplayCountry() + " : " + locale.getCountry());
System.out.println(locale.getDisplayLanguage() + " : " + locale.getLanguage());
}
}
}
package com.i18n;
import java.util.*;
public class Test2
{
public static void main(String[] args)
{
Locale locale = Locale.US;
ResourceBundle bundle = ResourceBundle.getBundle("hellofile",locale);
String value = bundle.getString("hello");
System.out.println(value);
}
}
package com.i18n;
import java.util.*;
import java.text.*;
public class Test3
{
public static void main(String[] args)
{
Locale locale = Locale.US;
ResourceBundle bundle = ResourceBundle.getBundle("hellofile",locale);
String value = bundle.getString("hello");
String result = MessageFormat.format(value,new Object[]{"北京"});
System.out.println(result);
}
}