Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add locale for Arabic

I was trying to build multi-language website using JSF 2.0 using this tutorial

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.

Any idea, what to do so that I can have arabic country?

like image 665
Fahim Parkar Avatar asked Dec 05 '22 12:12

Fahim Parkar


1 Answers

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 this link as a reference for the list of available countries and locales (I know, Roseindia sucks but this list seemed to me very useful).

like image 196
Petr Mensik Avatar answered Dec 07 '22 02:12

Petr Mensik