Lines Matching refs:Locale

67  * A <code>Locale</code> object represents a specific geographical, political,
68 * or cultural region. An operation that requires a <code>Locale</code> to perform
69 * its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
75 * <p> The <code>Locale</code> class implements identifiers
77 * Languages"), with support for the LDML (UTS#35, "Unicode Locale
81 * <p> A <code>Locale</code> object logically consists of the fields
93 * <code>Locale</code> always canonicalizes to lower case.</dd><br>
108 * <code>Locale</code> always canonicalizes to title case (the first
123 * <code>Locale</code> always canonicalizes to upper case.</dd><br>
134 * <code>Locale</code>. Where there are two or more variant values
146 * <p>However, the variant field in <code>Locale</code> has
166 * <code>Locale</code> implement the semantics and syntax of BCP 47
168 * case insensitive, but <code>Locale</code> canonicalizes all
184 * in the IANA Language Subtag Registry, the <code>Locale</code> class
192 * <p>UTS#35, "Unicode Locale Data Markup Language" defines optional
203 * <p>Thus, when a <code>Locale</code> object contains Unicode locale
207 * <code>Locale</code> class also provides {@link
211 * a string, the Unicode Locale Extension lists attributes
230 * <h4>Creating a Locale</h4>
232 * <p>There are several different ways to create a <code>Locale</code>
237 * <p>Using {@link Builder} you can construct a <code>Locale</code> object
242 * <p>The <code>Locale</code> class provides three constructors:
245 * {@link #Locale(String language)}
246 * {@link #Locale(String language, String country)}
247 * {@link #Locale(String language, String country, String variant)}
250 * These constructors allow you to create a <code>Locale</code> object
256 * <p>The method {@link #forLanguageTag} creates a <code>Locale</code>
259 * <h5>Locale Constants</h5>
261 * <p>The <code>Locale</code> class provides a number of convenient constants
262 * that you can use to create <code>Locale</code> objects for commonly used
263 * locales. For example, the following creates a <code>Locale</code> object
267 * Locale.US
271 * <h4>Use of Locale</h4>
273 * <p>Once you've created a <code>Locale</code> you can query it for information
307 * A <code>Locale</code> is the mechanism for identifying the kind of object
314 * <p>In order to maintain compatibility with existing usage, Locale's
317 * <code>toString</code> method. Thus Locale objects can continue to
325 * imposed by Locale's constructors. This means that conversions
333 * <code>forLanguageTag</code> and <code>Locale.Builder</code> APIs instead.
351 * <tt>japanese</tt>. When the Locale constructor is called with the
358 * <tt>nu</tt> (for "number") and value <tt>thai</tt>. When the Locale
373 * <p>Locale's constructor has always converted three language codes to
380 * maintaining the old codes internal to Locale (so that
391 * <p>The Locale constructors have always specified that the language
409 public final class Locale implements Cloneable, Serializable {
415 static public final Locale ENGLISH = createConstant("en", "");
419 static public final Locale FRENCH = createConstant("fr", "");
423 static public final Locale GERMAN = createConstant("de", "");
427 static public final Locale ITALIAN = createConstant("it", "");
431 static public final Locale JAPANESE = createConstant("ja", "");
435 static public final Locale KOREAN = createConstant("ko", "");
439 static public final Locale CHINESE = createConstant("zh", "");
443 static public final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN");
447 static public final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW");
451 static public final Locale FRANCE = createConstant("fr", "FR");
455 static public final Locale GERMANY = createConstant("de", "DE");
459 static public final Locale ITALY = createConstant("it", "IT");
463 static public final Locale JAPAN = createConstant("ja", "JP");
467 static public final Locale KOREA = createConstant("ko", "KR");
471 static public final Locale CHINA = SIMPLIFIED_CHINESE;
475 static public final Locale PRC = SIMPLIFIED_CHINESE;
479 static public final Locale TAIWAN = TRADITIONAL_CHINESE;
483 static public final Locale UK = createConstant("en", "GB");
487 static public final Locale US = createConstant("en", "US");
491 static public final Locale CANADA = createConstant("en", "CA");
495 static public final Locale CANADA_FRENCH = createConstant("fr", "CA");
505 static public final Locale ROOT = createConstant("", "");
540 private Locale(BaseLocale baseLocale, LocaleExtensions extensions) {
555 * API on Locale will return only the OLD codes.
563 * up to 8 characters in length. See the <code>Locale</code> class description about
566 * See the <code>Locale</code> class description about valid country values.
567 * @param variant Any arbitrary value used to indicate a variation of a <code>Locale</code>.
568 * See the <code>Locale</code> class description for the details.
571 public Locale(String language, String country, String variant) {
589 * API on Locale will return only the OLD codes.
595 * up to 8 characters in length. See the <code>Locale</code> class description about
598 * See the <code>Locale</code> class description about valid country values.
601 public Locale(String language, String country) {
614 * API on Locale will return only the OLD codes.
620 * up to 8 characters in length. See the <code>Locale</code> class description about
625 public Locale(String language) {
630 * This method must be called only for creating the Locale.*
633 private static Locale createConstant(String lang, String country) {
639 * Returns a <code>Locale</code> constructed from the given
641 * <code>variant</code>. If the same <code>Locale</code> instance
643 * returned. Otherwise, a new <code>Locale</code> instance is
649 * @return the <code>Locale</code> instance requested
652 static Locale getInstance(String language, String country, String variant) {
656 static Locale getInstance(String language, String script, String country,
670 static Locale getInstance(BaseLocale baseloc, LocaleExtensions extensions) {
675 private static class Cache extends LocaleObjectCache<LocaleKey, Locale> {
680 protected Locale createObject(LocaleKey key) {
681 return new Locale(key.base, key.exts);
734 * {@link #setDefault(java.util.Locale) setDefault} method.
738 public static Locale getDefault() {
754 * setDefault(Locale.Category, Locale) method.
760 * @see #setDefault(Locale.Category, Locale)
763 public static Locale getDefault(Locale.Category category) {
812 private static void initDefault(Locale.Category category) {
818 Locale defaultCategoryLocale = getInstance(
867 public static synchronized void setDefault(Locale newLocale) {
898 * @see #getDefault(Locale.Category)
901 public static synchronized void setDefault(Locale.Category category,
902 Locale newLocale) {
928 * implementations. It must contain at least a <code>Locale</code>
929 * instance equal to {@link java.util.Locale#US Locale.US}.
933 public static Locale[] getAvailableLocales() {
941 * <b>Note:</b> The <code>Locale</code> class also supports other codes for
964 * <li>The <code>Locale</code> class also supports language codes up to
988 * Returns the language code of this Locale.
991 * Locale's constructor recognizes both the new and the old codes for the languages
1000 * if (locale.getLanguage().equals(new Locale("he").getLanguage()))
1136 * Package locale method returning the Locale's BaseLocale,
1138 * @return base locale of this Locale
1145 * Package private method returning the Locale's LocaleExtensions,
1147 * @return locale exnteions of this Locale,
1155 * Returns a string representation of this <code>Locale</code>
1179 * fields only. To represent a Locale as a String for interchange purposes, use
1192 * @return A string representation of the Locale, for debugging.
1234 * <p>If this <code>Locale</code> has a language, country, or
1287 * new Locale("xx", "YY").toLanguageTag();</pre>
1349 * to {@link Locale.Builder#setLanguageTag} which throws an exception
1358 * that's done in Locale's constructors.)
1366 * Locale loc;
1367 * loc = Locale.forLanguageTag("en-US-x-lvariant-POSIX");
1371 * loc = Locale.forLanguageTag("de-POSIX-x-URP-lvariant-Abc-Def");
1381 * Locale.forLanguageTag("ar-aao").getLanguage(); // returns "aao"
1382 * Locale.forLanguageTag("en-abc-def-us").toString(); // returns "abc_US"
1395 * Locale.forLanguageTag("ja-JP-x-lvariant-JP").toLanguageTag();
1397 * Locale.forLanguageTag("th-TH-x-lvariant-TH").toLanguageTag();
1461 * @see java.util.Locale.Builder#setLanguageTag(String)
1464 public static Locale forLanguageTag(String languageTag) {
1579 public String getDisplayLanguage(Locale inLocale) {
1605 public String getDisplayScript(Locale inLocale) {
1640 public String getDisplayCountry(Locale inLocale) {
1644 private String getDisplayString(String code, Locale inLocale, int type) {
1699 public String getDisplayVariant(Locale inLocale) {
1760 public String getDisplayName(Locale inLocale) {
1859 Locale that = (Locale)super.clone();
1887 * Returns true if this Locale is equal to another object. A Locale is
1888 * deemed equal to another Locale with identical language, script, country,
1891 * @return true if this Locale is equal to the specified object.
1897 if (!(obj instanceof Locale))
1899 BaseLocale otherBase = ((Locale)obj).baseLocale;
1904 return ((Locale)obj).localeExtensions == null;
1906 return localeExtensions.equals(((Locale)obj).localeExtensions);
1919 private static Locale defaultLocale = null;
1920 private static Locale defaultDisplayLocale = null;
1921 private static Locale defaultFormatLocale = null;
1928 private String[] getDisplayVariantArray(OpenListResourceBundle bundle, Locale inLocale) {
2009 * language subtag in lower case. (See <a href="java/util/Locale.html#getLanguage()">getLanguage()</a>)
2011 * country subtag in upper case. (See <a href="java/util/Locale.html#getCountry()">getCountry()</a>)
2013 * variant subtags separated by LOWLINE characters. (See <a href="java/util/Locale.html#getVariant()">getVariant()</a>)
2017 * script subtag in title case (See <a href="java/util/Locale.html#getScript()">getScript()</a>)
2023 * (See <a href="java/util/Locale.html#getExtensionKeys()">getExtensionKeys()</a>,
2024 * <a href="java/util/Locale.html#getExtension(char)">getExtension(char)</a>)
2036 * Serializes this <code>Locale</code> to the specified <code>ObjectOutputStream</code>.
2053 * Deserializes this <code>Locale</code>.
2082 * Returns a cached <code>Locale</code> instance equivalent to
2083 * the deserialized <code>Locale</code>. When serialized
2088 * type is "thai"). See <a href="Locale.html#special_cases_constructor"/>Special Cases</a>
2091 * @return an instance of <code>Locale</code> equivalent to
2092 * the deserialized <code>Locale</code>.
2150 Locale locale,
2179 * @see #getDefault(Locale.Category)
2180 * @see #setDefault(Locale.Category, Locale)
2217 * <code>Builder</code> is used to build instances of <code>Locale</code>
2218 * from values configured by the setters. Unlike the <code>Locale</code>
2220 * setter satisfies the syntax requirements defined by the <code>Locale</code>
2221 * class. A <code>Locale</code> object created by a <code>Builder</code> is
2225 * <p><b>Note:</b> The <code>Locale</code> class does not provide any
2231 * Locale constructor. However, keep in mind that a <code>Locale</code>
2235 * <p>The following example shows how to create a <code>Locale</code> object
2239 * Locale aLocale = new Builder().setLanguage("sr").setScript("Latn").setRegion("RS").build();
2246 * @see Locale#forLanguageTag
2265 * <p>All fields of the locale must be well-formed, see {@link Locale}.
2271 * <li>Locale("ja", "JP", "JP") is treated as "ja-JP-u-ca-japanese"
2272 * <li>Locale("th", "TH", "TH") is treated as "th-TH-u-nu-thai"
2273 * <li>Locale("no", "NO", "NY") is treated as "nn-NO"</ul>
2281 public Builder setLocale(Locale locale) {
2295 * Locale#forLanguageTag}) are converted to their canonical
2297 * must be well-formed (see {@link Locale}) or an exception is
2298 * thrown (unlike <code>Locale.forLanguageTag</code>, which
2305 * @see Locale#forLanguageTag(String)
2320 * the language must be <a href="./Locale.html#def_language">well-formed</a>
2342 * Otherwise, the script must be <a href="./Locale.html#def_script">well-formed</a> or an
2363 * the region must be <a href="./Locale.html#def_region">well-formed</a> or an
2369 * <p>The country value in the <code>Locale</code> created by the
2388 * must consist of one or more <a href="./Locale.html#def_variant">well-formed</a>
2394 * the <code>Locale</code> class does not impose any syntactic
2396 * <code>Locale</code> is case sensitive. To set such a variant,
2397 * use a Locale constructor.
2415 * must be <a href="./Locale.html#def_extensions">well-formed</a> or an exception
2418 * <p><b>Note:</b> The key {@link Locale#UNICODE_LOCALE_EXTENSION
2423 * <p><b>Note:</b> The key {@link Locale#PRIVATE_USE_EXTENSION
2448 * href="./Locale.html#def_locale_extension">well-formed</a> or an exception
2477 * href="./Locale.html#def_locale_extension">well-formed</a> or an exception
2498 * href="./Locale.html#def_locale_extension">well-formed</a> or an exception
2541 * Returns an instance of <code>Locale</code> created from the fields set
2544 * <p>This applies the conversions listed in {@link Locale#forLanguageTag}
2545 * when constructing a Locale. (Grandfathered tags are handled in
2548 * @return A Locale.
2550 public Locale build() {
2557 return Locale.getInstance(baseloc, extensions);