java 如何为阿拉伯语添加语言环境
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14876287/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to add locale for Arabic
提问by Fahim Parkar
I was trying to build multi-language website using JSF 2.0 using this tutorial
我试图使用本教程使用 JSF 2.0 构建多语言网站
But I am facing at this line
但我面对这条线
countries.put("English", Locale.ENGLISH);
countries.put("Chinese", Locale.SIMPLIFIED_CHINESE);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
I want to put it as Arabic
, but Locale.XXXXXXX
is not giving any support for Arab countries. What I get is some countries but NO Arabic country.
我想把它说成是Arabic
,但Locale.XXXXXXX
不是对阿拉伯国家给予任何支持。我得到的是一些国家,但没有阿拉伯国家。
Any idea, what to do so that I can have arabic country?
知道怎么做才能拥有阿拉伯国家吗?
回答by Petr Mensik
You have to use this
你必须使用这个
countries.put("Arabic", new Locale("ar", "DZ"));
//or just language name for generic Arabic
new Locale("ar");
Where the first pair of letters means language and the second is country (region) - Algeria in this case. You can use thislink as a reference for the list of available countries and locales (I know, Roseindia sucks but this list seemed to me very useful).
其中第一对字母表示语言,第二对字母表示国家(地区)——在本例中为阿尔及利亚。您可以使用此链接作为可用国家和地区列表的参考(我知道,Roseindia 很糟糕,但这个列表在我看来非常有用)。