Calendar and display name
static Locale[] getAvailableLocales()
- Returns an array of all locales for which the getInstance methods of this class can return localized instances.
String getDisplayName(int field, int style, Locale locale)
- Returns the string representation of the calendar field value in the given style and locale.
Map<String,Integer> getDisplayNames(int field, int style, Locale locale)
- Returns a Map containing all names of the calendar field in the given style and locale and their corresponding field values.
The following code displays all locales from Calendar class:
import java.util.Calendar;
import java.util.Locale;
public class Main{
public static void main(String[] argv){
Locale[] locales = Calendar.getAvailableLocales();
for(Locale l: locales){
System.out.println(l.getDisplayCountry());
}
}
}
The output:
Japan
Peru
Japan
...
Sweden
Denmark
Honduras