Listing all available Locales
Locale is the class of java.util.*; package. This class represents the geographical, political and cultural region. Every tasks which requires to perform the operation is called local-sensitive. In this world, each places have it's own country name, language name etc. these can be determined by the object of the Locale class.
This section shows you how to list all the available locales installed with the software development kit. The given program in this section displays all the available language code, country code and full country name. Some following method and APIs which have used in the program for completion the task these are explained as follows:
Locale.getAvailableLocales():
Above method return a array of available locales which are installed with
your software development kit.
Locale.getLanguage():
Above method returns the two character
'language code' for the specific locale. You can display the full language name
by using the getDisplayLanguage()
method of the Locale class.
Locale.getCounty():
Above method returns the two character country
code for the specific locale. If you want to display the full country name then
you can use the getDisplayCountry()
method of Locale class.
Locale.getDisplayName():
Above method display the full description about
the created locale that means the specific geographical or political or the
cultural region.
Here is the code of the program:
import java.util.*;
|