Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/348.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 使用ResourceBundle将属性文件从一种语言转换为另一种语言_Java_Properties_Locale_Resourcebundle_Country - Fatal编程技术网

Java 使用ResourceBundle将属性文件从一种语言转换为另一种语言

Java 使用ResourceBundle将属性文件从一种语言转换为另一种语言,java,properties,locale,resourcebundle,country,Java,Properties,Locale,Resourcebundle,Country,我有message.properties文件。默认情况下,当我在Java文件中使用区域设置和资源包时,它将以英语加载。现在,我需要在区域设置中指定国家代码或类型,然后message.properties文件键值应该作为区域设置中指定的国家加载。我怎样才能做到这一点呢?Oracle提供了一些这方面的示例代码 基本上,您可以使用语言环境的正确名称创建捆绑包,然后加载: ResourceBundle.getBundle("LabelsBundle", currentLocale); 有关..的更多信

我有message.properties文件。默认情况下,当我在Java文件中使用区域设置和资源包时,它将以英语加载。现在,我需要在区域设置中指定国家代码或类型,然后message.properties文件键值应该作为区域设置中指定的国家加载。我怎样才能做到这一点呢?

Oracle提供了一些这方面的示例代码

基本上,您可以使用
语言环境
的正确名称创建捆绑包,然后加载:

ResourceBundle.getBundle("LabelsBundle", currentLocale);
有关..的更多信息

另外,在问问题之前,试着自己用谷歌搜索一下