xref: /aosp_15_r20/external/icu/libandroidicu/include/unicode/uloc.h (revision 0e209d3975ff4a8c132096b14b0e9364a753506e)
1*0e209d39SAndroid Build Coastguard Worker // © 2016 and later: Unicode, Inc. and others.
2*0e209d39SAndroid Build Coastguard Worker // License & terms of use: http://www.unicode.org/copyright.html
3*0e209d39SAndroid Build Coastguard Worker /*
4*0e209d39SAndroid Build Coastguard Worker **********************************************************************
5*0e209d39SAndroid Build Coastguard Worker *   Copyright (C) 1997-2016, International Business Machines
6*0e209d39SAndroid Build Coastguard Worker *   Corporation and others.  All Rights Reserved.
7*0e209d39SAndroid Build Coastguard Worker **********************************************************************
8*0e209d39SAndroid Build Coastguard Worker *
9*0e209d39SAndroid Build Coastguard Worker * File ULOC.H
10*0e209d39SAndroid Build Coastguard Worker *
11*0e209d39SAndroid Build Coastguard Worker * Modification History:
12*0e209d39SAndroid Build Coastguard Worker *
13*0e209d39SAndroid Build Coastguard Worker *   Date        Name        Description
14*0e209d39SAndroid Build Coastguard Worker *   04/01/97    aliu        Creation.
15*0e209d39SAndroid Build Coastguard Worker *   08/22/98    stephen     JDK 1.2 sync.
16*0e209d39SAndroid Build Coastguard Worker *   12/08/98    rtg         New C API for Locale
17*0e209d39SAndroid Build Coastguard Worker *   03/30/99    damiba      overhaul
18*0e209d39SAndroid Build Coastguard Worker *   03/31/99    helena      Javadoc for uloc functions.
19*0e209d39SAndroid Build Coastguard Worker *   04/15/99    Madhu       Updated Javadoc
20*0e209d39SAndroid Build Coastguard Worker ********************************************************************************
21*0e209d39SAndroid Build Coastguard Worker */
22*0e209d39SAndroid Build Coastguard Worker 
23*0e209d39SAndroid Build Coastguard Worker #ifndef ULOC_H
24*0e209d39SAndroid Build Coastguard Worker #define ULOC_H
25*0e209d39SAndroid Build Coastguard Worker 
26*0e209d39SAndroid Build Coastguard Worker #include "unicode/utypes.h"
27*0e209d39SAndroid Build Coastguard Worker #include "unicode/uenum.h"
28*0e209d39SAndroid Build Coastguard Worker 
29*0e209d39SAndroid Build Coastguard Worker /**
30*0e209d39SAndroid Build Coastguard Worker  * \file
31*0e209d39SAndroid Build Coastguard Worker  * \brief C API: Locale ID functionality similar to C++ class Locale
32*0e209d39SAndroid Build Coastguard Worker  *
33*0e209d39SAndroid Build Coastguard Worker  * <h2> ULoc C API for Locale </h2>
34*0e209d39SAndroid Build Coastguard Worker  * A <code>Locale</code> represents a specific geographical, political,
35*0e209d39SAndroid Build Coastguard Worker  * or cultural region. An operation that requires a <code>Locale</code> to perform
36*0e209d39SAndroid Build Coastguard Worker  * its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
37*0e209d39SAndroid Build Coastguard Worker  * to tailor information for the user. For example, displaying a number
38*0e209d39SAndroid Build Coastguard Worker  * is a locale-sensitive operation--the number should be formatted
39*0e209d39SAndroid Build Coastguard Worker  * according to the customs/conventions of the user's native country,
40*0e209d39SAndroid Build Coastguard Worker  * region, or culture.  In the C APIs, a locales is simply a const char string.
41*0e209d39SAndroid Build Coastguard Worker  *
42*0e209d39SAndroid Build Coastguard Worker  * <P>
43*0e209d39SAndroid Build Coastguard Worker  * You create a <code>Locale</code> with one of the three options listed below.
44*0e209d39SAndroid Build Coastguard Worker  * Each of the component is separated by '_' in the locale string.
45*0e209d39SAndroid Build Coastguard Worker  * \htmlonly<blockquote>\endhtmlonly
46*0e209d39SAndroid Build Coastguard Worker  * <pre>
47*0e209d39SAndroid Build Coastguard Worker  * \code
48*0e209d39SAndroid Build Coastguard Worker  *       newLanguage
49*0e209d39SAndroid Build Coastguard Worker  *
50*0e209d39SAndroid Build Coastguard Worker  *       newLanguage + newCountry
51*0e209d39SAndroid Build Coastguard Worker  *
52*0e209d39SAndroid Build Coastguard Worker  *       newLanguage + newCountry + newVariant
53*0e209d39SAndroid Build Coastguard Worker  * \endcode
54*0e209d39SAndroid Build Coastguard Worker  * </pre>
55*0e209d39SAndroid Build Coastguard Worker  * \htmlonly</blockquote>\endhtmlonly
56*0e209d39SAndroid Build Coastguard Worker  * The first option is a valid <STRONG>ISO
57*0e209d39SAndroid Build Coastguard Worker  * Language Code.</STRONG> These codes are the lower-case two-letter
58*0e209d39SAndroid Build Coastguard Worker  * codes as defined by ISO-639.
59*0e209d39SAndroid Build Coastguard Worker  * You can find a full list of these codes at a number of sites, such as:
60*0e209d39SAndroid Build Coastguard Worker  * <BR><a href ="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">
61*0e209d39SAndroid Build Coastguard Worker  * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a>
62*0e209d39SAndroid Build Coastguard Worker  *
63*0e209d39SAndroid Build Coastguard Worker  * <P>
64*0e209d39SAndroid Build Coastguard Worker  * The second option includes an additional <STRONG>ISO Country
65*0e209d39SAndroid Build Coastguard Worker  * Code.</STRONG> These codes are the upper-case two-letter codes
66*0e209d39SAndroid Build Coastguard Worker  * as defined by ISO-3166.
67*0e209d39SAndroid Build Coastguard Worker  * You can find a full list of these codes at a number of sites, such as:
68*0e209d39SAndroid Build Coastguard Worker  * <BR><a href="http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">
69*0e209d39SAndroid Build Coastguard Worker  * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>
70*0e209d39SAndroid Build Coastguard Worker  *
71*0e209d39SAndroid Build Coastguard Worker  * <P>
72*0e209d39SAndroid Build Coastguard Worker  * The third option requires another additional information--the
73*0e209d39SAndroid Build Coastguard Worker  * <STRONG>Variant.</STRONG>
74*0e209d39SAndroid Build Coastguard Worker  * The Variant codes are vendor and browser-specific.
75*0e209d39SAndroid Build Coastguard Worker  * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
76*0e209d39SAndroid Build Coastguard Worker  * Where there are two variants, separate them with an underscore, and
77*0e209d39SAndroid Build Coastguard Worker  * put the most important one first. For
78*0e209d39SAndroid Build Coastguard Worker  * example, a Traditional Spanish collation might be referenced, with
79*0e209d39SAndroid Build Coastguard Worker  * "ES", "ES", "Traditional_WIN".
80*0e209d39SAndroid Build Coastguard Worker  *
81*0e209d39SAndroid Build Coastguard Worker  * <P>
82*0e209d39SAndroid Build Coastguard Worker  * Because a <code>Locale</code> is just an identifier for a region,
83*0e209d39SAndroid Build Coastguard Worker  * no validity check is performed when you specify a <code>Locale</code>.
84*0e209d39SAndroid Build Coastguard Worker  * If you want to see whether particular resources are available for the
85*0e209d39SAndroid Build Coastguard Worker  * <code>Locale</code> you asked for, you must query those resources. For
86*0e209d39SAndroid Build Coastguard Worker  * example, ask the <code>UNumberFormat</code> for the locales it supports
87*0e209d39SAndroid Build Coastguard Worker  * using its <code>getAvailable</code> method.
88*0e209d39SAndroid Build Coastguard Worker  * <BR><STRONG>Note:</STRONG> When you ask for a resource for a particular
89*0e209d39SAndroid Build Coastguard Worker  * locale, you get back the best available match, not necessarily
90*0e209d39SAndroid Build Coastguard Worker  * precisely what you asked for. For more information, look at
91*0e209d39SAndroid Build Coastguard Worker  * <code>UResourceBundle</code>.
92*0e209d39SAndroid Build Coastguard Worker  *
93*0e209d39SAndroid Build Coastguard Worker  * <P>
94*0e209d39SAndroid Build Coastguard Worker  * The <code>Locale</code> provides a number of convenient constants
95*0e209d39SAndroid Build Coastguard Worker  * that you can use to specify the commonly used
96*0e209d39SAndroid Build Coastguard Worker  * locales. For example, the following refers to a locale
97*0e209d39SAndroid Build Coastguard Worker  * for the United States:
98*0e209d39SAndroid Build Coastguard Worker  * \htmlonly<blockquote>\endhtmlonly
99*0e209d39SAndroid Build Coastguard Worker  * <pre>
100*0e209d39SAndroid Build Coastguard Worker  * \code
101*0e209d39SAndroid Build Coastguard Worker  *       ULOC_US
102*0e209d39SAndroid Build Coastguard Worker  * \endcode
103*0e209d39SAndroid Build Coastguard Worker  * </pre>
104*0e209d39SAndroid Build Coastguard Worker  * \htmlonly</blockquote>\endhtmlonly
105*0e209d39SAndroid Build Coastguard Worker  *
106*0e209d39SAndroid Build Coastguard Worker  * <P>
107*0e209d39SAndroid Build Coastguard Worker  * Once you've specified a locale you can query it for information about
108*0e209d39SAndroid Build Coastguard Worker  * itself. Use <code>uloc_getCountry</code> to get the ISO Country Code and
109*0e209d39SAndroid Build Coastguard Worker  * <code>uloc_getLanguage</code> to get the ISO Language Code. You can
110*0e209d39SAndroid Build Coastguard Worker  * use <code>uloc_getDisplayCountry</code> to get the
111*0e209d39SAndroid Build Coastguard Worker  * name of the country suitable for displaying to the user. Similarly,
112*0e209d39SAndroid Build Coastguard Worker  * you can use <code>uloc_getDisplayLanguage</code> to get the name of
113*0e209d39SAndroid Build Coastguard Worker  * the language suitable for displaying to the user. Interestingly,
114*0e209d39SAndroid Build Coastguard Worker  * the <code>uloc_getDisplayXXX</code> methods are themselves locale-sensitive
115*0e209d39SAndroid Build Coastguard Worker  * and have two versions: one that uses the default locale and one
116*0e209d39SAndroid Build Coastguard Worker  * that takes a locale as an argument and displays the name or country in
117*0e209d39SAndroid Build Coastguard Worker  * a language appropriate to that locale.
118*0e209d39SAndroid Build Coastguard Worker  *
119*0e209d39SAndroid Build Coastguard Worker  * <P>
120*0e209d39SAndroid Build Coastguard Worker  * The ICU provides a number of services that perform locale-sensitive
121*0e209d39SAndroid Build Coastguard Worker  * operations. For example, the <code>unum_xxx</code> functions format
122*0e209d39SAndroid Build Coastguard Worker  * numbers, currency, or percentages in a locale-sensitive manner.
123*0e209d39SAndroid Build Coastguard Worker  * </P>
124*0e209d39SAndroid Build Coastguard Worker  * \htmlonly<blockquote>\endhtmlonly
125*0e209d39SAndroid Build Coastguard Worker  * <pre>
126*0e209d39SAndroid Build Coastguard Worker  * \code
127*0e209d39SAndroid Build Coastguard Worker  *     UErrorCode success = U_ZERO_ERROR;
128*0e209d39SAndroid Build Coastguard Worker  *     UNumberFormat *nf;
129*0e209d39SAndroid Build Coastguard Worker  *     const char* myLocale = "fr_FR";
130*0e209d39SAndroid Build Coastguard Worker  *
131*0e209d39SAndroid Build Coastguard Worker  *     nf = unum_open( UNUM_DEFAULT, NULL, success );
132*0e209d39SAndroid Build Coastguard Worker  *     unum_close(nf);
133*0e209d39SAndroid Build Coastguard Worker  *     nf = unum_open( UNUM_CURRENCY, NULL, success );
134*0e209d39SAndroid Build Coastguard Worker  *     unum_close(nf);
135*0e209d39SAndroid Build Coastguard Worker  *     nf = unum_open( UNUM_PERCENT, NULL, success );
136*0e209d39SAndroid Build Coastguard Worker  *     unum_close(nf);
137*0e209d39SAndroid Build Coastguard Worker  * \endcode
138*0e209d39SAndroid Build Coastguard Worker  * </pre>
139*0e209d39SAndroid Build Coastguard Worker  * \htmlonly</blockquote>\endhtmlonly
140*0e209d39SAndroid Build Coastguard Worker  * Each of these methods has two variants; one with an explicit locale
141*0e209d39SAndroid Build Coastguard Worker  * and one without; the latter using the default locale.
142*0e209d39SAndroid Build Coastguard Worker  * \htmlonly<blockquote>\endhtmlonly
143*0e209d39SAndroid Build Coastguard Worker  * <pre>
144*0e209d39SAndroid Build Coastguard Worker  * \code
145*0e209d39SAndroid Build Coastguard Worker  *
146*0e209d39SAndroid Build Coastguard Worker  *     nf = unum_open( UNUM_DEFAULT, myLocale, success );
147*0e209d39SAndroid Build Coastguard Worker  *     unum_close(nf);
148*0e209d39SAndroid Build Coastguard Worker  *     nf = unum_open( UNUM_CURRENCY, myLocale, success );
149*0e209d39SAndroid Build Coastguard Worker  *     unum_close(nf);
150*0e209d39SAndroid Build Coastguard Worker  *     nf = unum_open( UNUM_PERCENT, myLocale, success );
151*0e209d39SAndroid Build Coastguard Worker  *     unum_close(nf);
152*0e209d39SAndroid Build Coastguard Worker  * \endcode
153*0e209d39SAndroid Build Coastguard Worker  * </pre>
154*0e209d39SAndroid Build Coastguard Worker  * \htmlonly</blockquote>\endhtmlonly
155*0e209d39SAndroid Build Coastguard Worker  * A <code>Locale</code> is the mechanism for identifying the kind of services
156*0e209d39SAndroid Build Coastguard Worker  * (<code>UNumberFormat</code>) that you would like to get. The locale is
157*0e209d39SAndroid Build Coastguard Worker  * <STRONG>just</STRONG> a mechanism for identifying these services.
158*0e209d39SAndroid Build Coastguard Worker  *
159*0e209d39SAndroid Build Coastguard Worker  * <P>
160*0e209d39SAndroid Build Coastguard Worker  * Each international service that performs locale-sensitive operations
161*0e209d39SAndroid Build Coastguard Worker  * allows you
162*0e209d39SAndroid Build Coastguard Worker  * to get all the available objects of that type. You can sift
163*0e209d39SAndroid Build Coastguard Worker  * through these objects by language, country, or variant,
164*0e209d39SAndroid Build Coastguard Worker  * and use the display names to present a menu to the user.
165*0e209d39SAndroid Build Coastguard Worker  * For example, you can create a menu of all the collation objects
166*0e209d39SAndroid Build Coastguard Worker  * suitable for a given language. Such classes implement these
167*0e209d39SAndroid Build Coastguard Worker  * three class methods:
168*0e209d39SAndroid Build Coastguard Worker  * \htmlonly<blockquote>\endhtmlonly
169*0e209d39SAndroid Build Coastguard Worker  * <pre>
170*0e209d39SAndroid Build Coastguard Worker  * \code
171*0e209d39SAndroid Build Coastguard Worker  *       const char* uloc_getAvailable(int32_t index);
172*0e209d39SAndroid Build Coastguard Worker  *       int32_t uloc_countAvailable();
173*0e209d39SAndroid Build Coastguard Worker  *       int32_t
174*0e209d39SAndroid Build Coastguard Worker  *       uloc_getDisplayName(const char* localeID,
175*0e209d39SAndroid Build Coastguard Worker  *                 const char* inLocaleID,
176*0e209d39SAndroid Build Coastguard Worker  *                 UChar* result,
177*0e209d39SAndroid Build Coastguard Worker  *                 int32_t maxResultSize,
178*0e209d39SAndroid Build Coastguard Worker  *                  UErrorCode* err);
179*0e209d39SAndroid Build Coastguard Worker  *
180*0e209d39SAndroid Build Coastguard Worker  * \endcode
181*0e209d39SAndroid Build Coastguard Worker  * </pre>
182*0e209d39SAndroid Build Coastguard Worker  * \htmlonly</blockquote>\endhtmlonly
183*0e209d39SAndroid Build Coastguard Worker  * <P>
184*0e209d39SAndroid Build Coastguard Worker  * Concerning POSIX/RFC1766 Locale IDs,
185*0e209d39SAndroid Build Coastguard Worker  *  the getLanguage/getCountry/getVariant/getName functions do understand
186*0e209d39SAndroid Build Coastguard Worker  * the POSIX type form of  language_COUNTRY.ENCODING\@VARIANT
187*0e209d39SAndroid Build Coastguard Worker  * and if there is not an ICU-stype variant, uloc_getVariant() for example
188*0e209d39SAndroid Build Coastguard Worker  * will return the one listed after the \@at sign. As well, the hyphen
189*0e209d39SAndroid Build Coastguard Worker  * "-" is recognized as a country/variant separator similarly to RFC1766.
190*0e209d39SAndroid Build Coastguard Worker  * So for example, "en-us" will be interpreted as en_US.
191*0e209d39SAndroid Build Coastguard Worker  * As a result, uloc_getName() is far from a no-op, and will have the
192*0e209d39SAndroid Build Coastguard Worker  * effect of converting POSIX/RFC1766 IDs into ICU form, although it does
193*0e209d39SAndroid Build Coastguard Worker  * NOT map any of the actual codes (i.e. russian->ru) in any way.
194*0e209d39SAndroid Build Coastguard Worker  * Applications should call uloc_getName() at the point where a locale ID
195*0e209d39SAndroid Build Coastguard Worker  * is coming from an external source (user entry, OS, web browser)
196*0e209d39SAndroid Build Coastguard Worker  * and pass the resulting string to other ICU functions.  For example,
197*0e209d39SAndroid Build Coastguard Worker  * don't use de-de\@EURO as an argument to resourcebundle.
198*0e209d39SAndroid Build Coastguard Worker  *
199*0e209d39SAndroid Build Coastguard Worker  * @see UResourceBundle
200*0e209d39SAndroid Build Coastguard Worker  */
201*0e209d39SAndroid Build Coastguard Worker 
202*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this language. @stable ICU 2.0 */
203*0e209d39SAndroid Build Coastguard Worker #define ULOC_CHINESE            "zh"
204*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this language. @stable ICU 2.0 */
205*0e209d39SAndroid Build Coastguard Worker #define ULOC_ENGLISH            "en"
206*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this language. @stable ICU 2.0 */
207*0e209d39SAndroid Build Coastguard Worker #define ULOC_FRENCH             "fr"
208*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this language. @stable ICU 2.0 */
209*0e209d39SAndroid Build Coastguard Worker #define ULOC_GERMAN             "de"
210*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this language. @stable ICU 2.0 */
211*0e209d39SAndroid Build Coastguard Worker #define ULOC_ITALIAN            "it"
212*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this language. @stable ICU 2.0 */
213*0e209d39SAndroid Build Coastguard Worker #define ULOC_JAPANESE           "ja"
214*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this language. @stable ICU 2.0 */
215*0e209d39SAndroid Build Coastguard Worker #define ULOC_KOREAN             "ko"
216*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this language. @stable ICU 2.0 */
217*0e209d39SAndroid Build Coastguard Worker #define ULOC_SIMPLIFIED_CHINESE "zh_CN"
218*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this language. @stable ICU 2.0 */
219*0e209d39SAndroid Build Coastguard Worker #define ULOC_TRADITIONAL_CHINESE "zh_TW"
220*0e209d39SAndroid Build Coastguard Worker 
221*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
222*0e209d39SAndroid Build Coastguard Worker #define ULOC_CANADA         "en_CA"
223*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
224*0e209d39SAndroid Build Coastguard Worker #define ULOC_CANADA_FRENCH  "fr_CA"
225*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
226*0e209d39SAndroid Build Coastguard Worker #define ULOC_CHINA          "zh_CN"
227*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
228*0e209d39SAndroid Build Coastguard Worker #define ULOC_PRC            "zh_CN"
229*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
230*0e209d39SAndroid Build Coastguard Worker #define ULOC_FRANCE         "fr_FR"
231*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
232*0e209d39SAndroid Build Coastguard Worker #define ULOC_GERMANY        "de_DE"
233*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
234*0e209d39SAndroid Build Coastguard Worker #define ULOC_ITALY          "it_IT"
235*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
236*0e209d39SAndroid Build Coastguard Worker #define ULOC_JAPAN          "ja_JP"
237*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
238*0e209d39SAndroid Build Coastguard Worker #define ULOC_KOREA          "ko_KR"
239*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
240*0e209d39SAndroid Build Coastguard Worker #define ULOC_TAIWAN         "zh_TW"
241*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
242*0e209d39SAndroid Build Coastguard Worker #define ULOC_UK             "en_GB"
243*0e209d39SAndroid Build Coastguard Worker /** Useful constant for this country/region. @stable ICU 2.0 */
244*0e209d39SAndroid Build Coastguard Worker #define ULOC_US             "en_US"
245*0e209d39SAndroid Build Coastguard Worker 
246*0e209d39SAndroid Build Coastguard Worker /**
247*0e209d39SAndroid Build Coastguard Worker  * Useful constant for the maximum size of the language part of a locale ID.
248*0e209d39SAndroid Build Coastguard Worker  * (including the terminating NULL).
249*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
250*0e209d39SAndroid Build Coastguard Worker  */
251*0e209d39SAndroid Build Coastguard Worker #define ULOC_LANG_CAPACITY 12
252*0e209d39SAndroid Build Coastguard Worker 
253*0e209d39SAndroid Build Coastguard Worker /**
254*0e209d39SAndroid Build Coastguard Worker  * Useful constant for the maximum size of the country part of a locale ID
255*0e209d39SAndroid Build Coastguard Worker  * (including the terminating NULL).
256*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
257*0e209d39SAndroid Build Coastguard Worker  */
258*0e209d39SAndroid Build Coastguard Worker #define ULOC_COUNTRY_CAPACITY 4
259*0e209d39SAndroid Build Coastguard Worker /**
260*0e209d39SAndroid Build Coastguard Worker  * Useful constant for the maximum size of the whole locale ID
261*0e209d39SAndroid Build Coastguard Worker  * (including the terminating NULL and all keywords).
262*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
263*0e209d39SAndroid Build Coastguard Worker  */
264*0e209d39SAndroid Build Coastguard Worker #define ULOC_FULLNAME_CAPACITY 157
265*0e209d39SAndroid Build Coastguard Worker 
266*0e209d39SAndroid Build Coastguard Worker /**
267*0e209d39SAndroid Build Coastguard Worker  * Useful constant for the maximum size of the script part of a locale ID
268*0e209d39SAndroid Build Coastguard Worker  * (including the terminating NULL).
269*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
270*0e209d39SAndroid Build Coastguard Worker  */
271*0e209d39SAndroid Build Coastguard Worker #define ULOC_SCRIPT_CAPACITY 6
272*0e209d39SAndroid Build Coastguard Worker 
273*0e209d39SAndroid Build Coastguard Worker /**
274*0e209d39SAndroid Build Coastguard Worker  * Useful constant for the maximum size of keywords in a locale
275*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
276*0e209d39SAndroid Build Coastguard Worker  */
277*0e209d39SAndroid Build Coastguard Worker #define ULOC_KEYWORDS_CAPACITY 96
278*0e209d39SAndroid Build Coastguard Worker 
279*0e209d39SAndroid Build Coastguard Worker /**
280*0e209d39SAndroid Build Coastguard Worker  * Useful constant for the maximum total size of keywords and their values in a locale
281*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
282*0e209d39SAndroid Build Coastguard Worker  */
283*0e209d39SAndroid Build Coastguard Worker #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
284*0e209d39SAndroid Build Coastguard Worker 
285*0e209d39SAndroid Build Coastguard Worker /**
286*0e209d39SAndroid Build Coastguard Worker  * Invariant character separating keywords from the locale string
287*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
288*0e209d39SAndroid Build Coastguard Worker  */
289*0e209d39SAndroid Build Coastguard Worker #define ULOC_KEYWORD_SEPARATOR '@'
290*0e209d39SAndroid Build Coastguard Worker 
291*0e209d39SAndroid Build Coastguard Worker /**
292*0e209d39SAndroid Build Coastguard Worker   * Unicode code point for '@' separating keywords from the locale string.
293*0e209d39SAndroid Build Coastguard Worker   * @see ULOC_KEYWORD_SEPARATOR
294*0e209d39SAndroid Build Coastguard Worker   * @stable ICU 4.6
295*0e209d39SAndroid Build Coastguard Worker   */
296*0e209d39SAndroid Build Coastguard Worker #define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40
297*0e209d39SAndroid Build Coastguard Worker 
298*0e209d39SAndroid Build Coastguard Worker /**
299*0e209d39SAndroid Build Coastguard Worker  * Invariant character for assigning value to a keyword
300*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
301*0e209d39SAndroid Build Coastguard Worker  */
302*0e209d39SAndroid Build Coastguard Worker #define ULOC_KEYWORD_ASSIGN '='
303*0e209d39SAndroid Build Coastguard Worker 
304*0e209d39SAndroid Build Coastguard Worker /**
305*0e209d39SAndroid Build Coastguard Worker   * Unicode code point for '=' for assigning value to a keyword.
306*0e209d39SAndroid Build Coastguard Worker   * @see ULOC_KEYWORD_ASSIGN
307*0e209d39SAndroid Build Coastguard Worker   * @stable ICU 4.6
308*0e209d39SAndroid Build Coastguard Worker   */
309*0e209d39SAndroid Build Coastguard Worker #define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D
310*0e209d39SAndroid Build Coastguard Worker 
311*0e209d39SAndroid Build Coastguard Worker /**
312*0e209d39SAndroid Build Coastguard Worker  * Invariant character separating keywords
313*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
314*0e209d39SAndroid Build Coastguard Worker  */
315*0e209d39SAndroid Build Coastguard Worker #define ULOC_KEYWORD_ITEM_SEPARATOR ';'
316*0e209d39SAndroid Build Coastguard Worker 
317*0e209d39SAndroid Build Coastguard Worker /**
318*0e209d39SAndroid Build Coastguard Worker   * Unicode code point for ';' separating keywords
319*0e209d39SAndroid Build Coastguard Worker   * @see ULOC_KEYWORD_ITEM_SEPARATOR
320*0e209d39SAndroid Build Coastguard Worker   * @stable ICU 4.6
321*0e209d39SAndroid Build Coastguard Worker   */
322*0e209d39SAndroid Build Coastguard Worker #define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B
323*0e209d39SAndroid Build Coastguard Worker 
324*0e209d39SAndroid Build Coastguard Worker /**
325*0e209d39SAndroid Build Coastguard Worker  * Constants for *_getLocale()
326*0e209d39SAndroid Build Coastguard Worker  * Allow user to select whether she wants information on
327*0e209d39SAndroid Build Coastguard Worker  * requested, valid or actual locale.
328*0e209d39SAndroid Build Coastguard Worker  * For example, a collator for "en_US_CALIFORNIA" was
329*0e209d39SAndroid Build Coastguard Worker  * requested. In the current state of ICU (2.0),
330*0e209d39SAndroid Build Coastguard Worker  * the requested locale is "en_US_CALIFORNIA",
331*0e209d39SAndroid Build Coastguard Worker  * the valid locale is "en_US" (most specific locale supported by ICU)
332*0e209d39SAndroid Build Coastguard Worker  * and the actual locale is "root" (the collation data comes unmodified
333*0e209d39SAndroid Build Coastguard Worker  * from the UCA)
334*0e209d39SAndroid Build Coastguard Worker  * The locale is considered supported by ICU if there is a core ICU bundle
335*0e209d39SAndroid Build Coastguard Worker  * for that locale (although it may be empty).
336*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.1
337*0e209d39SAndroid Build Coastguard Worker  */
338*0e209d39SAndroid Build Coastguard Worker typedef enum {
339*0e209d39SAndroid Build Coastguard Worker   /** This is locale the data actually comes from
340*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.1
341*0e209d39SAndroid Build Coastguard Worker    */
342*0e209d39SAndroid Build Coastguard Worker   ULOC_ACTUAL_LOCALE    = 0,
343*0e209d39SAndroid Build Coastguard Worker   /** This is the most specific locale supported by ICU
344*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 2.1
345*0e209d39SAndroid Build Coastguard Worker    */
346*0e209d39SAndroid Build Coastguard Worker   ULOC_VALID_LOCALE    = 1,
347*0e209d39SAndroid Build Coastguard Worker 
348*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_DEPRECATED_API
349*0e209d39SAndroid Build Coastguard Worker   /** This is the requested locale
350*0e209d39SAndroid Build Coastguard Worker    *  @deprecated ICU 2.8
351*0e209d39SAndroid Build Coastguard Worker    */
352*0e209d39SAndroid Build Coastguard Worker   ULOC_REQUESTED_LOCALE = 2,
353*0e209d39SAndroid Build Coastguard Worker 
354*0e209d39SAndroid Build Coastguard Worker     /**
355*0e209d39SAndroid Build Coastguard Worker      * One more than the highest normal ULocDataLocaleType value.
356*0e209d39SAndroid Build Coastguard Worker      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
357*0e209d39SAndroid Build Coastguard Worker      */
358*0e209d39SAndroid Build Coastguard Worker     ULOC_DATA_LOCALE_TYPE_LIMIT = 3
359*0e209d39SAndroid Build Coastguard Worker #endif  // U_HIDE_DEPRECATED_API
360*0e209d39SAndroid Build Coastguard Worker } ULocDataLocaleType;
361*0e209d39SAndroid Build Coastguard Worker 
362*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_SYSTEM_API
363*0e209d39SAndroid Build Coastguard Worker /**
364*0e209d39SAndroid Build Coastguard Worker  * Gets ICU's default locale.
365*0e209d39SAndroid Build Coastguard Worker  * The returned string is a snapshot in time, and will remain valid
366*0e209d39SAndroid Build Coastguard Worker  *   and unchanged even when uloc_setDefault() is called.
367*0e209d39SAndroid Build Coastguard Worker  *   The returned storage is owned by ICU, and must not be altered or deleted
368*0e209d39SAndroid Build Coastguard Worker  *   by the caller.
369*0e209d39SAndroid Build Coastguard Worker  *
370*0e209d39SAndroid Build Coastguard Worker  * @return the ICU default locale
371*0e209d39SAndroid Build Coastguard Worker  * @system
372*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
373*0e209d39SAndroid Build Coastguard Worker  */
374*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* U_EXPORT2
375*0e209d39SAndroid Build Coastguard Worker uloc_getDefault(void);
376*0e209d39SAndroid Build Coastguard Worker 
377*0e209d39SAndroid Build Coastguard Worker /**
378*0e209d39SAndroid Build Coastguard Worker  * Sets ICU's default locale.
379*0e209d39SAndroid Build Coastguard Worker  *    By default (without calling this function), ICU's default locale will be based
380*0e209d39SAndroid Build Coastguard Worker  *    on information obtained from the underlying system environment.
381*0e209d39SAndroid Build Coastguard Worker  *    <p>
382*0e209d39SAndroid Build Coastguard Worker  *    Changes to ICU's default locale do not propagate back to the
383*0e209d39SAndroid Build Coastguard Worker  *    system environment.
384*0e209d39SAndroid Build Coastguard Worker  *    <p>
385*0e209d39SAndroid Build Coastguard Worker  *    Changes to ICU's default locale to not affect any ICU services that
386*0e209d39SAndroid Build Coastguard Worker  *    may already be open based on the previous default locale value.
387*0e209d39SAndroid Build Coastguard Worker  *
388*0e209d39SAndroid Build Coastguard Worker  * @param localeID the new ICU default locale. A value of NULL will try to get
389*0e209d39SAndroid Build Coastguard Worker  *                 the system's default locale.
390*0e209d39SAndroid Build Coastguard Worker  * @param status the error information if the setting of default locale fails
391*0e209d39SAndroid Build Coastguard Worker  * @system
392*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
393*0e209d39SAndroid Build Coastguard Worker  */
394*0e209d39SAndroid Build Coastguard Worker U_CAPI void U_EXPORT2
395*0e209d39SAndroid Build Coastguard Worker uloc_setDefault(const char* localeID,
396*0e209d39SAndroid Build Coastguard Worker         UErrorCode*       status);
397*0e209d39SAndroid Build Coastguard Worker #endif  /* U_HIDE_SYSTEM_API */
398*0e209d39SAndroid Build Coastguard Worker 
399*0e209d39SAndroid Build Coastguard Worker /**
400*0e209d39SAndroid Build Coastguard Worker  * Gets the language code for the specified locale.
401*0e209d39SAndroid Build Coastguard Worker  *
402*0e209d39SAndroid Build Coastguard Worker  * This function may return with a failure error code for certain kinds of inputs
403*0e209d39SAndroid Build Coastguard Worker  * but does not fully check for well-formed locale IDs / language tags.
404*0e209d39SAndroid Build Coastguard Worker  *
405*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the ISO language code with
406*0e209d39SAndroid Build Coastguard Worker  * @param language the language code for localeID
407*0e209d39SAndroid Build Coastguard Worker  * @param languageCapacity the size of the language buffer to store the
408*0e209d39SAndroid Build Coastguard Worker  * language code with
409*0e209d39SAndroid Build Coastguard Worker  * @param err error information if retrieving the language code failed
410*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the language code.  If it's greater
411*0e209d39SAndroid Build Coastguard Worker  * than languageCapacity, the returned language code will be truncated.
412*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
413*0e209d39SAndroid Build Coastguard Worker  */
414*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
415*0e209d39SAndroid Build Coastguard Worker uloc_getLanguage(const char*    localeID,
416*0e209d39SAndroid Build Coastguard Worker          char* language,
417*0e209d39SAndroid Build Coastguard Worker          int32_t languageCapacity,
418*0e209d39SAndroid Build Coastguard Worker          UErrorCode* err);
419*0e209d39SAndroid Build Coastguard Worker 
420*0e209d39SAndroid Build Coastguard Worker /**
421*0e209d39SAndroid Build Coastguard Worker  * Gets the script code for the specified locale.
422*0e209d39SAndroid Build Coastguard Worker  *
423*0e209d39SAndroid Build Coastguard Worker  * This function may return with a failure error code for certain kinds of inputs
424*0e209d39SAndroid Build Coastguard Worker  * but does not fully check for well-formed locale IDs / language tags.
425*0e209d39SAndroid Build Coastguard Worker  *
426*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the ISO language code with
427*0e209d39SAndroid Build Coastguard Worker  * @param script the language code for localeID
428*0e209d39SAndroid Build Coastguard Worker  * @param scriptCapacity the size of the language buffer to store the
429*0e209d39SAndroid Build Coastguard Worker  * language code with
430*0e209d39SAndroid Build Coastguard Worker  * @param err error information if retrieving the language code failed
431*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the language code.  If it's greater
432*0e209d39SAndroid Build Coastguard Worker  * than scriptCapacity, the returned language code will be truncated.
433*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
434*0e209d39SAndroid Build Coastguard Worker  */
435*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
436*0e209d39SAndroid Build Coastguard Worker uloc_getScript(const char*    localeID,
437*0e209d39SAndroid Build Coastguard Worker          char* script,
438*0e209d39SAndroid Build Coastguard Worker          int32_t scriptCapacity,
439*0e209d39SAndroid Build Coastguard Worker          UErrorCode* err);
440*0e209d39SAndroid Build Coastguard Worker 
441*0e209d39SAndroid Build Coastguard Worker /**
442*0e209d39SAndroid Build Coastguard Worker  * Gets the  country code for the specified locale.
443*0e209d39SAndroid Build Coastguard Worker  *
444*0e209d39SAndroid Build Coastguard Worker  * This function may return with a failure error code for certain kinds of inputs
445*0e209d39SAndroid Build Coastguard Worker  * but does not fully check for well-formed locale IDs / language tags.
446*0e209d39SAndroid Build Coastguard Worker  *
447*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the country code with
448*0e209d39SAndroid Build Coastguard Worker  * @param country the country code for localeID
449*0e209d39SAndroid Build Coastguard Worker  * @param countryCapacity the size of the country buffer to store the
450*0e209d39SAndroid Build Coastguard Worker  * country code with
451*0e209d39SAndroid Build Coastguard Worker  * @param err error information if retrieving the country code failed
452*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the country code.  If it's greater
453*0e209d39SAndroid Build Coastguard Worker  * than countryCapacity, the returned country code will be truncated.
454*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
455*0e209d39SAndroid Build Coastguard Worker  */
456*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
457*0e209d39SAndroid Build Coastguard Worker uloc_getCountry(const char*    localeID,
458*0e209d39SAndroid Build Coastguard Worker         char* country,
459*0e209d39SAndroid Build Coastguard Worker         int32_t countryCapacity,
460*0e209d39SAndroid Build Coastguard Worker         UErrorCode* err);
461*0e209d39SAndroid Build Coastguard Worker 
462*0e209d39SAndroid Build Coastguard Worker /**
463*0e209d39SAndroid Build Coastguard Worker  * Gets the variant code for the specified locale.
464*0e209d39SAndroid Build Coastguard Worker  *
465*0e209d39SAndroid Build Coastguard Worker  * This function may return with a failure error code for certain kinds of inputs
466*0e209d39SAndroid Build Coastguard Worker  * but does not fully check for well-formed locale IDs / language tags.
467*0e209d39SAndroid Build Coastguard Worker  *
468*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the variant code with
469*0e209d39SAndroid Build Coastguard Worker  * @param variant the variant code for localeID
470*0e209d39SAndroid Build Coastguard Worker  * @param variantCapacity the size of the variant buffer to store the
471*0e209d39SAndroid Build Coastguard Worker  * variant code with
472*0e209d39SAndroid Build Coastguard Worker  * @param err error information if retrieving the variant code failed
473*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the variant code.  If it's greater
474*0e209d39SAndroid Build Coastguard Worker  * than variantCapacity, the returned variant code will be truncated.
475*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
476*0e209d39SAndroid Build Coastguard Worker  */
477*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
478*0e209d39SAndroid Build Coastguard Worker uloc_getVariant(const char*    localeID,
479*0e209d39SAndroid Build Coastguard Worker         char* variant,
480*0e209d39SAndroid Build Coastguard Worker         int32_t variantCapacity,
481*0e209d39SAndroid Build Coastguard Worker         UErrorCode* err);
482*0e209d39SAndroid Build Coastguard Worker 
483*0e209d39SAndroid Build Coastguard Worker 
484*0e209d39SAndroid Build Coastguard Worker /**
485*0e209d39SAndroid Build Coastguard Worker  * Gets the full name for the specified locale.
486*0e209d39SAndroid Build Coastguard Worker  *
487*0e209d39SAndroid Build Coastguard Worker  * This function may return with a failure error code for certain kinds of inputs
488*0e209d39SAndroid Build Coastguard Worker  * but does not fully check for well-formed locale IDs / language tags.
489*0e209d39SAndroid Build Coastguard Worker  *
490*0e209d39SAndroid Build Coastguard Worker  * Note: This has the effect of 'canonicalizing' the ICU locale ID to
491*0e209d39SAndroid Build Coastguard Worker  * a certain extent. Upper and lower case are set as needed.
492*0e209d39SAndroid Build Coastguard Worker  * It does NOT map aliased names in any way.
493*0e209d39SAndroid Build Coastguard Worker  * See the top of this header file.
494*0e209d39SAndroid Build Coastguard Worker  * This API supports preflighting.
495*0e209d39SAndroid Build Coastguard Worker  *
496*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the full name with
497*0e209d39SAndroid Build Coastguard Worker  * @param name fill in buffer for the name without keywords.
498*0e209d39SAndroid Build Coastguard Worker  * @param nameCapacity capacity of the fill in buffer.
499*0e209d39SAndroid Build Coastguard Worker  * @param err error information if retrieving the full name failed
500*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the full name.  If it's greater
501*0e209d39SAndroid Build Coastguard Worker  * than nameCapacity, the returned full name will be truncated.
502*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
503*0e209d39SAndroid Build Coastguard Worker  */
504*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
505*0e209d39SAndroid Build Coastguard Worker uloc_getName(const char*    localeID,
506*0e209d39SAndroid Build Coastguard Worker          char* name,
507*0e209d39SAndroid Build Coastguard Worker          int32_t nameCapacity,
508*0e209d39SAndroid Build Coastguard Worker          UErrorCode* err);
509*0e209d39SAndroid Build Coastguard Worker 
510*0e209d39SAndroid Build Coastguard Worker /**
511*0e209d39SAndroid Build Coastguard Worker  * Gets the full name for the specified locale.
512*0e209d39SAndroid Build Coastguard Worker  * Note: This has the effect of 'canonicalizing' the string to
513*0e209d39SAndroid Build Coastguard Worker  * a certain extent. Upper and lower case are set as needed,
514*0e209d39SAndroid Build Coastguard Worker  * and if the components were in 'POSIX' format they are changed to
515*0e209d39SAndroid Build Coastguard Worker  * ICU format.  It does NOT map aliased names in any way.
516*0e209d39SAndroid Build Coastguard Worker  * See the top of this header file.
517*0e209d39SAndroid Build Coastguard Worker  *
518*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the full name with
519*0e209d39SAndroid Build Coastguard Worker  * @param name the full name for localeID
520*0e209d39SAndroid Build Coastguard Worker  * @param nameCapacity the size of the name buffer to store the
521*0e209d39SAndroid Build Coastguard Worker  * full name with
522*0e209d39SAndroid Build Coastguard Worker  * @param err error information if retrieving the full name failed
523*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the full name.  If it's greater
524*0e209d39SAndroid Build Coastguard Worker  * than nameCapacity, the returned full name will be truncated.
525*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
526*0e209d39SAndroid Build Coastguard Worker  */
527*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
528*0e209d39SAndroid Build Coastguard Worker uloc_canonicalize(const char*    localeID,
529*0e209d39SAndroid Build Coastguard Worker          char* name,
530*0e209d39SAndroid Build Coastguard Worker          int32_t nameCapacity,
531*0e209d39SAndroid Build Coastguard Worker          UErrorCode* err);
532*0e209d39SAndroid Build Coastguard Worker 
533*0e209d39SAndroid Build Coastguard Worker /**
534*0e209d39SAndroid Build Coastguard Worker  * Gets the ISO language code for the specified locale.
535*0e209d39SAndroid Build Coastguard Worker  *
536*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the ISO language code with
537*0e209d39SAndroid Build Coastguard Worker  * @return language the ISO language code for localeID
538*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
539*0e209d39SAndroid Build Coastguard Worker  */
540*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* U_EXPORT2
541*0e209d39SAndroid Build Coastguard Worker uloc_getISO3Language(const char* localeID);
542*0e209d39SAndroid Build Coastguard Worker 
543*0e209d39SAndroid Build Coastguard Worker 
544*0e209d39SAndroid Build Coastguard Worker /**
545*0e209d39SAndroid Build Coastguard Worker  * Gets the ISO country code for the specified locale.
546*0e209d39SAndroid Build Coastguard Worker  *
547*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the ISO country code with
548*0e209d39SAndroid Build Coastguard Worker  * @return country the ISO country code for localeID
549*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
550*0e209d39SAndroid Build Coastguard Worker  */
551*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* U_EXPORT2
552*0e209d39SAndroid Build Coastguard Worker uloc_getISO3Country(const char* localeID);
553*0e209d39SAndroid Build Coastguard Worker 
554*0e209d39SAndroid Build Coastguard Worker /**
555*0e209d39SAndroid Build Coastguard Worker  * Gets the Win32 LCID value for the specified locale.
556*0e209d39SAndroid Build Coastguard Worker  * If the ICU locale is not recognized by Windows, 0 will be returned.
557*0e209d39SAndroid Build Coastguard Worker  *
558*0e209d39SAndroid Build Coastguard Worker  * LCIDs were deprecated with Windows Vista and Microsoft recommends
559*0e209d39SAndroid Build Coastguard Worker  * that developers use BCP47 style tags instead (uloc_toLanguageTag).
560*0e209d39SAndroid Build Coastguard Worker  *
561*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the Win32 LCID value with
562*0e209d39SAndroid Build Coastguard Worker  * @return country the Win32 LCID for localeID
563*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
564*0e209d39SAndroid Build Coastguard Worker  */
565*0e209d39SAndroid Build Coastguard Worker U_CAPI uint32_t U_EXPORT2
566*0e209d39SAndroid Build Coastguard Worker uloc_getLCID(const char* localeID);
567*0e209d39SAndroid Build Coastguard Worker 
568*0e209d39SAndroid Build Coastguard Worker /**
569*0e209d39SAndroid Build Coastguard Worker  * Gets the language name suitable for display for the specified locale.
570*0e209d39SAndroid Build Coastguard Worker  *
571*0e209d39SAndroid Build Coastguard Worker  * @param locale the locale to get the ISO language code with
572*0e209d39SAndroid Build Coastguard Worker  * @param displayLocale Specifies the locale to be used to display the name. In
573*0e209d39SAndroid Build Coastguard Worker  *                 other words, if the locale's language code is "en", passing
574*0e209d39SAndroid Build Coastguard Worker  *                 Locale::getFrench() for inLocale would result in "Anglais",
575*0e209d39SAndroid Build Coastguard Worker  *                 while passing Locale::getGerman() for inLocale would result
576*0e209d39SAndroid Build Coastguard Worker  *                 in "Englisch".
577*0e209d39SAndroid Build Coastguard Worker  * @param language the displayable language code for localeID
578*0e209d39SAndroid Build Coastguard Worker  * @param languageCapacity the size of the language buffer to store the
579*0e209d39SAndroid Build Coastguard Worker  *                 displayable language code with.
580*0e209d39SAndroid Build Coastguard Worker  * @param status error information if retrieving the displayable language code
581*0e209d39SAndroid Build Coastguard Worker  *                 failed. U_USING_DEFAULT_WARNING indicates that no data was
582*0e209d39SAndroid Build Coastguard Worker  *                 found from the locale resources and a case canonicalized
583*0e209d39SAndroid Build Coastguard Worker  *                 language code is placed into language as fallback.
584*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the displayable language code. If
585*0e209d39SAndroid Build Coastguard Worker  *                 it's greater than languageCapacity, the returned language
586*0e209d39SAndroid Build Coastguard Worker  *                 code will be truncated.
587*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
588*0e209d39SAndroid Build Coastguard Worker  */
589*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
590*0e209d39SAndroid Build Coastguard Worker uloc_getDisplayLanguage(const char* locale,
591*0e209d39SAndroid Build Coastguard Worker             const char* displayLocale,
592*0e209d39SAndroid Build Coastguard Worker             UChar* language,
593*0e209d39SAndroid Build Coastguard Worker             int32_t languageCapacity,
594*0e209d39SAndroid Build Coastguard Worker             UErrorCode* status);
595*0e209d39SAndroid Build Coastguard Worker 
596*0e209d39SAndroid Build Coastguard Worker /**
597*0e209d39SAndroid Build Coastguard Worker  * Gets the script name suitable for display for the specified locale.
598*0e209d39SAndroid Build Coastguard Worker  *
599*0e209d39SAndroid Build Coastguard Worker  * @param locale the locale to get the displayable script code with. NULL may be
600*0e209d39SAndroid Build Coastguard Worker  *                 used to specify the default.
601*0e209d39SAndroid Build Coastguard Worker  * @param displayLocale Specifies the locale to be used to display the name. In
602*0e209d39SAndroid Build Coastguard Worker  *                 other words, if the locale's language code is "en", passing
603*0e209d39SAndroid Build Coastguard Worker  *                 Locale::getFrench() for inLocale would result in "", while
604*0e209d39SAndroid Build Coastguard Worker  *                 passing Locale::getGerman() for inLocale would result in "".
605*0e209d39SAndroid Build Coastguard Worker  *                 NULL may be used to specify the default.
606*0e209d39SAndroid Build Coastguard Worker  * @param script the displayable script for the localeID.
607*0e209d39SAndroid Build Coastguard Worker  * @param scriptCapacity the size of the script buffer to store the displayable
608*0e209d39SAndroid Build Coastguard Worker  *                 script code with.
609*0e209d39SAndroid Build Coastguard Worker  * @param status error information if retrieving the displayable script code
610*0e209d39SAndroid Build Coastguard Worker  *                 failed. U_USING_DEFAULT_WARNING indicates that no data was
611*0e209d39SAndroid Build Coastguard Worker  *                 found from the locale resources and a case canonicalized
612*0e209d39SAndroid Build Coastguard Worker  *                 script code is placed into script as fallback.
613*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the displayable script code. If
614*0e209d39SAndroid Build Coastguard Worker  *                 it's greater than scriptCapacity, the returned displayable
615*0e209d39SAndroid Build Coastguard Worker  *                 script code will be truncated.
616*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
617*0e209d39SAndroid Build Coastguard Worker  */
618*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
619*0e209d39SAndroid Build Coastguard Worker uloc_getDisplayScript(const char* locale,
620*0e209d39SAndroid Build Coastguard Worker             const char* displayLocale,
621*0e209d39SAndroid Build Coastguard Worker             UChar* script,
622*0e209d39SAndroid Build Coastguard Worker             int32_t scriptCapacity,
623*0e209d39SAndroid Build Coastguard Worker             UErrorCode* status);
624*0e209d39SAndroid Build Coastguard Worker 
625*0e209d39SAndroid Build Coastguard Worker /**
626*0e209d39SAndroid Build Coastguard Worker  * Gets the country name suitable for display for the specified locale.
627*0e209d39SAndroid Build Coastguard Worker  * Warning: this is for the region part of a valid locale ID; it cannot just be
628*0e209d39SAndroid Build Coastguard Worker  * the region code (like "FR"). To get the display name for a region alone, or
629*0e209d39SAndroid Build Coastguard Worker  * for other options, use ULocaleDisplayNames instead.
630*0e209d39SAndroid Build Coastguard Worker  *
631*0e209d39SAndroid Build Coastguard Worker  * @param locale the locale to get the displayable country code with. NULL may
632*0e209d39SAndroid Build Coastguard Worker  *                 be used to specify the default.
633*0e209d39SAndroid Build Coastguard Worker  * @param displayLocale Specifies the locale to be used to display the name. In
634*0e209d39SAndroid Build Coastguard Worker  *                 other words, if the locale's language code is "en", passing
635*0e209d39SAndroid Build Coastguard Worker  *                 Locale::getFrench() for inLocale would result in "Anglais",
636*0e209d39SAndroid Build Coastguard Worker  *                 while passing Locale::getGerman() for inLocale would result
637*0e209d39SAndroid Build Coastguard Worker  *                 in "Englisch". NULL may be used to specify the default.
638*0e209d39SAndroid Build Coastguard Worker  * @param country the displayable country code for localeID.
639*0e209d39SAndroid Build Coastguard Worker  * @param countryCapacity the size of the country buffer to store the
640*0e209d39SAndroid Build Coastguard Worker  *                 displayable country code with.
641*0e209d39SAndroid Build Coastguard Worker  * @param status error information if retrieving the displayable country code
642*0e209d39SAndroid Build Coastguard Worker  *                 failed. U_USING_DEFAULT_WARNING indicates that no data was
643*0e209d39SAndroid Build Coastguard Worker  *                 found from the locale resources and a case canonicalized
644*0e209d39SAndroid Build Coastguard Worker  *                 country code is placed into country as fallback.
645*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the displayable country code. If
646*0e209d39SAndroid Build Coastguard Worker  *                 it's greater than countryCapacity, the returned displayable
647*0e209d39SAndroid Build Coastguard Worker  *                 country code will be truncated.
648*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
649*0e209d39SAndroid Build Coastguard Worker  */
650*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
651*0e209d39SAndroid Build Coastguard Worker uloc_getDisplayCountry(const char* locale,
652*0e209d39SAndroid Build Coastguard Worker                        const char* displayLocale,
653*0e209d39SAndroid Build Coastguard Worker                        UChar* country,
654*0e209d39SAndroid Build Coastguard Worker                        int32_t countryCapacity,
655*0e209d39SAndroid Build Coastguard Worker                        UErrorCode* status);
656*0e209d39SAndroid Build Coastguard Worker 
657*0e209d39SAndroid Build Coastguard Worker 
658*0e209d39SAndroid Build Coastguard Worker /**
659*0e209d39SAndroid Build Coastguard Worker  * Gets the variant name suitable for display for the specified locale.
660*0e209d39SAndroid Build Coastguard Worker  *
661*0e209d39SAndroid Build Coastguard Worker  * @param locale the locale to get the displayable variant code with. NULL may
662*0e209d39SAndroid Build Coastguard Worker  *                 be used to specify the default.
663*0e209d39SAndroid Build Coastguard Worker  * @param displayLocale Specifies the locale to be used to display the name. In
664*0e209d39SAndroid Build Coastguard Worker  *                 other words, if the locale's language code is "en", passing
665*0e209d39SAndroid Build Coastguard Worker  *                 Locale::getFrench() for inLocale would result in "Anglais",
666*0e209d39SAndroid Build Coastguard Worker  *                 while passing Locale::getGerman() for inLocale would result
667*0e209d39SAndroid Build Coastguard Worker  *                 in "Englisch". NULL may be used to specify the default.
668*0e209d39SAndroid Build Coastguard Worker  * @param variant the displayable variant code for localeID.
669*0e209d39SAndroid Build Coastguard Worker  * @param variantCapacity the size of the variant buffer to store the
670*0e209d39SAndroid Build Coastguard Worker  *                 displayable variant code with.
671*0e209d39SAndroid Build Coastguard Worker  * @param status error information if retrieving the displayable variant code
672*0e209d39SAndroid Build Coastguard Worker  *                 failed. U_USING_DEFAULT_WARNING indicates that no data was
673*0e209d39SAndroid Build Coastguard Worker  *                 found from the locale resources and a case canonicalized
674*0e209d39SAndroid Build Coastguard Worker  *                 variant code is placed into variant as fallback.
675*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the displayable variant code. If
676*0e209d39SAndroid Build Coastguard Worker  *                 it's greater than variantCapacity, the returned displayable
677*0e209d39SAndroid Build Coastguard Worker  *                 variant code will be truncated.
678*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
679*0e209d39SAndroid Build Coastguard Worker  */
680*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
681*0e209d39SAndroid Build Coastguard Worker uloc_getDisplayVariant(const char* locale,
682*0e209d39SAndroid Build Coastguard Worker                        const char* displayLocale,
683*0e209d39SAndroid Build Coastguard Worker                        UChar* variant,
684*0e209d39SAndroid Build Coastguard Worker                        int32_t variantCapacity,
685*0e209d39SAndroid Build Coastguard Worker                        UErrorCode* status);
686*0e209d39SAndroid Build Coastguard Worker 
687*0e209d39SAndroid Build Coastguard Worker /**
688*0e209d39SAndroid Build Coastguard Worker  * Gets the keyword name suitable for display for the specified locale. E.g:
689*0e209d39SAndroid Build Coastguard Worker  * for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
690*0e209d39SAndroid Build Coastguard Worker  * string for the keyword collation.
691*0e209d39SAndroid Build Coastguard Worker  * Usage:
692*0e209d39SAndroid Build Coastguard Worker  * <code>
693*0e209d39SAndroid Build Coastguard Worker  *    UErrorCode status = U_ZERO_ERROR;
694*0e209d39SAndroid Build Coastguard Worker  *    const char* keyword =NULL;
695*0e209d39SAndroid Build Coastguard Worker  *    int32_t keywordLen = 0;
696*0e209d39SAndroid Build Coastguard Worker  *    int32_t keywordCount = 0;
697*0e209d39SAndroid Build Coastguard Worker  *    UChar displayKeyword[256];
698*0e209d39SAndroid Build Coastguard Worker  *    int32_t displayKeywordLen = 0;
699*0e209d39SAndroid Build Coastguard Worker  *    UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status);
700*0e209d39SAndroid Build Coastguard Worker  *    for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){
701*0e209d39SAndroid Build Coastguard Worker  *          if(U_FAILURE(status)){
702*0e209d39SAndroid Build Coastguard Worker  *              ...something went wrong so handle the error...
703*0e209d39SAndroid Build Coastguard Worker  *              break;
704*0e209d39SAndroid Build Coastguard Worker  *          }
705*0e209d39SAndroid Build Coastguard Worker  *          // the uenum_next returns NUL terminated string
706*0e209d39SAndroid Build Coastguard Worker  *          keyword = uenum_next(keywordEnum, &keywordLen, &status);
707*0e209d39SAndroid Build Coastguard Worker  *          displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256);
708*0e209d39SAndroid Build Coastguard Worker  *          ... do something interesting .....
709*0e209d39SAndroid Build Coastguard Worker  *    }
710*0e209d39SAndroid Build Coastguard Worker  *    uenum_close(keywordEnum);
711*0e209d39SAndroid Build Coastguard Worker  * </code>
712*0e209d39SAndroid Build Coastguard Worker  * @param keyword           The keyword whose display string needs to be returned.
713*0e209d39SAndroid Build Coastguard Worker  * @param displayLocale     Specifies the locale to be used to display the name.  In other words,
714*0e209d39SAndroid Build Coastguard Worker  *                          if the locale's language code is "en", passing Locale::getFrench() for
715*0e209d39SAndroid Build Coastguard Worker  *                          inLocale would result in "Anglais", while passing Locale::getGerman()
716*0e209d39SAndroid Build Coastguard Worker  *                          for inLocale would result in "Englisch". NULL may be used to specify the default.
717*0e209d39SAndroid Build Coastguard Worker  * @param dest              the buffer to which the displayable keyword should be written.
718*0e209d39SAndroid Build Coastguard Worker  * @param destCapacity      The size of the buffer (number of UChars). If it is 0, then
719*0e209d39SAndroid Build Coastguard Worker  *                          dest may be NULL and the function will only return the length of the
720*0e209d39SAndroid Build Coastguard Worker  *                          result without writing any of the result string (pre-flighting).
721*0e209d39SAndroid Build Coastguard Worker  * @param status            error information if retrieving the displayable string failed.
722*0e209d39SAndroid Build Coastguard Worker  *                          Should not be NULL and should not indicate failure on entry.
723*0e209d39SAndroid Build Coastguard Worker  *                          U_USING_DEFAULT_WARNING indicates that no data was found from the locale
724*0e209d39SAndroid Build Coastguard Worker  *                          resources and the keyword is placed into dest as fallback.
725*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the displayable variant code.
726*0e209d39SAndroid Build Coastguard Worker  * @see #uloc_openKeywords
727*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
728*0e209d39SAndroid Build Coastguard Worker  */
729*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
730*0e209d39SAndroid Build Coastguard Worker uloc_getDisplayKeyword(const char* keyword,
731*0e209d39SAndroid Build Coastguard Worker                        const char* displayLocale,
732*0e209d39SAndroid Build Coastguard Worker                        UChar* dest,
733*0e209d39SAndroid Build Coastguard Worker                        int32_t destCapacity,
734*0e209d39SAndroid Build Coastguard Worker                        UErrorCode* status);
735*0e209d39SAndroid Build Coastguard Worker /**
736*0e209d39SAndroid Build Coastguard Worker  * Gets the value of the keyword suitable for display for the specified locale.
737*0e209d39SAndroid Build Coastguard Worker  * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
738*0e209d39SAndroid Build Coastguard Worker  * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword.
739*0e209d39SAndroid Build Coastguard Worker  *
740*0e209d39SAndroid Build Coastguard Worker  * @param locale            The locale to get the displayable variant code with. NULL may be used to specify the default.
741*0e209d39SAndroid Build Coastguard Worker  * @param keyword           The keyword for whose value should be used.
742*0e209d39SAndroid Build Coastguard Worker  * @param displayLocale     Specifies the locale to be used to display the name.  In other words,
743*0e209d39SAndroid Build Coastguard Worker  *                          if the locale's language code is "en", passing Locale::getFrench() for
744*0e209d39SAndroid Build Coastguard Worker  *                          inLocale would result in "Anglais", while passing Locale::getGerman()
745*0e209d39SAndroid Build Coastguard Worker  *                          for inLocale would result in "Englisch". NULL may be used to specify the default.
746*0e209d39SAndroid Build Coastguard Worker  * @param dest              the buffer to which the displayable keyword should be written.
747*0e209d39SAndroid Build Coastguard Worker  * @param destCapacity      The size of the buffer (number of UChars). If it is 0, then
748*0e209d39SAndroid Build Coastguard Worker  *                          dest may be NULL and the function will only return the length of the
749*0e209d39SAndroid Build Coastguard Worker  *                          result without writing any of the result string (pre-flighting).
750*0e209d39SAndroid Build Coastguard Worker  * @param status            error information if retrieving the displayable string failed.
751*0e209d39SAndroid Build Coastguard Worker  *                          Should not be NULL and must not indicate failure on entry.
752*0e209d39SAndroid Build Coastguard Worker  *                          U_USING_DEFAULT_WARNING indicates that no data was found from the locale
753*0e209d39SAndroid Build Coastguard Worker  *                          resources and the value of the keyword is placed into dest as fallback.
754*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the displayable variant code.
755*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
756*0e209d39SAndroid Build Coastguard Worker  */
757*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
758*0e209d39SAndroid Build Coastguard Worker uloc_getDisplayKeywordValue(   const char* locale,
759*0e209d39SAndroid Build Coastguard Worker                                const char* keyword,
760*0e209d39SAndroid Build Coastguard Worker                                const char* displayLocale,
761*0e209d39SAndroid Build Coastguard Worker                                UChar* dest,
762*0e209d39SAndroid Build Coastguard Worker                                int32_t destCapacity,
763*0e209d39SAndroid Build Coastguard Worker                                UErrorCode* status);
764*0e209d39SAndroid Build Coastguard Worker /**
765*0e209d39SAndroid Build Coastguard Worker  * Gets the full name suitable for display for the specified locale.
766*0e209d39SAndroid Build Coastguard Worker  *
767*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the displayable name with. NULL may be used to specify the default.
768*0e209d39SAndroid Build Coastguard Worker  * @param inLocaleID Specifies the locale to be used to display the name.  In other words,
769*0e209d39SAndroid Build Coastguard Worker  *                   if the locale's language code is "en", passing Locale::getFrench() for
770*0e209d39SAndroid Build Coastguard Worker  *                   inLocale would result in "Anglais", while passing Locale::getGerman()
771*0e209d39SAndroid Build Coastguard Worker  *                   for inLocale would result in "Englisch". NULL may be used to specify the default.
772*0e209d39SAndroid Build Coastguard Worker  * @param result the displayable name for localeID
773*0e209d39SAndroid Build Coastguard Worker  * @param maxResultSize the size of the name buffer to store the
774*0e209d39SAndroid Build Coastguard Worker  * displayable full name with
775*0e209d39SAndroid Build Coastguard Worker  * @param err error information if retrieving the displayable name failed
776*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the displayable name.  If it's greater
777*0e209d39SAndroid Build Coastguard Worker  * than maxResultSize, the returned displayable name will be truncated.
778*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
779*0e209d39SAndroid Build Coastguard Worker  */
780*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
781*0e209d39SAndroid Build Coastguard Worker uloc_getDisplayName(const char* localeID,
782*0e209d39SAndroid Build Coastguard Worker             const char* inLocaleID,
783*0e209d39SAndroid Build Coastguard Worker             UChar* result,
784*0e209d39SAndroid Build Coastguard Worker             int32_t maxResultSize,
785*0e209d39SAndroid Build Coastguard Worker             UErrorCode* err);
786*0e209d39SAndroid Build Coastguard Worker 
787*0e209d39SAndroid Build Coastguard Worker 
788*0e209d39SAndroid Build Coastguard Worker /**
789*0e209d39SAndroid Build Coastguard Worker  * Gets the specified locale from a list of available locales.
790*0e209d39SAndroid Build Coastguard Worker  *
791*0e209d39SAndroid Build Coastguard Worker  * This method corresponds to uloc_openAvailableByType called with the
792*0e209d39SAndroid Build Coastguard Worker  * ULOC_AVAILABLE_DEFAULT type argument.
793*0e209d39SAndroid Build Coastguard Worker  *
794*0e209d39SAndroid Build Coastguard Worker  * The return value is a pointer to an item of a locale name array. Both this
795*0e209d39SAndroid Build Coastguard Worker  * array and the pointers it contains are owned by ICU and should not be
796*0e209d39SAndroid Build Coastguard Worker  * deleted or written through by the caller. The locale name is terminated by
797*0e209d39SAndroid Build Coastguard Worker  * a null pointer.
798*0e209d39SAndroid Build Coastguard Worker  *
799*0e209d39SAndroid Build Coastguard Worker  * @param n the specific locale name index of the available locale list;
800*0e209d39SAndroid Build Coastguard Worker  *     should not exceed the number returned by uloc_countAvailable.
801*0e209d39SAndroid Build Coastguard Worker  * @return a specified locale name of all available locales
802*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
803*0e209d39SAndroid Build Coastguard Worker  */
804*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* U_EXPORT2
805*0e209d39SAndroid Build Coastguard Worker uloc_getAvailable(int32_t n);
806*0e209d39SAndroid Build Coastguard Worker 
807*0e209d39SAndroid Build Coastguard Worker /**
808*0e209d39SAndroid Build Coastguard Worker  * Gets the size of the all available locale list.
809*0e209d39SAndroid Build Coastguard Worker  *
810*0e209d39SAndroid Build Coastguard Worker  * @return the size of the locale list
811*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
812*0e209d39SAndroid Build Coastguard Worker  */
813*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2 uloc_countAvailable(void);
814*0e209d39SAndroid Build Coastguard Worker 
815*0e209d39SAndroid Build Coastguard Worker /**
816*0e209d39SAndroid Build Coastguard Worker  * Types for uloc_getAvailableByType and uloc_countAvailableByType.
817*0e209d39SAndroid Build Coastguard Worker  *
818*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 65
819*0e209d39SAndroid Build Coastguard Worker  */
820*0e209d39SAndroid Build Coastguard Worker typedef enum ULocAvailableType {
821*0e209d39SAndroid Build Coastguard Worker   /**
822*0e209d39SAndroid Build Coastguard Worker    * Locales that return data when passed to ICU APIs,
823*0e209d39SAndroid Build Coastguard Worker    * but not including legacy or alias locales.
824*0e209d39SAndroid Build Coastguard Worker    *
825*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 65
826*0e209d39SAndroid Build Coastguard Worker    */
827*0e209d39SAndroid Build Coastguard Worker   ULOC_AVAILABLE_DEFAULT,
828*0e209d39SAndroid Build Coastguard Worker 
829*0e209d39SAndroid Build Coastguard Worker   /**
830*0e209d39SAndroid Build Coastguard Worker    * Legacy or alias locales that return data when passed to ICU APIs.
831*0e209d39SAndroid Build Coastguard Worker    * Examples of supported legacy or alias locales:
832*0e209d39SAndroid Build Coastguard Worker    *
833*0e209d39SAndroid Build Coastguard Worker    * - iw (alias to he)
834*0e209d39SAndroid Build Coastguard Worker    * - mo (alias to ro)
835*0e209d39SAndroid Build Coastguard Worker    * - zh_CN (alias to zh_Hans_CN)
836*0e209d39SAndroid Build Coastguard Worker    * - sr_BA (alias to sr_Cyrl_BA)
837*0e209d39SAndroid Build Coastguard Worker    * - ars (alias to ar_SA)
838*0e209d39SAndroid Build Coastguard Worker    *
839*0e209d39SAndroid Build Coastguard Worker    * The locales in this set are disjoint from the ones in
840*0e209d39SAndroid Build Coastguard Worker    * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use
841*0e209d39SAndroid Build Coastguard Worker    * ULOC_AVAILABLE_WITH_LEGACY_ALIASES.
842*0e209d39SAndroid Build Coastguard Worker    *
843*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 65
844*0e209d39SAndroid Build Coastguard Worker    */
845*0e209d39SAndroid Build Coastguard Worker   ULOC_AVAILABLE_ONLY_LEGACY_ALIASES,
846*0e209d39SAndroid Build Coastguard Worker 
847*0e209d39SAndroid Build Coastguard Worker   /**
848*0e209d39SAndroid Build Coastguard Worker    * The union of the locales in ULOC_AVAILABLE_DEFAULT and
849*0e209d39SAndroid Build Coastguard Worker    * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS.
850*0e209d39SAndroid Build Coastguard Worker    *
851*0e209d39SAndroid Build Coastguard Worker    * @stable ICU 65
852*0e209d39SAndroid Build Coastguard Worker    */
853*0e209d39SAndroid Build Coastguard Worker   ULOC_AVAILABLE_WITH_LEGACY_ALIASES,
854*0e209d39SAndroid Build Coastguard Worker 
855*0e209d39SAndroid Build Coastguard Worker #ifndef U_HIDE_INTERNAL_API
856*0e209d39SAndroid Build Coastguard Worker   /**
857*0e209d39SAndroid Build Coastguard Worker    * @internal
858*0e209d39SAndroid Build Coastguard Worker    */
859*0e209d39SAndroid Build Coastguard Worker   ULOC_AVAILABLE_COUNT
860*0e209d39SAndroid Build Coastguard Worker #endif  /* U_HIDE_INTERNAL_API */
861*0e209d39SAndroid Build Coastguard Worker } ULocAvailableType;
862*0e209d39SAndroid Build Coastguard Worker 
863*0e209d39SAndroid Build Coastguard Worker /**
864*0e209d39SAndroid Build Coastguard Worker  * Gets a list of available locales according to the type argument, allowing
865*0e209d39SAndroid Build Coastguard Worker  * the user to access different sets of supported locales in ICU.
866*0e209d39SAndroid Build Coastguard Worker  *
867*0e209d39SAndroid Build Coastguard Worker  * The returned UEnumeration must be closed by the caller.
868*0e209d39SAndroid Build Coastguard Worker  *
869*0e209d39SAndroid Build Coastguard Worker  * @param type Type choice from ULocAvailableType.
870*0e209d39SAndroid Build Coastguard Worker  * @param status Set if an error occurred.
871*0e209d39SAndroid Build Coastguard Worker  * @return a UEnumeration owned by the caller, or nullptr on failure.
872*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 65
873*0e209d39SAndroid Build Coastguard Worker  */
874*0e209d39SAndroid Build Coastguard Worker U_CAPI UEnumeration* U_EXPORT2
875*0e209d39SAndroid Build Coastguard Worker uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status);
876*0e209d39SAndroid Build Coastguard Worker 
877*0e209d39SAndroid Build Coastguard Worker /**
878*0e209d39SAndroid Build Coastguard Worker  *
879*0e209d39SAndroid Build Coastguard Worker  * Gets a list of all available 2-letter language codes defined in ISO 639,
880*0e209d39SAndroid Build Coastguard Worker  * plus additional 3-letter codes determined to be useful for locale generation as
881*0e209d39SAndroid Build Coastguard Worker  * defined by Unicode CLDR. This is a pointer
882*0e209d39SAndroid Build Coastguard Worker  * to an array of pointers to arrays of char.  All of these pointers are owned
883*0e209d39SAndroid Build Coastguard Worker  * by ICU-- do not delete them, and do not write through them.  The array is
884*0e209d39SAndroid Build Coastguard Worker  * terminated with a null pointer.
885*0e209d39SAndroid Build Coastguard Worker  * @return a list of all available language codes
886*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
887*0e209d39SAndroid Build Coastguard Worker  */
888*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* const* U_EXPORT2
889*0e209d39SAndroid Build Coastguard Worker uloc_getISOLanguages(void);
890*0e209d39SAndroid Build Coastguard Worker 
891*0e209d39SAndroid Build Coastguard Worker /**
892*0e209d39SAndroid Build Coastguard Worker  *
893*0e209d39SAndroid Build Coastguard Worker  * Gets a list of all available 2-letter country codes defined in ISO 639.  This is a
894*0e209d39SAndroid Build Coastguard Worker  * pointer to an array of pointers to arrays of char.  All of these pointers are
895*0e209d39SAndroid Build Coastguard Worker  * owned by ICU-- do not delete them, and do not write through them.  The array is
896*0e209d39SAndroid Build Coastguard Worker  * terminated with a null pointer.
897*0e209d39SAndroid Build Coastguard Worker  * @return a list of all available country codes
898*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
899*0e209d39SAndroid Build Coastguard Worker  */
900*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* const* U_EXPORT2
901*0e209d39SAndroid Build Coastguard Worker uloc_getISOCountries(void);
902*0e209d39SAndroid Build Coastguard Worker 
903*0e209d39SAndroid Build Coastguard Worker /**
904*0e209d39SAndroid Build Coastguard Worker  * Truncate the locale ID string to get the parent locale ID.
905*0e209d39SAndroid Build Coastguard Worker  * Copies the part of the string before the last underscore.
906*0e209d39SAndroid Build Coastguard Worker  * The parent locale ID will be an empty string if there is no
907*0e209d39SAndroid Build Coastguard Worker  * underscore, or if there is only one underscore at localeID[0].
908*0e209d39SAndroid Build Coastguard Worker  *
909*0e209d39SAndroid Build Coastguard Worker  * @param localeID Input locale ID string.
910*0e209d39SAndroid Build Coastguard Worker  * @param parent   Output string buffer for the parent locale ID.
911*0e209d39SAndroid Build Coastguard Worker  * @param parentCapacity Size of the output buffer.
912*0e209d39SAndroid Build Coastguard Worker  * @param err A UErrorCode value.
913*0e209d39SAndroid Build Coastguard Worker  * @return The length of the parent locale ID.
914*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.0
915*0e209d39SAndroid Build Coastguard Worker  */
916*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
917*0e209d39SAndroid Build Coastguard Worker uloc_getParent(const char*    localeID,
918*0e209d39SAndroid Build Coastguard Worker                  char* parent,
919*0e209d39SAndroid Build Coastguard Worker                  int32_t parentCapacity,
920*0e209d39SAndroid Build Coastguard Worker                  UErrorCode* err);
921*0e209d39SAndroid Build Coastguard Worker 
922*0e209d39SAndroid Build Coastguard Worker 
923*0e209d39SAndroid Build Coastguard Worker 
924*0e209d39SAndroid Build Coastguard Worker 
925*0e209d39SAndroid Build Coastguard Worker /**
926*0e209d39SAndroid Build Coastguard Worker  * Gets the full name for the specified locale, like uloc_getName(),
927*0e209d39SAndroid Build Coastguard Worker  * but without keywords.
928*0e209d39SAndroid Build Coastguard Worker  *
929*0e209d39SAndroid Build Coastguard Worker  * Note: This has the effect of 'canonicalizing' the string to
930*0e209d39SAndroid Build Coastguard Worker  * a certain extent. Upper and lower case are set as needed,
931*0e209d39SAndroid Build Coastguard Worker  * and if the components were in 'POSIX' format they are changed to
932*0e209d39SAndroid Build Coastguard Worker  * ICU format.  It does NOT map aliased names in any way.
933*0e209d39SAndroid Build Coastguard Worker  * See the top of this header file.
934*0e209d39SAndroid Build Coastguard Worker  *
935*0e209d39SAndroid Build Coastguard Worker  * This API strips off the keyword part, so "de_DE\@collation=phonebook"
936*0e209d39SAndroid Build Coastguard Worker  * will become "de_DE".
937*0e209d39SAndroid Build Coastguard Worker  * This API supports preflighting.
938*0e209d39SAndroid Build Coastguard Worker  *
939*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the full name with
940*0e209d39SAndroid Build Coastguard Worker  * @param name fill in buffer for the name without keywords.
941*0e209d39SAndroid Build Coastguard Worker  * @param nameCapacity capacity of the fill in buffer.
942*0e209d39SAndroid Build Coastguard Worker  * @param err error information if retrieving the full name failed
943*0e209d39SAndroid Build Coastguard Worker  * @return the actual buffer size needed for the full name.  If it's greater
944*0e209d39SAndroid Build Coastguard Worker  * than nameCapacity, the returned full name will be truncated.
945*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
946*0e209d39SAndroid Build Coastguard Worker  */
947*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
948*0e209d39SAndroid Build Coastguard Worker uloc_getBaseName(const char*    localeID,
949*0e209d39SAndroid Build Coastguard Worker          char* name,
950*0e209d39SAndroid Build Coastguard Worker          int32_t nameCapacity,
951*0e209d39SAndroid Build Coastguard Worker          UErrorCode* err);
952*0e209d39SAndroid Build Coastguard Worker 
953*0e209d39SAndroid Build Coastguard Worker /**
954*0e209d39SAndroid Build Coastguard Worker  * Gets an enumeration of keywords for the specified locale. Enumeration
955*0e209d39SAndroid Build Coastguard Worker  * must get disposed of by the client using uenum_close function.
956*0e209d39SAndroid Build Coastguard Worker  *
957*0e209d39SAndroid Build Coastguard Worker  * @param localeID the locale to get the variant code with
958*0e209d39SAndroid Build Coastguard Worker  * @param status error information if retrieving the keywords failed
959*0e209d39SAndroid Build Coastguard Worker  * @return enumeration of keywords or NULL if there are no keywords.
960*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
961*0e209d39SAndroid Build Coastguard Worker  */
962*0e209d39SAndroid Build Coastguard Worker U_CAPI UEnumeration* U_EXPORT2
963*0e209d39SAndroid Build Coastguard Worker uloc_openKeywords(const char* localeID,
964*0e209d39SAndroid Build Coastguard Worker                         UErrorCode* status);
965*0e209d39SAndroid Build Coastguard Worker 
966*0e209d39SAndroid Build Coastguard Worker /**
967*0e209d39SAndroid Build Coastguard Worker  * Get the value for a keyword. Locale name does not need to be normalized.
968*0e209d39SAndroid Build Coastguard Worker  *
969*0e209d39SAndroid Build Coastguard Worker  * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK")
970*0e209d39SAndroid Build Coastguard Worker  * @param keywordName name of the keyword for which we want the value; must not be
971*0e209d39SAndroid Build Coastguard Worker  *  NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
972*0e209d39SAndroid Build Coastguard Worker  * @param buffer receiving buffer
973*0e209d39SAndroid Build Coastguard Worker  * @param bufferCapacity capacity of receiving buffer
974*0e209d39SAndroid Build Coastguard Worker  * @param status containing error code: e.g. buffer not big enough or ill-formed localeID
975*0e209d39SAndroid Build Coastguard Worker  *  or keywordName parameters.
976*0e209d39SAndroid Build Coastguard Worker  * @return the length of keyword value
977*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 2.8
978*0e209d39SAndroid Build Coastguard Worker  */
979*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
980*0e209d39SAndroid Build Coastguard Worker uloc_getKeywordValue(const char* localeID,
981*0e209d39SAndroid Build Coastguard Worker                      const char* keywordName,
982*0e209d39SAndroid Build Coastguard Worker                      char* buffer, int32_t bufferCapacity,
983*0e209d39SAndroid Build Coastguard Worker                      UErrorCode* status);
984*0e209d39SAndroid Build Coastguard Worker 
985*0e209d39SAndroid Build Coastguard Worker 
986*0e209d39SAndroid Build Coastguard Worker /**
987*0e209d39SAndroid Build Coastguard Worker  * Sets or removes the value of the specified keyword.
988*0e209d39SAndroid Build Coastguard Worker  *
989*0e209d39SAndroid Build Coastguard Worker  * For removing all keywords, use uloc_getBaseName().
990*0e209d39SAndroid Build Coastguard Worker  *
991*0e209d39SAndroid Build Coastguard Worker  * NOTE: Unlike almost every other ICU function which takes a
992*0e209d39SAndroid Build Coastguard Worker  * buffer, this function will NOT truncate the output text, and will
993*0e209d39SAndroid Build Coastguard Worker  * not update the buffer with unterminated text setting a status of
994*0e209d39SAndroid Build Coastguard Worker  * U_STRING_NOT_TERMINATED_WARNING. If a BUFFER_OVERFLOW_ERROR is received,
995*0e209d39SAndroid Build Coastguard Worker  * it means a terminated version of the updated locale ID would not fit
996*0e209d39SAndroid Build Coastguard Worker  * in the buffer, and the original buffer is untouched. This is done to
997*0e209d39SAndroid Build Coastguard Worker  * prevent incorrect or possibly even malformed locales from being generated
998*0e209d39SAndroid Build Coastguard Worker  * and used.
999*0e209d39SAndroid Build Coastguard Worker  *
1000*0e209d39SAndroid Build Coastguard Worker  * @param keywordName name of the keyword to be set; must not be
1001*0e209d39SAndroid Build Coastguard Worker  *  NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
1002*0e209d39SAndroid Build Coastguard Worker  * @param keywordValue value of the keyword to be set. If 0-length or
1003*0e209d39SAndroid Build Coastguard Worker  *  NULL, will result in the keyword being removed; no error is given if
1004*0e209d39SAndroid Build Coastguard Worker  *  that keyword does not exist. Otherwise, must consist only of
1005*0e209d39SAndroid Build Coastguard Worker  *  [A-Za-z0-9] and [/_+-].
1006*0e209d39SAndroid Build Coastguard Worker  * @param buffer input buffer containing well-formed locale ID to be
1007*0e209d39SAndroid Build Coastguard Worker  *  modified.
1008*0e209d39SAndroid Build Coastguard Worker  * @param bufferCapacity capacity of receiving buffer
1009*0e209d39SAndroid Build Coastguard Worker  * @param status containing error code: e.g. buffer not big enough
1010*0e209d39SAndroid Build Coastguard Worker  *  or ill-formed keywordName or keywordValue parameters, or ill-formed
1011*0e209d39SAndroid Build Coastguard Worker  *  locale ID in buffer on input.
1012*0e209d39SAndroid Build Coastguard Worker  * @return the length needed for the buffer
1013*0e209d39SAndroid Build Coastguard Worker  * @see uloc_getKeywordValue
1014*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.2
1015*0e209d39SAndroid Build Coastguard Worker  */
1016*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
1017*0e209d39SAndroid Build Coastguard Worker uloc_setKeywordValue(const char* keywordName,
1018*0e209d39SAndroid Build Coastguard Worker                      const char* keywordValue,
1019*0e209d39SAndroid Build Coastguard Worker                      char* buffer, int32_t bufferCapacity,
1020*0e209d39SAndroid Build Coastguard Worker                      UErrorCode* status);
1021*0e209d39SAndroid Build Coastguard Worker 
1022*0e209d39SAndroid Build Coastguard Worker /**
1023*0e209d39SAndroid Build Coastguard Worker  * Returns whether the locale's script is written right-to-left.
1024*0e209d39SAndroid Build Coastguard Worker  * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags().
1025*0e209d39SAndroid Build Coastguard Worker  * If no likely script is known, then false is returned.
1026*0e209d39SAndroid Build Coastguard Worker  *
1027*0e209d39SAndroid Build Coastguard Worker  * A script is right-to-left according to the CLDR script metadata
1028*0e209d39SAndroid Build Coastguard Worker  * which corresponds to whether the script's letters have Bidi_Class=R or AL.
1029*0e209d39SAndroid Build Coastguard Worker  *
1030*0e209d39SAndroid Build Coastguard Worker  * Returns true for "ar" and "en-Hebr", false for "zh" and "fa-Cyrl".
1031*0e209d39SAndroid Build Coastguard Worker  *
1032*0e209d39SAndroid Build Coastguard Worker  * @param locale input locale ID
1033*0e209d39SAndroid Build Coastguard Worker  * @return true if the locale's script is written right-to-left
1034*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 54
1035*0e209d39SAndroid Build Coastguard Worker  */
1036*0e209d39SAndroid Build Coastguard Worker U_CAPI UBool U_EXPORT2
1037*0e209d39SAndroid Build Coastguard Worker uloc_isRightToLeft(const char *locale);
1038*0e209d39SAndroid Build Coastguard Worker 
1039*0e209d39SAndroid Build Coastguard Worker /**
1040*0e209d39SAndroid Build Coastguard Worker  * enums for the  return value for the character and line orientation
1041*0e209d39SAndroid Build Coastguard Worker  * functions.
1042*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.0
1043*0e209d39SAndroid Build Coastguard Worker  */
1044*0e209d39SAndroid Build Coastguard Worker typedef enum {
1045*0e209d39SAndroid Build Coastguard Worker   ULOC_LAYOUT_LTR   = 0,  /* left-to-right. */
1046*0e209d39SAndroid Build Coastguard Worker   ULOC_LAYOUT_RTL    = 1,  /* right-to-left. */
1047*0e209d39SAndroid Build Coastguard Worker   ULOC_LAYOUT_TTB    = 2,  /* top-to-bottom. */
1048*0e209d39SAndroid Build Coastguard Worker   ULOC_LAYOUT_BTT    = 3,   /* bottom-to-top. */
1049*0e209d39SAndroid Build Coastguard Worker   ULOC_LAYOUT_UNKNOWN
1050*0e209d39SAndroid Build Coastguard Worker } ULayoutType;
1051*0e209d39SAndroid Build Coastguard Worker 
1052*0e209d39SAndroid Build Coastguard Worker /**
1053*0e209d39SAndroid Build Coastguard Worker  * Get the layout character orientation for the specified locale.
1054*0e209d39SAndroid Build Coastguard Worker  *
1055*0e209d39SAndroid Build Coastguard Worker  * @param localeId locale name
1056*0e209d39SAndroid Build Coastguard Worker  * @param status Error status
1057*0e209d39SAndroid Build Coastguard Worker  * @return an enum indicating the layout orientation for characters.
1058*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.0
1059*0e209d39SAndroid Build Coastguard Worker  */
1060*0e209d39SAndroid Build Coastguard Worker U_CAPI ULayoutType U_EXPORT2
1061*0e209d39SAndroid Build Coastguard Worker uloc_getCharacterOrientation(const char* localeId,
1062*0e209d39SAndroid Build Coastguard Worker                              UErrorCode *status);
1063*0e209d39SAndroid Build Coastguard Worker 
1064*0e209d39SAndroid Build Coastguard Worker /**
1065*0e209d39SAndroid Build Coastguard Worker  * Get the layout line orientation for the specified locale.
1066*0e209d39SAndroid Build Coastguard Worker  *
1067*0e209d39SAndroid Build Coastguard Worker  * @param localeId locale name
1068*0e209d39SAndroid Build Coastguard Worker  * @param status Error status
1069*0e209d39SAndroid Build Coastguard Worker  * @return an enum indicating the layout orientation for lines.
1070*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.0
1071*0e209d39SAndroid Build Coastguard Worker  */
1072*0e209d39SAndroid Build Coastguard Worker U_CAPI ULayoutType U_EXPORT2
1073*0e209d39SAndroid Build Coastguard Worker uloc_getLineOrientation(const char* localeId,
1074*0e209d39SAndroid Build Coastguard Worker                         UErrorCode *status);
1075*0e209d39SAndroid Build Coastguard Worker 
1076*0e209d39SAndroid Build Coastguard Worker /**
1077*0e209d39SAndroid Build Coastguard Worker  * Output values which uloc_acceptLanguage() writes to the 'outResult' parameter.
1078*0e209d39SAndroid Build Coastguard Worker  *
1079*0e209d39SAndroid Build Coastguard Worker  * @see uloc_acceptLanguageFromHTTP
1080*0e209d39SAndroid Build Coastguard Worker  * @see uloc_acceptLanguage
1081*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.2
1082*0e209d39SAndroid Build Coastguard Worker  */
1083*0e209d39SAndroid Build Coastguard Worker typedef enum {
1084*0e209d39SAndroid Build Coastguard Worker     /**
1085*0e209d39SAndroid Build Coastguard Worker      * No exact match was found.
1086*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.2
1087*0e209d39SAndroid Build Coastguard Worker      */
1088*0e209d39SAndroid Build Coastguard Worker     ULOC_ACCEPT_FAILED   = 0,
1089*0e209d39SAndroid Build Coastguard Worker     /**
1090*0e209d39SAndroid Build Coastguard Worker      * An exact match was found.
1091*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.2
1092*0e209d39SAndroid Build Coastguard Worker      */
1093*0e209d39SAndroid Build Coastguard Worker     ULOC_ACCEPT_VALID    = 1,
1094*0e209d39SAndroid Build Coastguard Worker     /**
1095*0e209d39SAndroid Build Coastguard Worker      * A fallback was found. For example, the Accept-Language list includes 'ja_JP'
1096*0e209d39SAndroid Build Coastguard Worker      * and is matched with available locale 'ja'.
1097*0e209d39SAndroid Build Coastguard Worker      * @stable ICU 3.2
1098*0e209d39SAndroid Build Coastguard Worker      */
1099*0e209d39SAndroid Build Coastguard Worker     ULOC_ACCEPT_FALLBACK = 2   /*  */
1100*0e209d39SAndroid Build Coastguard Worker } UAcceptResult;
1101*0e209d39SAndroid Build Coastguard Worker 
1102*0e209d39SAndroid Build Coastguard Worker /**
1103*0e209d39SAndroid Build Coastguard Worker  * Based on a HTTP header from a web browser and a list of available locales,
1104*0e209d39SAndroid Build Coastguard Worker  * determine an acceptable locale for the user.
1105*0e209d39SAndroid Build Coastguard Worker  *
1106*0e209d39SAndroid Build Coastguard Worker  * This is a thin wrapper over C++ class LocaleMatcher.
1107*0e209d39SAndroid Build Coastguard Worker  *
1108*0e209d39SAndroid Build Coastguard Worker  * @param result - buffer to accept the result locale
1109*0e209d39SAndroid Build Coastguard Worker  * @param resultAvailable the size of the result buffer.
1110*0e209d39SAndroid Build Coastguard Worker  * @param outResult - An out parameter that contains the fallback status
1111*0e209d39SAndroid Build Coastguard Worker  * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP.
1112*0e209d39SAndroid Build Coastguard Worker  * @param availableLocales - list of available locales to match
1113*0e209d39SAndroid Build Coastguard Worker  * @param status ICU error code. Its input value must pass the U_SUCCESS() test,
1114*0e209d39SAndroid Build Coastguard Worker  *               or else the function returns immediately. Check for U_FAILURE()
1115*0e209d39SAndroid Build Coastguard Worker  *               on output or use with function chaining. (See User Guide for details.)
1116*0e209d39SAndroid Build Coastguard Worker  * @return length needed for the locale.
1117*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.2
1118*0e209d39SAndroid Build Coastguard Worker  */
1119*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
1120*0e209d39SAndroid Build Coastguard Worker uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
1121*0e209d39SAndroid Build Coastguard Worker                             UAcceptResult *outResult,
1122*0e209d39SAndroid Build Coastguard Worker                             const char *httpAcceptLanguage,
1123*0e209d39SAndroid Build Coastguard Worker                             UEnumeration* availableLocales,
1124*0e209d39SAndroid Build Coastguard Worker                             UErrorCode *status);
1125*0e209d39SAndroid Build Coastguard Worker 
1126*0e209d39SAndroid Build Coastguard Worker /**
1127*0e209d39SAndroid Build Coastguard Worker  * Based on a list of available locales,
1128*0e209d39SAndroid Build Coastguard Worker  * determine an acceptable locale for the user.
1129*0e209d39SAndroid Build Coastguard Worker  *
1130*0e209d39SAndroid Build Coastguard Worker  * This is a thin wrapper over C++ class LocaleMatcher.
1131*0e209d39SAndroid Build Coastguard Worker  *
1132*0e209d39SAndroid Build Coastguard Worker  * @param result - buffer to accept the result locale
1133*0e209d39SAndroid Build Coastguard Worker  * @param resultAvailable the size of the result buffer.
1134*0e209d39SAndroid Build Coastguard Worker  * @param outResult - An out parameter that contains the fallback status
1135*0e209d39SAndroid Build Coastguard Worker  * @param acceptList - list of acceptable languages
1136*0e209d39SAndroid Build Coastguard Worker  * @param acceptListCount - count of acceptList items
1137*0e209d39SAndroid Build Coastguard Worker  * @param availableLocales - list of available locales to match
1138*0e209d39SAndroid Build Coastguard Worker  * @param status ICU error code. Its input value must pass the U_SUCCESS() test,
1139*0e209d39SAndroid Build Coastguard Worker  *               or else the function returns immediately. Check for U_FAILURE()
1140*0e209d39SAndroid Build Coastguard Worker  *               on output or use with function chaining. (See User Guide for details.)
1141*0e209d39SAndroid Build Coastguard Worker  * @return length needed for the locale.
1142*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.2
1143*0e209d39SAndroid Build Coastguard Worker  */
1144*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
1145*0e209d39SAndroid Build Coastguard Worker uloc_acceptLanguage(char *result, int32_t resultAvailable,
1146*0e209d39SAndroid Build Coastguard Worker                     UAcceptResult *outResult, const char **acceptList,
1147*0e209d39SAndroid Build Coastguard Worker                     int32_t acceptListCount,
1148*0e209d39SAndroid Build Coastguard Worker                     UEnumeration* availableLocales,
1149*0e209d39SAndroid Build Coastguard Worker                     UErrorCode *status);
1150*0e209d39SAndroid Build Coastguard Worker 
1151*0e209d39SAndroid Build Coastguard Worker 
1152*0e209d39SAndroid Build Coastguard Worker /**
1153*0e209d39SAndroid Build Coastguard Worker  * Gets the ICU locale ID for the specified Win32 LCID value.
1154*0e209d39SAndroid Build Coastguard Worker  *
1155*0e209d39SAndroid Build Coastguard Worker  * @param hostID the Win32 LCID to translate
1156*0e209d39SAndroid Build Coastguard Worker  * @param locale the output buffer for the ICU locale ID, which will be NUL-terminated
1157*0e209d39SAndroid Build Coastguard Worker  *  if there is room.
1158*0e209d39SAndroid Build Coastguard Worker  * @param localeCapacity the size of the output buffer
1159*0e209d39SAndroid Build Coastguard Worker  * @param status an error is returned if the LCID is unrecognized or the output buffer
1160*0e209d39SAndroid Build Coastguard Worker  *  is too small
1161*0e209d39SAndroid Build Coastguard Worker  * @return actual the actual size of the locale ID, not including NUL-termination
1162*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 3.8
1163*0e209d39SAndroid Build Coastguard Worker  */
1164*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
1165*0e209d39SAndroid Build Coastguard Worker uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
1166*0e209d39SAndroid Build Coastguard Worker                     UErrorCode *status);
1167*0e209d39SAndroid Build Coastguard Worker 
1168*0e209d39SAndroid Build Coastguard Worker 
1169*0e209d39SAndroid Build Coastguard Worker /**
1170*0e209d39SAndroid Build Coastguard Worker  * Add the likely subtags for a provided locale ID, per the algorithm described
1171*0e209d39SAndroid Build Coastguard Worker  * in the following CLDR technical report:
1172*0e209d39SAndroid Build Coastguard Worker  *
1173*0e209d39SAndroid Build Coastguard Worker  *   http://www.unicode.org/reports/tr35/#Likely_Subtags
1174*0e209d39SAndroid Build Coastguard Worker  *
1175*0e209d39SAndroid Build Coastguard Worker  * If localeID is already in the maximal form, or there is no data available
1176*0e209d39SAndroid Build Coastguard Worker  * for maximization, it will be copied to the output buffer.  For example,
1177*0e209d39SAndroid Build Coastguard Worker  * "sh" cannot be maximized, since there is no reasonable maximization.
1178*0e209d39SAndroid Build Coastguard Worker  *
1179*0e209d39SAndroid Build Coastguard Worker  * Examples:
1180*0e209d39SAndroid Build Coastguard Worker  *
1181*0e209d39SAndroid Build Coastguard Worker  * "und_Zzzz" maximizes to "en_Latn_US"
1182*0e209d39SAndroid Build Coastguard Worker  *
1183*0e209d39SAndroid Build Coastguard Worker  * "en" maximizes to "en_Latn_US"
1184*0e209d39SAndroid Build Coastguard Worker  *
1185*0e209d39SAndroid Build Coastguard Worker  * "de" maximizes to "de_Latn_DE"
1186*0e209d39SAndroid Build Coastguard Worker  *
1187*0e209d39SAndroid Build Coastguard Worker  * "sr" maximizes to "sr_Cyrl_RS"
1188*0e209d39SAndroid Build Coastguard Worker  *
1189*0e209d39SAndroid Build Coastguard Worker  * "zh_Hani" maximizes to "zh_Hani_CN"
1190*0e209d39SAndroid Build Coastguard Worker  *
1191*0e209d39SAndroid Build Coastguard Worker  *
1192*0e209d39SAndroid Build Coastguard Worker  * @param localeID The locale to maximize
1193*0e209d39SAndroid Build Coastguard Worker  * @param maximizedLocaleID The maximized locale
1194*0e209d39SAndroid Build Coastguard Worker  * @param maximizedLocaleIDCapacity The capacity of the maximizedLocaleID buffer
1195*0e209d39SAndroid Build Coastguard Worker  * @param err Error information if maximizing the locale failed.  If the length
1196*0e209d39SAndroid Build Coastguard Worker  * of the localeID and the null-terminator is greater than the maximum allowed size,
1197*0e209d39SAndroid Build Coastguard Worker  * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
1198*0e209d39SAndroid Build Coastguard Worker  * @return The actual buffer size needed for the maximized locale.  If it's
1199*0e209d39SAndroid Build Coastguard Worker  * greater than maximizedLocaleIDCapacity, the returned ID will be truncated.
1200*0e209d39SAndroid Build Coastguard Worker  * On error, the return value is -1.
1201*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.0
1202*0e209d39SAndroid Build Coastguard Worker  */
1203*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
1204*0e209d39SAndroid Build Coastguard Worker uloc_addLikelySubtags(const char*    localeID,
1205*0e209d39SAndroid Build Coastguard Worker          char* maximizedLocaleID,
1206*0e209d39SAndroid Build Coastguard Worker          int32_t maximizedLocaleIDCapacity,
1207*0e209d39SAndroid Build Coastguard Worker          UErrorCode* err);
1208*0e209d39SAndroid Build Coastguard Worker 
1209*0e209d39SAndroid Build Coastguard Worker 
1210*0e209d39SAndroid Build Coastguard Worker /**
1211*0e209d39SAndroid Build Coastguard Worker  * Minimize the subtags for a provided locale ID, per the algorithm described
1212*0e209d39SAndroid Build Coastguard Worker  * in the following CLDR technical report:
1213*0e209d39SAndroid Build Coastguard Worker  *
1214*0e209d39SAndroid Build Coastguard Worker  *   http://www.unicode.org/reports/tr35/#Likely_Subtags
1215*0e209d39SAndroid Build Coastguard Worker  *
1216*0e209d39SAndroid Build Coastguard Worker  * If localeID is already in the minimal form, or there is no data available
1217*0e209d39SAndroid Build Coastguard Worker  * for minimization, it will be copied to the output buffer.  Since the
1218*0e209d39SAndroid Build Coastguard Worker  * minimization algorithm relies on proper maximization, see the comments
1219*0e209d39SAndroid Build Coastguard Worker  * for uloc_addLikelySubtags for reasons why there might not be any data.
1220*0e209d39SAndroid Build Coastguard Worker  *
1221*0e209d39SAndroid Build Coastguard Worker  * Examples:
1222*0e209d39SAndroid Build Coastguard Worker  *
1223*0e209d39SAndroid Build Coastguard Worker  * "en_Latn_US" minimizes to "en"
1224*0e209d39SAndroid Build Coastguard Worker  *
1225*0e209d39SAndroid Build Coastguard Worker  * "de_Latn_US" minimizes to "de"
1226*0e209d39SAndroid Build Coastguard Worker  *
1227*0e209d39SAndroid Build Coastguard Worker  * "sr_Cyrl_RS" minimizes to "sr"
1228*0e209d39SAndroid Build Coastguard Worker  *
1229*0e209d39SAndroid Build Coastguard Worker  * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the
1230*0e209d39SAndroid Build Coastguard Worker  * script, and minimizing to "zh" would imply "zh_Hans_CN".)
1231*0e209d39SAndroid Build Coastguard Worker  *
1232*0e209d39SAndroid Build Coastguard Worker  * @param localeID The locale to minimize
1233*0e209d39SAndroid Build Coastguard Worker  * @param minimizedLocaleID The minimized locale
1234*0e209d39SAndroid Build Coastguard Worker  * @param minimizedLocaleIDCapacity The capacity of the minimizedLocaleID buffer
1235*0e209d39SAndroid Build Coastguard Worker  * @param err Error information if minimizing the locale failed.  If the length
1236*0e209d39SAndroid Build Coastguard Worker  * of the localeID and the null-terminator is greater than the maximum allowed size,
1237*0e209d39SAndroid Build Coastguard Worker  * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
1238*0e209d39SAndroid Build Coastguard Worker  * @return The actual buffer size needed for the minimized locale.  If it's
1239*0e209d39SAndroid Build Coastguard Worker  * greater than minimizedLocaleIDCapacity, the returned ID will be truncated.
1240*0e209d39SAndroid Build Coastguard Worker  * On error, the return value is -1.
1241*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.0
1242*0e209d39SAndroid Build Coastguard Worker  */
1243*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
1244*0e209d39SAndroid Build Coastguard Worker uloc_minimizeSubtags(const char*    localeID,
1245*0e209d39SAndroid Build Coastguard Worker          char* minimizedLocaleID,
1246*0e209d39SAndroid Build Coastguard Worker          int32_t minimizedLocaleIDCapacity,
1247*0e209d39SAndroid Build Coastguard Worker          UErrorCode* err);
1248*0e209d39SAndroid Build Coastguard Worker 
1249*0e209d39SAndroid Build Coastguard Worker /**
1250*0e209d39SAndroid Build Coastguard Worker  * Returns a locale ID for the specified BCP47 language tag string.
1251*0e209d39SAndroid Build Coastguard Worker  * If the specified language tag contains any ill-formed subtags,
1252*0e209d39SAndroid Build Coastguard Worker  * the first such subtag and all following subtags are ignored.
1253*0e209d39SAndroid Build Coastguard Worker  * <p>
1254*0e209d39SAndroid Build Coastguard Worker  * This implements the 'Language-Tag' production of BCP 47, and so
1255*0e209d39SAndroid Build Coastguard Worker  * supports legacy language tags (marked as “Type: grandfathered” in BCP 47)
1256*0e209d39SAndroid Build Coastguard Worker  * (regular and irregular) as well as private use language tags.
1257*0e209d39SAndroid Build Coastguard Worker  *
1258*0e209d39SAndroid Build Coastguard Worker  * Private use tags are represented as 'x-whatever',
1259*0e209d39SAndroid Build Coastguard Worker  * and legacy tags are converted to their canonical replacements where they exist.
1260*0e209d39SAndroid Build Coastguard Worker  *
1261*0e209d39SAndroid Build Coastguard Worker  * Note that a few legacy tags have no modern replacement;
1262*0e209d39SAndroid Build Coastguard Worker  * these will be converted using the fallback described in
1263*0e209d39SAndroid Build Coastguard Worker  * the first paragraph, so some information might be lost.
1264*0e209d39SAndroid Build Coastguard Worker  *
1265*0e209d39SAndroid Build Coastguard Worker  * @param langtag   the input BCP47 language tag.
1266*0e209d39SAndroid Build Coastguard Worker  * @param localeID  the output buffer receiving a locale ID for the
1267*0e209d39SAndroid Build Coastguard Worker  *                  specified BCP47 language tag.
1268*0e209d39SAndroid Build Coastguard Worker  * @param localeIDCapacity  the size of the locale ID output buffer.
1269*0e209d39SAndroid Build Coastguard Worker  * @param parsedLength  if not NULL, successfully parsed length
1270*0e209d39SAndroid Build Coastguard Worker  *                      for the input language tag is set.
1271*0e209d39SAndroid Build Coastguard Worker  * @param err       error information if receiving the locald ID
1272*0e209d39SAndroid Build Coastguard Worker  *                  failed.
1273*0e209d39SAndroid Build Coastguard Worker  * @return          the length of the locale ID.
1274*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
1275*0e209d39SAndroid Build Coastguard Worker  */
1276*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
1277*0e209d39SAndroid Build Coastguard Worker uloc_forLanguageTag(const char* langtag,
1278*0e209d39SAndroid Build Coastguard Worker                     char* localeID,
1279*0e209d39SAndroid Build Coastguard Worker                     int32_t localeIDCapacity,
1280*0e209d39SAndroid Build Coastguard Worker                     int32_t* parsedLength,
1281*0e209d39SAndroid Build Coastguard Worker                     UErrorCode* err);
1282*0e209d39SAndroid Build Coastguard Worker 
1283*0e209d39SAndroid Build Coastguard Worker /**
1284*0e209d39SAndroid Build Coastguard Worker  * Returns a well-formed language tag for this locale ID.
1285*0e209d39SAndroid Build Coastguard Worker  * <p>
1286*0e209d39SAndroid Build Coastguard Worker  * <b>Note</b>: When <code>strict</code> is false, any locale
1287*0e209d39SAndroid Build Coastguard Worker  * fields which do not satisfy the BCP47 syntax requirement will
1288*0e209d39SAndroid Build Coastguard Worker  * be omitted from the result.  When <code>strict</code> is
1289*0e209d39SAndroid Build Coastguard Worker  * true, this function sets U_ILLEGAL_ARGUMENT_ERROR to the
1290*0e209d39SAndroid Build Coastguard Worker  * <code>err</code> if any locale fields do not satisfy the
1291*0e209d39SAndroid Build Coastguard Worker  * BCP47 syntax requirement.
1292*0e209d39SAndroid Build Coastguard Worker  * @param localeID  the input locale ID
1293*0e209d39SAndroid Build Coastguard Worker  * @param langtag   the output buffer receiving BCP47 language
1294*0e209d39SAndroid Build Coastguard Worker  *                  tag for the locale ID.
1295*0e209d39SAndroid Build Coastguard Worker  * @param langtagCapacity   the size of the BCP47 language tag
1296*0e209d39SAndroid Build Coastguard Worker  *                          output buffer.
1297*0e209d39SAndroid Build Coastguard Worker  * @param strict    boolean value indicating if the function returns
1298*0e209d39SAndroid Build Coastguard Worker  *                  an error for an ill-formed input locale ID.
1299*0e209d39SAndroid Build Coastguard Worker  * @param err       error information if receiving the language
1300*0e209d39SAndroid Build Coastguard Worker  *                  tag failed.
1301*0e209d39SAndroid Build Coastguard Worker  * @return          The length of the BCP47 language tag.
1302*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 4.2
1303*0e209d39SAndroid Build Coastguard Worker  */
1304*0e209d39SAndroid Build Coastguard Worker U_CAPI int32_t U_EXPORT2
1305*0e209d39SAndroid Build Coastguard Worker uloc_toLanguageTag(const char* localeID,
1306*0e209d39SAndroid Build Coastguard Worker                    char* langtag,
1307*0e209d39SAndroid Build Coastguard Worker                    int32_t langtagCapacity,
1308*0e209d39SAndroid Build Coastguard Worker                    UBool strict,
1309*0e209d39SAndroid Build Coastguard Worker                    UErrorCode* err);
1310*0e209d39SAndroid Build Coastguard Worker 
1311*0e209d39SAndroid Build Coastguard Worker /**
1312*0e209d39SAndroid Build Coastguard Worker  * Converts the specified keyword (legacy key, or BCP 47 Unicode locale
1313*0e209d39SAndroid Build Coastguard Worker  * extension key) to the equivalent BCP 47 Unicode locale extension key.
1314*0e209d39SAndroid Build Coastguard Worker  * For example, BCP 47 Unicode locale extension key "co" is returned for
1315*0e209d39SAndroid Build Coastguard Worker  * the input keyword "collation".
1316*0e209d39SAndroid Build Coastguard Worker  * <p>
1317*0e209d39SAndroid Build Coastguard Worker  * When the specified keyword is unknown, but satisfies the BCP syntax,
1318*0e209d39SAndroid Build Coastguard Worker  * then the pointer to the input keyword itself will be returned.
1319*0e209d39SAndroid Build Coastguard Worker  * For example,
1320*0e209d39SAndroid Build Coastguard Worker  * <code>uloc_toUnicodeLocaleKey("ZZ")</code> returns "ZZ".
1321*0e209d39SAndroid Build Coastguard Worker  *
1322*0e209d39SAndroid Build Coastguard Worker  * @param keyword       the input locale keyword (either legacy key
1323*0e209d39SAndroid Build Coastguard Worker  *                      such as "collation" or BCP 47 Unicode locale extension
1324*0e209d39SAndroid Build Coastguard Worker  *                      key such as "co").
1325*0e209d39SAndroid Build Coastguard Worker  * @return              the well-formed BCP 47 Unicode locale extension key,
1326*0e209d39SAndroid Build Coastguard Worker  *                      or NULL if the specified locale keyword cannot be
1327*0e209d39SAndroid Build Coastguard Worker  *                      mapped to a well-formed BCP 47 Unicode locale extension
1328*0e209d39SAndroid Build Coastguard Worker  *                      key.
1329*0e209d39SAndroid Build Coastguard Worker  * @see uloc_toLegacyKey
1330*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 54
1331*0e209d39SAndroid Build Coastguard Worker  */
1332*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* U_EXPORT2
1333*0e209d39SAndroid Build Coastguard Worker uloc_toUnicodeLocaleKey(const char* keyword);
1334*0e209d39SAndroid Build Coastguard Worker 
1335*0e209d39SAndroid Build Coastguard Worker /**
1336*0e209d39SAndroid Build Coastguard Worker  * Converts the specified keyword value (legacy type, or BCP 47
1337*0e209d39SAndroid Build Coastguard Worker  * Unicode locale extension type) to the well-formed BCP 47 Unicode locale
1338*0e209d39SAndroid Build Coastguard Worker  * extension type for the specified keyword (category). For example, BCP 47
1339*0e209d39SAndroid Build Coastguard Worker  * Unicode locale extension type "phonebk" is returned for the input
1340*0e209d39SAndroid Build Coastguard Worker  * keyword value "phonebook", with the keyword "collation" (or "co").
1341*0e209d39SAndroid Build Coastguard Worker  * <p>
1342*0e209d39SAndroid Build Coastguard Worker  * When the specified keyword is not recognized, but the specified value
1343*0e209d39SAndroid Build Coastguard Worker  * satisfies the syntax of the BCP 47 Unicode locale extension type,
1344*0e209d39SAndroid Build Coastguard Worker  * or when the specified keyword allows 'variable' type and the specified
1345*0e209d39SAndroid Build Coastguard Worker  * value satisfies the syntax,  then the pointer to the input type value itself
1346*0e209d39SAndroid Build Coastguard Worker  * will be returned.
1347*0e209d39SAndroid Build Coastguard Worker  * For example,
1348*0e209d39SAndroid Build Coastguard Worker  * <code>uloc_toUnicodeLocaleType("Foo", "Bar")</code> returns "Bar",
1349*0e209d39SAndroid Build Coastguard Worker  * <code>uloc_toUnicodeLocaleType("variableTop", "00A4")</code> returns "00A4".
1350*0e209d39SAndroid Build Coastguard Worker  *
1351*0e209d39SAndroid Build Coastguard Worker  * @param keyword       the locale keyword (either legacy key such as
1352*0e209d39SAndroid Build Coastguard Worker  *                      "collation" or BCP 47 Unicode locale extension
1353*0e209d39SAndroid Build Coastguard Worker  *                      key such as "co").
1354*0e209d39SAndroid Build Coastguard Worker  * @param value         the locale keyword value (either legacy type
1355*0e209d39SAndroid Build Coastguard Worker  *                      such as "phonebook" or BCP 47 Unicode locale extension
1356*0e209d39SAndroid Build Coastguard Worker  *                      type such as "phonebk").
1357*0e209d39SAndroid Build Coastguard Worker  * @return              the well-formed BCP47 Unicode locale extension type,
1358*0e209d39SAndroid Build Coastguard Worker  *                      or NULL if the locale keyword value cannot be mapped to
1359*0e209d39SAndroid Build Coastguard Worker  *                      a well-formed BCP 47 Unicode locale extension type.
1360*0e209d39SAndroid Build Coastguard Worker  * @see uloc_toLegacyType
1361*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 54
1362*0e209d39SAndroid Build Coastguard Worker  */
1363*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* U_EXPORT2
1364*0e209d39SAndroid Build Coastguard Worker uloc_toUnicodeLocaleType(const char* keyword, const char* value);
1365*0e209d39SAndroid Build Coastguard Worker 
1366*0e209d39SAndroid Build Coastguard Worker /**
1367*0e209d39SAndroid Build Coastguard Worker  * Converts the specified keyword (BCP 47 Unicode locale extension key, or
1368*0e209d39SAndroid Build Coastguard Worker  * legacy key) to the legacy key. For example, legacy key "collation" is
1369*0e209d39SAndroid Build Coastguard Worker  * returned for the input BCP 47 Unicode locale extension key "co".
1370*0e209d39SAndroid Build Coastguard Worker  *
1371*0e209d39SAndroid Build Coastguard Worker  * @param keyword       the input locale keyword (either BCP 47 Unicode locale
1372*0e209d39SAndroid Build Coastguard Worker  *                      extension key or legacy key).
1373*0e209d39SAndroid Build Coastguard Worker  * @return              the well-formed legacy key, or NULL if the specified
1374*0e209d39SAndroid Build Coastguard Worker  *                      keyword cannot be mapped to a well-formed legacy key.
1375*0e209d39SAndroid Build Coastguard Worker  * @see toUnicodeLocaleKey
1376*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 54
1377*0e209d39SAndroid Build Coastguard Worker  */
1378*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* U_EXPORT2
1379*0e209d39SAndroid Build Coastguard Worker uloc_toLegacyKey(const char* keyword);
1380*0e209d39SAndroid Build Coastguard Worker 
1381*0e209d39SAndroid Build Coastguard Worker /**
1382*0e209d39SAndroid Build Coastguard Worker  * Converts the specified keyword value (BCP 47 Unicode locale extension type,
1383*0e209d39SAndroid Build Coastguard Worker  * or legacy type or type alias) to the canonical legacy type. For example,
1384*0e209d39SAndroid Build Coastguard Worker  * the legacy type "phonebook" is returned for the input BCP 47 Unicode
1385*0e209d39SAndroid Build Coastguard Worker  * locale extension type "phonebk" with the keyword "collation" (or "co").
1386*0e209d39SAndroid Build Coastguard Worker  * <p>
1387*0e209d39SAndroid Build Coastguard Worker  * When the specified keyword is not recognized, but the specified value
1388*0e209d39SAndroid Build Coastguard Worker  * satisfies the syntax of legacy key, or when the specified keyword
1389*0e209d39SAndroid Build Coastguard Worker  * allows 'variable' type and the specified value satisfies the syntax,
1390*0e209d39SAndroid Build Coastguard Worker  * then the pointer to the input type value itself will be returned.
1391*0e209d39SAndroid Build Coastguard Worker  * For example,
1392*0e209d39SAndroid Build Coastguard Worker  * <code>uloc_toLegacyType("Foo", "Bar")</code> returns "Bar",
1393*0e209d39SAndroid Build Coastguard Worker  * <code>uloc_toLegacyType("vt", "00A4")</code> returns "00A4".
1394*0e209d39SAndroid Build Coastguard Worker  *
1395*0e209d39SAndroid Build Coastguard Worker  * @param keyword       the locale keyword (either legacy keyword such as
1396*0e209d39SAndroid Build Coastguard Worker  *                      "collation" or BCP 47 Unicode locale extension
1397*0e209d39SAndroid Build Coastguard Worker  *                      key such as "co").
1398*0e209d39SAndroid Build Coastguard Worker  * @param value         the locale keyword value (either BCP 47 Unicode locale
1399*0e209d39SAndroid Build Coastguard Worker  *                      extension type such as "phonebk" or legacy keyword value
1400*0e209d39SAndroid Build Coastguard Worker  *                      such as "phonebook").
1401*0e209d39SAndroid Build Coastguard Worker  * @return              the well-formed legacy type, or NULL if the specified
1402*0e209d39SAndroid Build Coastguard Worker  *                      keyword value cannot be mapped to a well-formed legacy
1403*0e209d39SAndroid Build Coastguard Worker  *                      type.
1404*0e209d39SAndroid Build Coastguard Worker  * @see toUnicodeLocaleType
1405*0e209d39SAndroid Build Coastguard Worker  * @stable ICU 54
1406*0e209d39SAndroid Build Coastguard Worker  */
1407*0e209d39SAndroid Build Coastguard Worker U_CAPI const char* U_EXPORT2
1408*0e209d39SAndroid Build Coastguard Worker uloc_toLegacyType(const char* keyword, const char* value);
1409*0e209d39SAndroid Build Coastguard Worker 
1410*0e209d39SAndroid Build Coastguard Worker #endif /*_ULOC*/
1411