Locale represents a language/country/variant combination. It is an identifier which dictates particular conventions for the presentation of information. The language codes are two letter lowercase codes as defined by ISO-639. The country codes are three letter uppercase codes as defined by I
| 29 | * @see ResourceBundle |
| 30 | */ |
| 31 | public final class Locale implements Cloneable, Serializable { |
| 32 | |
| 33 | private static final long serialVersionUID = 9149081749638150636L; |
| 34 | |
| 35 | // Initialize a default which is used during static |
| 36 | // initialization of the default for the platform. |
| 37 | private static Locale defaultLocale = new Locale(); |
| 38 | |
| 39 | public static final Locale ENGLISH = defaultLocale; |
| 40 | |
| 41 | private transient String countryCode; |
| 42 | private transient String languageCode; |
| 43 | private transient String variantCode; |
| 44 | |
| 45 | /** |
| 46 | * Constructs a default which is used during static initialization of the |
| 47 | * default for the platform. |
| 48 | */ |
| 49 | private Locale() { |
| 50 | languageCode = "en"; //$NON-NLS-1$ |
| 51 | countryCode = "GB"; //$NON-NLS-1$ |
| 52 | variantCode = ""; //$NON-NLS-1$ |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Constructs a new {@code Locale} using the specified language. |
| 57 | * |
| 58 | * @param language |
| 59 | * the language this {@code Locale} represents. |
| 60 | */ |
| 61 | public Locale(String language) { |
| 62 | this(language, "", ""); //$NON-NLS-1$//$NON-NLS-2$ |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Constructs a new {@code Locale} using the specified language and country codes. |
| 67 | * |
| 68 | * @param language |
| 69 | * the language this {@code Locale} represents. |
| 70 | * @param country |
| 71 | * the country this {@code Locale} represents. |
| 72 | */ |
| 73 | public Locale(String language, String country) { |
| 74 | this(language, country, ""); //$NON-NLS-1$ |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * Constructs a new {@code Locale} using the specified language, country, and |
| 79 | * variant codes. |
| 80 | * |
| 81 | * @param language |
| 82 | * the language this {@code Locale} represents. |
| 83 | * @param country |
| 84 | * the country this {@code Locale} represents. |
| 85 | * @param variant |
| 86 | * the variant this {@code Locale} represents. |
| 87 | * @throws NullPointerException |
| 88 | * if {@code language}, {@code country}, or |
nothing calls this directly
no outgoing calls
no test coverage detected