Get all locales
static Locale[] getAvailableLocales()
- Returns an array of all locales for which the get*Instance methods of this class can return localized instances.
import java.text.DateFormat;
import java.util.Locale;
public class Main{
public static void main(String args[]) {
Locale[] locales = DateFormat.getDateInstance().getAvailableLocales();
for(Locale l: locales){
System.out.println(l.getDisplayCountry());
}
}
}
The output:
Japan
Peru
Japan
Panama
Bosnia and Herzegovina
...
...
Oman
Thailand
Sweden
Denmark
Honduras