What is Locale class in Java? Explain the methods offered by Locale class. The class Locale represents a specific political, geographical or cultural region. The operations that uses Locale is known as ‘locale-sensitive’ for tailoring the information for the user.
The following are the methods in Locale class:
1. getAvailableLocales(); This method returns a list of all installed locales.
2. getISOCountries(): This method returns a list which contains 2-letter country codes that isdefined in ISO 3166.
3. getISOLanguages(): This method returns a list that contains 2-letter code that is defined in ISO 639.
4. getLanguage(): This method returns a code that represents a language of a specific locale available in ISO 639 code.
5. getCountry(): This method returns the country or region for this locale available in the ISO 3166 code.
6. getDisplayLanguage(): This method returns the name of the locale’s language. If the locale returns fr_FR, it represents ‘French’.
7. getDisplayCountry(): This method returns the name of the locale’s country. If the locale returns fr_FR, it represents ‘France’.
|