标签:
ResourceBundle类通常是用于针对不同的语言来使用的不同语言属性文件;
import java.util.Locale; import java.util.ResourceBundle; public class TestResourceBundle { public static void main(String[] args) { ResourceBundle defaultBundle = ResourceBundle.getBundle("mail"); System.out.println(defaultBundle.getString("message")); Locale zhLocale = new Locale("zh", "CN"); ResourceBundle zhBundle = ResourceBundle.getBundle("mail", zhLocale); System.out.println(zhBundle.getString("message")); Locale enLocale = new Locale("en", "US"); ResourceBundle enBundle = ResourceBundle.getBundle("mail", enLocale); System.out.println(enBundle.getString("message")); } }
标签:
原文地址:http://www.cnblogs.com/liaojie970/p/4900300.html