]>
git.saurik.com Git - apple/icu.git/blob - icuSources/common/unicode/locid.h
1 // © 2016 and later: Unicode, Inc. and others.
2 // License & terms of use: http://www.unicode.org/copyright.html
4 ******************************************************************************
6 * Copyright (C) 1996-2015, International Business Machines
7 * Corporation and others. All Rights Reserved.
9 ******************************************************************************
13 * Created by: Helena Shih
15 * Modification History:
17 * Date Name Description
18 * 02/11/97 aliu Changed gLocPath to fgLocPath and added methods to
20 * 04/02/97 aliu Made operator!= inline; fixed return value of getName().
21 * 04/15/97 aliu Cleanup for AIX/Win32.
22 * 04/24/97 aliu Numerous changes per code review.
23 * 08/18/98 stephen Added tokenizeString(),changed getDisplayName()
24 * 09/08/98 stephen Moved definition of kEmptyString for Mac Port
25 * 11/09/99 weiv Added const char * getName() const;
26 * 04/12/00 srl removing unicodestring api's and cached hash code
27 * 08/10/01 grhoten Change the static Locales to accessor functions
28 ******************************************************************************
34 #include "unicode/utypes.h"
35 #include "unicode/uobject.h"
36 #include "unicode/putil.h"
37 #include "unicode/uloc.h"
41 * \brief C++ API: Locale ID object.
44 #if U_SHOW_CPLUSPLUS_API
47 // Forward Declarations
48 void U_CALLCONV
locale_available_init(); /**< @internal */
50 class StringEnumeration
;
54 * A <code>Locale</code> object represents a specific geographical, political,
55 * or cultural region. An operation that requires a <code>Locale</code> to perform
56 * its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
57 * to tailor information for the user. For example, displaying a number
58 * is a locale-sensitive operation--the number should be formatted
59 * according to the customs/conventions of the user's native country,
62 * The Locale class is not suitable for subclassing.
65 * You can create a <code>Locale</code> object using the constructor in
67 * \htmlonly<blockquote>\endhtmlonly
69 * Locale( const char* language,
70 * const char* country,
71 * const char* variant);
73 * \htmlonly</blockquote>\endhtmlonly
74 * The first argument to the constructors is a valid <STRONG>ISO
75 * Language Code.</STRONG> These codes are the lower-case two-letter
76 * codes as defined by ISO-639.
77 * You can find a full list of these codes at:
78 * <BR><a href ="http://www.loc.gov/standards/iso639-2/">
79 * http://www.loc.gov/standards/iso639-2/</a>
82 * The second argument to the constructors is a valid <STRONG>ISO Country
83 * Code.</STRONG> These codes are the upper-case two-letter codes
84 * as defined by ISO-3166.
85 * You can find a full list of these codes at a number of sites, such as:
86 * <BR><a href="http://www.iso.org/iso/en/prods-services/iso3166ma/index.html">
87 * http://www.iso.org/iso/en/prods-services/iso3166ma/index.html</a>
90 * The third constructor requires a third argument--the <STRONG>Variant.</STRONG>
91 * The Variant codes are vendor and browser-specific.
92 * For example, use REVISED for a language's revised script orthography, and POSIX for POSIX.
93 * Where there are two variants, separate them with an underscore, and
94 * put the most important one first. For
95 * example, a Traditional Spanish collation might be referenced, with
96 * "ES", "ES", "Traditional_POSIX".
99 * Because a <code>Locale</code> object is just an identifier for a region,
100 * no validity check is performed when you construct a <code>Locale</code>.
101 * If you want to see whether particular resources are available for the
102 * <code>Locale</code> you construct, you must query those resources. For
103 * example, ask the <code>NumberFormat</code> for the locales it supports
104 * using its <code>getAvailableLocales</code> method.
105 * <BR><STRONG>Note:</STRONG> When you ask for a resource for a particular
106 * locale, you get back the best available match, not necessarily
107 * precisely what you asked for. For more information, look at
108 * <code>ResourceBundle</code>.
111 * The <code>Locale</code> class provides a number of convenient constants
112 * that you can use to create <code>Locale</code> objects for commonly used
113 * locales. For example, the following refers to a <code>Locale</code> object
114 * for the United States:
115 * \htmlonly<blockquote>\endhtmlonly
119 * \htmlonly</blockquote>\endhtmlonly
122 * Once you've created a <code>Locale</code> you can query it for information about
123 * itself. Use <code>getCountry</code> to get the ISO Country Code and
124 * <code>getLanguage</code> to get the ISO Language Code. You can
125 * use <code>getDisplayCountry</code> to get the
126 * name of the country suitable for displaying to the user. Similarly,
127 * you can use <code>getDisplayLanguage</code> to get the name of
128 * the language suitable for displaying to the user. Interestingly,
129 * the <code>getDisplayXXX</code> methods are themselves locale-sensitive
130 * and have two versions: one that uses the default locale and one
131 * that takes a locale as an argument and displays the name or country in
132 * a language appropriate to that locale.
135 * ICU provides a number of classes that perform locale-sensitive
136 * operations. For example, the <code>NumberFormat</code> class formats
137 * numbers, currency, or percentages in a locale-sensitive manner. Classes
138 * such as <code>NumberFormat</code> have a number of convenience methods
139 * for creating a default object of that type. For example, the
140 * <code>NumberFormat</code> class provides these three convenience methods
141 * for creating a default <code>NumberFormat</code> object:
142 * \htmlonly<blockquote>\endhtmlonly
144 * UErrorCode success = U_ZERO_ERROR;
148 * nf = NumberFormat::createInstance( success ); delete nf;
149 * nf = NumberFormat::createCurrencyInstance( success ); delete nf;
150 * nf = NumberFormat::createPercentInstance( success ); delete nf;
152 * \htmlonly</blockquote>\endhtmlonly
153 * Each of these methods has two variants; one with an explicit locale
154 * and one without; the latter using the default locale.
155 * \htmlonly<blockquote>\endhtmlonly
157 * nf = NumberFormat::createInstance( myLocale, success ); delete nf;
158 * nf = NumberFormat::createCurrencyInstance( myLocale, success ); delete nf;
159 * nf = NumberFormat::createPercentInstance( myLocale, success ); delete nf;
161 * \htmlonly</blockquote>\endhtmlonly
162 * A <code>Locale</code> is the mechanism for identifying the kind of object
163 * (<code>NumberFormat</code>) that you would like to get. The locale is
164 * <STRONG>just</STRONG> a mechanism for identifying objects,
165 * <STRONG>not</STRONG> a container for the objects themselves.
168 * Each class that performs locale-sensitive operations allows you
169 * to get all the available objects of that type. You can sift
170 * through these objects by language, country, or variant,
171 * and use the display names to present a menu to the user.
172 * For example, you can create a menu of all the collation objects
173 * suitable for a given language. Such classes implement these
174 * three class methods:
175 * \htmlonly<blockquote>\endhtmlonly
177 * static Locale* getAvailableLocales(int32_t& numLocales)
178 * static UnicodeString& getDisplayName(const Locale& objectLocale,
179 * const Locale& displayLocale,
180 * UnicodeString& displayName)
181 * static UnicodeString& getDisplayName(const Locale& objectLocale,
182 * UnicodeString& displayName)
184 * \htmlonly</blockquote>\endhtmlonly
187 * @see ResourceBundle
189 class U_COMMON_API Locale
: public UObject
{
191 /** Useful constant for the Root locale. @stable ICU 4.4 */
192 static const Locale
&U_EXPORT2
getRoot(void);
193 /** Useful constant for this language. @stable ICU 2.0 */
194 static const Locale
&U_EXPORT2
getEnglish(void);
195 /** Useful constant for this language. @stable ICU 2.0 */
196 static const Locale
&U_EXPORT2
getFrench(void);
197 /** Useful constant for this language. @stable ICU 2.0 */
198 static const Locale
&U_EXPORT2
getGerman(void);
199 /** Useful constant for this language. @stable ICU 2.0 */
200 static const Locale
&U_EXPORT2
getItalian(void);
201 /** Useful constant for this language. @stable ICU 2.0 */
202 static const Locale
&U_EXPORT2
getJapanese(void);
203 /** Useful constant for this language. @stable ICU 2.0 */
204 static const Locale
&U_EXPORT2
getKorean(void);
205 /** Useful constant for this language. @stable ICU 2.0 */
206 static const Locale
&U_EXPORT2
getChinese(void);
207 /** Useful constant for this language. @stable ICU 2.0 */
208 static const Locale
&U_EXPORT2
getSimplifiedChinese(void);
209 /** Useful constant for this language. @stable ICU 2.0 */
210 static const Locale
&U_EXPORT2
getTraditionalChinese(void);
212 /** Useful constant for this country/region. @stable ICU 2.0 */
213 static const Locale
&U_EXPORT2
getFrance(void);
214 /** Useful constant for this country/region. @stable ICU 2.0 */
215 static const Locale
&U_EXPORT2
getGermany(void);
216 /** Useful constant for this country/region. @stable ICU 2.0 */
217 static const Locale
&U_EXPORT2
getItaly(void);
218 /** Useful constant for this country/region. @stable ICU 2.0 */
219 static const Locale
&U_EXPORT2
getJapan(void);
220 /** Useful constant for this country/region. @stable ICU 2.0 */
221 static const Locale
&U_EXPORT2
getKorea(void);
222 /** Useful constant for this country/region. @stable ICU 2.0 */
223 static const Locale
&U_EXPORT2
getChina(void);
224 /** Useful constant for this country/region. @stable ICU 2.0 */
225 static const Locale
&U_EXPORT2
getPRC(void);
226 /** Useful constant for this country/region. @stable ICU 2.0 */
227 static const Locale
&U_EXPORT2
getTaiwan(void);
228 /** Useful constant for this country/region. @stable ICU 2.0 */
229 static const Locale
&U_EXPORT2
getUK(void);
230 /** Useful constant for this country/region. @stable ICU 2.0 */
231 static const Locale
&U_EXPORT2
getUS(void);
232 /** Useful constant for this country/region. @stable ICU 2.0 */
233 static const Locale
&U_EXPORT2
getCanada(void);
234 /** Useful constant for this country/region. @stable ICU 2.0 */
235 static const Locale
&U_EXPORT2
getCanadaFrench(void);
239 * Construct a default locale object, a Locale for the default locale ID.
242 * @see uloc_getDefault
248 * Construct a locale from language, country, variant.
249 * If an error occurs, then the constructed object will be "bogus"
250 * (isBogus() will return TRUE).
252 * @param language Lowercase two-letter or three-letter ISO-639 code.
253 * This parameter can instead be an ICU style C locale (e.g. "en_US"),
254 * but the other parameters must not be used.
255 * This parameter can be NULL; if so,
256 * the locale is initialized to match the current default locale.
257 * (This is the same as using the default constructor.)
258 * Please note: The Java Locale class does NOT accept the form
259 * 'new Locale("en_US")' but only 'new Locale("en","US")'
261 * @param country Uppercase two-letter ISO-3166 code. (optional)
262 * @param variant Uppercase vendor and browser specific code. See class
263 * description. (optional)
264 * @param keywordsAndValues A string consisting of keyword/values pairs, such as
265 * "collation=phonebook;currency=euro"
268 * @see uloc_getDefault
271 Locale( const char * language
,
272 const char * country
= 0,
273 const char * variant
= 0,
274 const char * keywordsAndValues
= 0);
277 * Initializes a Locale object from another Locale object.
279 * @param other The Locale object being copied in.
282 Locale(const Locale
& other
);
292 * Replaces the entire contents of *this with the specified value.
294 * @param other The Locale object being copied in.
298 Locale
& operator=(const Locale
& other
);
301 * Checks if two locale keys are the same.
303 * @param other The locale key object to be compared with this.
304 * @return True if the two locale keys are the same, false otherwise.
307 UBool
operator==(const Locale
& other
) const;
310 * Checks if two locale keys are not the same.
312 * @param other The locale key object to be compared with this.
313 * @return True if the two locale keys are not the same, false
317 UBool
operator!=(const Locale
& other
) const;
321 * Clones can be used concurrently in multiple threads.
322 * If an error occurs, then NULL is returned.
323 * The caller must delete the clone.
325 * @return a clone of this object
327 * @see getDynamicClassID
330 Locale
*clone() const;
332 #ifndef U_HIDE_SYSTEM_API
334 * Common methods of getting the current default Locale. Used for the
335 * presentation: menus, dialogs, etc. Generally set once when your applet or
336 * application is initialized, then never reset. (If you do reset the
337 * default locale, you probably want to reload your GUI, so that the change
338 * is reflected in your interface.)
340 * More advanced programs will allow users to use different locales for
341 * different fields, e.g. in a spreadsheet.
343 * Note that the initial setting will match the host system.
344 * @return a reference to the Locale object for the default locale ID
348 static const Locale
& U_EXPORT2
getDefault(void);
351 * Sets the default. Normally set once at the beginning of a process,
353 * setDefault() only changes ICU's default locale ID, <strong>not</strong>
354 * the default locale ID of the runtime environment.
356 * @param newLocale Locale to set to. If NULL, set to the value obtained
357 * from the runtime environment.
358 * @param success The error code.
362 static void U_EXPORT2
setDefault(const Locale
& newLocale
,
363 UErrorCode
& success
);
364 #endif /* U_HIDE_SYSTEM_API */
367 * Creates a locale which has had minimal canonicalization
368 * as per uloc_getName().
369 * @param name The name to create from. If name is null,
370 * the default Locale is used.
371 * @return new locale object
375 static Locale U_EXPORT2
createFromName(const char *name
);
378 * Creates a locale from the given string after canonicalizing
379 * the string by calling uloc_canonicalize().
380 * @param name the locale ID to create from. Must not be NULL.
381 * @return a new locale object corresponding to the given name
383 * @see uloc_canonicalize
385 static Locale U_EXPORT2
createCanonical(const char* name
);
388 * Returns the locale's ISO-639 language code.
389 * @return An alias to the code
392 inline const char * getLanguage( ) const;
395 * Returns the locale's ISO-15924 abbreviation script code.
396 * @return An alias to the code
397 * @see uscript_getShortName
398 * @see uscript_getCode
401 inline const char * getScript( ) const;
404 * Returns the locale's ISO-3166 country code.
405 * @return An alias to the code
408 inline const char * getCountry( ) const;
411 * Returns the locale's variant code.
412 * @return An alias to the code
415 inline const char * getVariant( ) const;
418 * Returns the programmatic name of the entire locale, with the language,
419 * country and variant separated by underbars. If a field is missing, up
420 * to two leading underbars will occur. Example: "en", "de_DE", "en_US_WIN",
421 * "de__POSIX", "fr__MAC", "__MAC", "_MT", "_FR_EURO"
422 * @return A pointer to "name".
425 inline const char * getName() const;
428 * Returns the programmatic name of the entire locale as getName() would return,
429 * but without keywords.
430 * @return A pointer to "name".
434 const char * getBaseName() const;
438 * Gets the list of keywords for the specified locale.
440 * @param status the status code
441 * @return pointer to StringEnumeration class, or NULL if there are no keywords.
442 * Client must dispose of it by calling delete.
445 StringEnumeration
* createKeywords(UErrorCode
&status
) const;
448 * Gets the value for a keyword.
450 * @param keywordName name of the keyword for which we want the value. Case insensitive.
451 * @param buffer The buffer to receive the keyword value.
452 * @param bufferCapacity The capacity of receiving buffer
453 * @param status Returns any error information while performing this operation.
454 * @return the length of the keyword value
458 int32_t getKeywordValue(const char* keywordName
, char *buffer
, int32_t bufferCapacity
, UErrorCode
&status
) const;
461 * Sets or removes the value for a keyword.
463 * For removing all keywords, use getBaseName(),
464 * and construct a new Locale if it differs from getName().
466 * @param keywordName name of the keyword to be set. Case insensitive.
467 * @param keywordValue value of the keyword to be set. If 0-length or
468 * NULL, will result in the keyword being removed. No error is given if
469 * that keyword does not exist.
470 * @param status Returns any error information while performing this operation.
474 void setKeywordValue(const char* keywordName
, const char* keywordValue
, UErrorCode
&status
);
477 * returns the locale's three-letter language code, as specified
478 * in ISO draft standard ISO-639-2.
479 * @return An alias to the code, or an empty string
482 const char * getISO3Language() const;
485 * Fills in "name" with the locale's three-letter ISO-3166 country code.
486 * @return An alias to the code, or an empty string
489 const char * getISO3Country() const;
492 * Returns the Windows LCID value corresponding to this locale.
493 * This value is stored in the resource data for the locale as a one-to-four-digit
494 * hexadecimal number. If the resource is missing, in the wrong format, or
495 * there is no Windows LCID value that corresponds to this locale, returns 0.
498 uint32_t getLCID(void) const;
501 * Returns whether this locale's script is written right-to-left.
502 * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags().
503 * If no likely script is known, then FALSE is returned.
505 * A script is right-to-left according to the CLDR script metadata
506 * which corresponds to whether the script's letters have Bidi_Class=R or AL.
508 * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl".
510 * @return TRUE if the locale's script is written right-to-left
513 UBool
isRightToLeft() const;
516 * Fills in "dispLang" with the name of this locale's language in a format suitable for
517 * user display in the default locale. For example, if the locale's language code is
518 * "fr" and the default locale's language code is "en", this function would set
519 * dispLang to "French".
520 * @param dispLang Receives the language's display name.
521 * @return A reference to "dispLang".
524 UnicodeString
& getDisplayLanguage(UnicodeString
& dispLang
) const;
527 * Fills in "dispLang" with the name of this locale's language in a format suitable for
528 * user display in the locale specified by "displayLocale". For example, if the locale's
529 * language code is "en" and displayLocale's language code is "fr", this function would set
530 * dispLang to "Anglais".
531 * @param displayLocale Specifies the locale to be used to display the name. In other words,
532 * if the locale's language code is "en", passing Locale::getFrench() for
533 * displayLocale would result in "Anglais", while passing Locale::getGerman()
534 * for displayLocale would result in "Englisch".
535 * @param dispLang Receives the language's display name.
536 * @return A reference to "dispLang".
539 UnicodeString
& getDisplayLanguage( const Locale
& displayLocale
,
540 UnicodeString
& dispLang
) const;
543 * Fills in "dispScript" with the name of this locale's script in a format suitable
544 * for user display in the default locale. For example, if the locale's script code
545 * is "LATN" and the default locale's language code is "en", this function would set
546 * dispScript to "Latin".
547 * @param dispScript Receives the scripts's display name.
548 * @return A reference to "dispScript".
551 UnicodeString
& getDisplayScript( UnicodeString
& dispScript
) const;
554 * Fills in "dispScript" with the name of this locale's country in a format suitable
555 * for user display in the locale specified by "displayLocale". For example, if the locale's
556 * script code is "LATN" and displayLocale's language code is "en", this function would set
557 * dispScript to "Latin".
558 * @param displayLocale Specifies the locale to be used to display the name. In other
559 * words, if the locale's script code is "LATN", passing
560 * Locale::getFrench() for displayLocale would result in "", while
561 * passing Locale::getGerman() for displayLocale would result in
563 * @param dispScript Receives the scripts's display name.
564 * @return A reference to "dispScript".
567 UnicodeString
& getDisplayScript( const Locale
& displayLocale
,
568 UnicodeString
& dispScript
) const;
571 * Fills in "dispCountry" with the name of this locale's country in a format suitable
572 * for user display in the default locale. For example, if the locale's country code
573 * is "FR" and the default locale's language code is "en", this function would set
574 * dispCountry to "France".
575 * @param dispCountry Receives the country's display name.
576 * @return A reference to "dispCountry".
579 UnicodeString
& getDisplayCountry( UnicodeString
& dispCountry
) const;
582 * Fills in "dispCountry" with the name of this locale's country in a format suitable
583 * for user display in the locale specified by "displayLocale". For example, if the locale's
584 * country code is "US" and displayLocale's language code is "fr", this function would set
585 * dispCountry to "États-Unis".
586 * @param displayLocale Specifies the locale to be used to display the name. In other
587 * words, if the locale's country code is "US", passing
588 * Locale::getFrench() for displayLocale would result in "États-Unis", while
589 * passing Locale::getGerman() for displayLocale would result in
590 * "Vereinigte Staaten".
591 * @param dispCountry Receives the country's display name.
592 * @return A reference to "dispCountry".
595 UnicodeString
& getDisplayCountry( const Locale
& displayLocale
,
596 UnicodeString
& dispCountry
) const;
599 * Fills in "dispVar" with the name of this locale's variant code in a format suitable
600 * for user display in the default locale.
601 * @param dispVar Receives the variant's name.
602 * @return A reference to "dispVar".
605 UnicodeString
& getDisplayVariant( UnicodeString
& dispVar
) const;
608 * Fills in "dispVar" with the name of this locale's variant code in a format
609 * suitable for user display in the locale specified by "displayLocale".
610 * @param displayLocale Specifies the locale to be used to display the name.
611 * @param dispVar Receives the variant's display name.
612 * @return A reference to "dispVar".
615 UnicodeString
& getDisplayVariant( const Locale
& displayLocale
,
616 UnicodeString
& dispVar
) const;
619 * Fills in "name" with the name of this locale in a format suitable for user display
620 * in the default locale. This function uses getDisplayLanguage(), getDisplayCountry(),
621 * and getDisplayVariant() to do its work, and outputs the display name in the format
622 * "language (country[,variant])". For example, if the default locale is en_US, then
623 * fr_FR's display name would be "French (France)", and es_MX_Traditional's display name
624 * would be "Spanish (Mexico,Traditional)".
625 * @param name Receives the locale's display name.
626 * @return A reference to "name".
629 UnicodeString
& getDisplayName( UnicodeString
& name
) const;
632 * Fills in "name" with the name of this locale in a format suitable for user display
633 * in the locale specified by "displayLocale". This function uses getDisplayLanguage(),
634 * getDisplayCountry(), and getDisplayVariant() to do its work, and outputs the display
635 * name in the format "language (country[,variant])". For example, if displayLocale is
636 * fr_FR, then en_US's display name would be "Anglais (États-Unis)", and no_NO_NY's
637 * display name would be "norvégien (Norvège,NY)".
638 * @param displayLocale Specifies the locale to be used to display the name.
639 * @param name Receives the locale's display name.
640 * @return A reference to "name".
643 UnicodeString
& getDisplayName( const Locale
& displayLocale
,
644 UnicodeString
& name
) const;
647 * Generates a hash code for the locale.
650 int32_t hashCode(void) const;
653 * Sets the locale to bogus
654 * A bogus locale represents a non-existing locale associated
655 * with services that can be instantiated from non-locale data
656 * in addition to locale (for example, collation can be
657 * instantiated from a locale and from a rule set).
663 * Gets the bogus state. Locale object can be bogus if it doesn't exist
664 * @return FALSE if it is a real locale, TRUE if it is a bogus locale
667 UBool
isBogus(void) const;
670 * Returns a list of all installed locales.
671 * @param count Receives the number of locales in the list.
672 * @return A pointer to an array of Locale objects. This array is the list
673 * of all locales with installed resource files. The called does NOT
674 * get ownership of this list, and must NOT delete it.
677 static const Locale
* U_EXPORT2
getAvailableLocales(int32_t& count
);
680 * Gets a list of all available 2-letter country codes defined in ISO 3166. This is a
681 * pointer to an array of pointers to arrays of char. All of these pointers are
682 * owned by ICU-- do not delete them, and do not write through them. The array is
683 * terminated with a null pointer.
684 * @return a list of all available country codes
687 static const char* const* U_EXPORT2
getISOCountries();
690 * Gets a list of all available language codes defined in ISO 639. This is a pointer
691 * to an array of pointers to arrays of char. All of these pointers are owned
692 * by ICU-- do not delete them, and do not write through them. The array is
693 * terminated with a null pointer.
694 * @return a list of all available language codes
697 static const char* const* U_EXPORT2
getISOLanguages();
700 * ICU "poor man's RTTI", returns a UClassID for this class.
704 static UClassID U_EXPORT2
getStaticClassID();
707 * ICU "poor man's RTTI", returns a UClassID for the actual class.
711 virtual UClassID
getDynamicClassID() const;
713 protected: /* only protected for testing purposes. DO NOT USE. */
714 #ifndef U_HIDE_INTERNAL_API
716 * Set this from a single POSIX style locale string.
719 void setFromPOSIXID(const char *posixID
);
720 #endif /* U_HIDE_INTERNAL_API */
724 * Initialize the locale object with a new name.
725 * Was deprecated - used in implementation - moved internal
727 * @param cLocaleID The new locale name.
728 * @param canonicalize whether to call uloc_canonicalize on cLocaleID
730 Locale
& init(const char* cLocaleID
, UBool canonicalize
);
733 * Internal constructor to allow construction of a locale object with
734 * NO side effects. (Default constructor tries to get
735 * the default locale.)
743 * Initialize the locale cache for commonly used locales
745 static Locale
*getLocaleCache(void);
747 char language
[ULOC_LANG_CAPACITY
];
748 char script
[ULOC_SCRIPT_CAPACITY
];
749 char country
[ULOC_COUNTRY_CAPACITY
];
750 int32_t variantBegin
;
752 char fullNameBuffer
[ULOC_FULLNAME_CAPACITY
];
753 // name without keywords
755 void initBaseName(UErrorCode
& status
);
759 static const Locale
&getLocale(int locid
);
762 * A friend to allow the default locale to be set by either the C or C++ API.
765 friend Locale
*locale_set_default_internal(const char *, UErrorCode
& status
);
770 friend void U_CALLCONV
locale_available_init();
774 Locale::operator!=(const Locale
& other
) const
776 return !operator==(other
);
780 Locale::getCountry() const
786 Locale::getLanguage() const
792 Locale::getScript() const
798 Locale::getVariant() const
800 return &baseName
[variantBegin
];
804 Locale::getName() const
810 Locale::isBogus(void) const {
815 #endif // U_SHOW_CPLUSPLUS_API