Sometimes the question is asked to students that “What is locale?” during interviews. Let’s talk about it in this post.
As per Wikipedia : In computing, locale is a set of parameters that defines the user’s language, country and any special variant preferences that the user wants to see in their user interface. Usually a locale identifier consists of at least a language identifier and a region identifier.
What is locale? Simply put it is relatively simple object. It defines specific language and geographic region. It represents the language and cultural preferences of a geographic area.
What about standard? Local language is specified by the ISO 639 standard, which describes valid language codes that can be used to construct a locale object.
Locale class has two important constructors that you need to know about:
Locale(String language, String country)
Locale(String language, String country, string variant)
Note: here language codes are Japanese jp, french fr, en English. While the Country codes are India IN, Canada CA etc. Variant is used to create more specific locale than what’s possible with just language and country codes.