import java.text.MessageFormat;
import java.util.Locale;
import java.util.ResourceBundle;
public class Test1 {
public static void main(String[] args) {
Locale locale = Locale.US;
ResourceBundle bundle = ResourceBundle.getBundle("hellotest", locale);
String pattern = bundle.getString("hello");
String format = MessageFormat.format(pattern, new Object[] {"张三"});
System.out.println(format);
}
}
hellotest_en_US.properties
hello = hello world {0}
hellotest_zh_CN.properties
hello = \u4F60\u597D\uFF01 {0} {1}