17. Creating a Locale
A Java Locale (java.util.Locale) represents an object that wraps information about a specific geographical, political, or cultural region – that is, an object useful for internationalization purposes. A Locale is typically used in conjunction with DateFormat/DateTimeFormatter to represent date-time in a format specific to a country, with NumberFormat (or its subclass, DecimalFormat) used to represent numbers in a format specific to a country (for instance, to represent an amount of money in a specific currency), or with MessageFormat to create formatted messages for a specific country.
For the most popular locales, Java provides a list of constants (for instance, Locale.GERMANY, Locale.CANADA, and so on). For locales that are not on this list, we have to use the formats defined in several RFCs. Most commonly, we use the language pattern (for instance, ro for Romanian) or the language_country pattern (for instance, ro_RO for Romania, en_US for United...