Question: How to use java.util.locale to validate a user locale?
Summary: The legacy code that I use in the locale has predefined statics to check if the user has, for example, in France ...
if(Locale.FRANCE.equals(locale) || Locale.FRENCH.equals(locale)) {
I want to add a code to check if the user is in Australia. However, Locale has only a limited set of predefined statics, and AUSTRALIA is not one of them. It seems I can do the following ...
if(new Locale("AU").equals(locale)) {
However, this does not match the existing code. What is the right way to do this? If the first example I gave is correct, why is the predefined list of statics so limited?
source share