17777dab0Sopenharmony_ci// © 2016 and later: Unicode, Inc. and others.
27777dab0Sopenharmony_ci// License & terms of use: http://www.unicode.org/copyright.html
37777dab0Sopenharmony_ci/*
47777dab0Sopenharmony_ci**********************************************************************
57777dab0Sopenharmony_ci*   Copyright (C) 1997-2016, International Business Machines
67777dab0Sopenharmony_ci*   Corporation and others.  All Rights Reserved.
77777dab0Sopenharmony_ci**********************************************************************
87777dab0Sopenharmony_ci*
97777dab0Sopenharmony_ci* File ULOC.H
107777dab0Sopenharmony_ci*
117777dab0Sopenharmony_ci* Modification History:
127777dab0Sopenharmony_ci*
137777dab0Sopenharmony_ci*   Date        Name        Description
147777dab0Sopenharmony_ci*   04/01/97    aliu        Creation.
157777dab0Sopenharmony_ci*   08/22/98    stephen     JDK 1.2 sync.
167777dab0Sopenharmony_ci*   12/08/98    rtg         New C API for Locale
177777dab0Sopenharmony_ci*   03/30/99    damiba      overhaul
187777dab0Sopenharmony_ci*   03/31/99    helena      Javadoc for uloc functions.
197777dab0Sopenharmony_ci*   04/15/99    Madhu       Updated Javadoc
207777dab0Sopenharmony_ci********************************************************************************
217777dab0Sopenharmony_ci*/
227777dab0Sopenharmony_ci
237777dab0Sopenharmony_ci#ifndef ULOC_H
247777dab0Sopenharmony_ci#define ULOC_H
257777dab0Sopenharmony_ci
267777dab0Sopenharmony_ci#include "unicode/utypes.h"
277777dab0Sopenharmony_ci#include "unicode/uenum.h"
287777dab0Sopenharmony_ci
297777dab0Sopenharmony_ci/**
307777dab0Sopenharmony_ci * \file
317777dab0Sopenharmony_ci * \brief C API: Locale ID functionality similar to C++ class Locale
327777dab0Sopenharmony_ci *
337777dab0Sopenharmony_ci * <h2> ULoc C API for Locale </h2>
347777dab0Sopenharmony_ci * A <code>Locale</code> represents a specific geographical, political,
357777dab0Sopenharmony_ci * or cultural region. An operation that requires a <code>Locale</code> to perform
367777dab0Sopenharmony_ci * its task is called <em>locale-sensitive</em> and uses the <code>Locale</code>
377777dab0Sopenharmony_ci * to tailor information for the user. For example, displaying a number
387777dab0Sopenharmony_ci * is a locale-sensitive operation--the number should be formatted
397777dab0Sopenharmony_ci * according to the customs/conventions of the user's native country,
407777dab0Sopenharmony_ci * region, or culture.  In the C APIs, a locales is simply a const char string.
417777dab0Sopenharmony_ci *
427777dab0Sopenharmony_ci * <P>
437777dab0Sopenharmony_ci * You create a <code>Locale</code> with one of the three options listed below.
447777dab0Sopenharmony_ci * Each of the component is separated by '_' in the locale string.
457777dab0Sopenharmony_ci * \htmlonly<blockquote>\endhtmlonly
467777dab0Sopenharmony_ci * <pre>
477777dab0Sopenharmony_ci * \code
487777dab0Sopenharmony_ci *       newLanguage
497777dab0Sopenharmony_ci *
507777dab0Sopenharmony_ci *       newLanguage + newCountry
517777dab0Sopenharmony_ci *
527777dab0Sopenharmony_ci *       newLanguage + newCountry + newVariant
537777dab0Sopenharmony_ci * \endcode
547777dab0Sopenharmony_ci * </pre>
557777dab0Sopenharmony_ci * \htmlonly</blockquote>\endhtmlonly
567777dab0Sopenharmony_ci * The first option is a valid <STRONG>ISO
577777dab0Sopenharmony_ci * Language Code.</STRONG> These codes are the lower-case two-letter
587777dab0Sopenharmony_ci * codes as defined by ISO-639.
597777dab0Sopenharmony_ci * You can find a full list of these codes at a number of sites, such as:
607777dab0Sopenharmony_ci * <BR><a href ="http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt">
617777dab0Sopenharmony_ci * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt</a>
627777dab0Sopenharmony_ci *
637777dab0Sopenharmony_ci * <P>
647777dab0Sopenharmony_ci * The second option includes an additional <STRONG>ISO Country
657777dab0Sopenharmony_ci * Code.</STRONG> These codes are the upper-case two-letter codes
667777dab0Sopenharmony_ci * as defined by ISO-3166.
677777dab0Sopenharmony_ci * You can find a full list of these codes at a number of sites, such as:
687777dab0Sopenharmony_ci * <BR><a href="http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html">
697777dab0Sopenharmony_ci * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html</a>
707777dab0Sopenharmony_ci *
717777dab0Sopenharmony_ci * <P>
727777dab0Sopenharmony_ci * The third option requires another additional information--the
737777dab0Sopenharmony_ci * <STRONG>Variant.</STRONG>
747777dab0Sopenharmony_ci * The Variant codes are vendor and browser-specific.
757777dab0Sopenharmony_ci * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX.
767777dab0Sopenharmony_ci * Where there are two variants, separate them with an underscore, and
777777dab0Sopenharmony_ci * put the most important one first. For
787777dab0Sopenharmony_ci * example, a Traditional Spanish collation might be referenced, with
797777dab0Sopenharmony_ci * "ES", "ES", "Traditional_WIN".
807777dab0Sopenharmony_ci *
817777dab0Sopenharmony_ci * <P>
827777dab0Sopenharmony_ci * Because a <code>Locale</code> is just an identifier for a region,
837777dab0Sopenharmony_ci * no validity check is performed when you specify a <code>Locale</code>.
847777dab0Sopenharmony_ci * If you want to see whether particular resources are available for the
857777dab0Sopenharmony_ci * <code>Locale</code> you asked for, you must query those resources. For
867777dab0Sopenharmony_ci * example, ask the <code>UNumberFormat</code> for the locales it supports
877777dab0Sopenharmony_ci * using its <code>getAvailable</code> method.
887777dab0Sopenharmony_ci * <BR><STRONG>Note:</STRONG> When you ask for a resource for a particular
897777dab0Sopenharmony_ci * locale, you get back the best available match, not necessarily
907777dab0Sopenharmony_ci * precisely what you asked for. For more information, look at
917777dab0Sopenharmony_ci * <code>UResourceBundle</code>.
927777dab0Sopenharmony_ci *
937777dab0Sopenharmony_ci * <P>
947777dab0Sopenharmony_ci * The <code>Locale</code> provides a number of convenient constants
957777dab0Sopenharmony_ci * that you can use to specify the commonly used
967777dab0Sopenharmony_ci * locales. For example, the following refers to a locale
977777dab0Sopenharmony_ci * for the United States:
987777dab0Sopenharmony_ci * \htmlonly<blockquote>\endhtmlonly
997777dab0Sopenharmony_ci * <pre>
1007777dab0Sopenharmony_ci * \code
1017777dab0Sopenharmony_ci *       ULOC_US
1027777dab0Sopenharmony_ci * \endcode
1037777dab0Sopenharmony_ci * </pre>
1047777dab0Sopenharmony_ci * \htmlonly</blockquote>\endhtmlonly
1057777dab0Sopenharmony_ci *
1067777dab0Sopenharmony_ci * <P>
1077777dab0Sopenharmony_ci * Once you've specified a locale you can query it for information about
1087777dab0Sopenharmony_ci * itself. Use <code>uloc_getCountry</code> to get the ISO Country Code and
1097777dab0Sopenharmony_ci * <code>uloc_getLanguage</code> to get the ISO Language Code. You can
1107777dab0Sopenharmony_ci * use <code>uloc_getDisplayCountry</code> to get the
1117777dab0Sopenharmony_ci * name of the country suitable for displaying to the user. Similarly,
1127777dab0Sopenharmony_ci * you can use <code>uloc_getDisplayLanguage</code> to get the name of
1137777dab0Sopenharmony_ci * the language suitable for displaying to the user. Interestingly,
1147777dab0Sopenharmony_ci * the <code>uloc_getDisplayXXX</code> methods are themselves locale-sensitive
1157777dab0Sopenharmony_ci * and have two versions: one that uses the default locale and one
1167777dab0Sopenharmony_ci * that takes a locale as an argument and displays the name or country in
1177777dab0Sopenharmony_ci * a language appropriate to that locale.
1187777dab0Sopenharmony_ci *
1197777dab0Sopenharmony_ci * <P>
1207777dab0Sopenharmony_ci * The ICU provides a number of services that perform locale-sensitive
1217777dab0Sopenharmony_ci * operations. For example, the <code>unum_xxx</code> functions format
1227777dab0Sopenharmony_ci * numbers, currency, or percentages in a locale-sensitive manner.
1237777dab0Sopenharmony_ci * </P>
1247777dab0Sopenharmony_ci * \htmlonly<blockquote>\endhtmlonly
1257777dab0Sopenharmony_ci * <pre>
1267777dab0Sopenharmony_ci * \code
1277777dab0Sopenharmony_ci *     UErrorCode success = U_ZERO_ERROR;
1287777dab0Sopenharmony_ci *     UNumberFormat *nf;
1297777dab0Sopenharmony_ci *     const char* myLocale = "fr_FR";
1307777dab0Sopenharmony_ci *
1317777dab0Sopenharmony_ci *     nf = unum_open( UNUM_DEFAULT, NULL, success );
1327777dab0Sopenharmony_ci *     unum_close(nf);
1337777dab0Sopenharmony_ci *     nf = unum_open( UNUM_CURRENCY, NULL, success );
1347777dab0Sopenharmony_ci *     unum_close(nf);
1357777dab0Sopenharmony_ci *     nf = unum_open( UNUM_PERCENT, NULL, success );
1367777dab0Sopenharmony_ci *     unum_close(nf);
1377777dab0Sopenharmony_ci * \endcode
1387777dab0Sopenharmony_ci * </pre>
1397777dab0Sopenharmony_ci * \htmlonly</blockquote>\endhtmlonly
1407777dab0Sopenharmony_ci * Each of these methods has two variants; one with an explicit locale
1417777dab0Sopenharmony_ci * and one without; the latter using the default locale.
1427777dab0Sopenharmony_ci * \htmlonly<blockquote>\endhtmlonly
1437777dab0Sopenharmony_ci * <pre>
1447777dab0Sopenharmony_ci * \code
1457777dab0Sopenharmony_ci *
1467777dab0Sopenharmony_ci *     nf = unum_open( UNUM_DEFAULT, myLocale, success );
1477777dab0Sopenharmony_ci *     unum_close(nf);
1487777dab0Sopenharmony_ci *     nf = unum_open( UNUM_CURRENCY, myLocale, success );
1497777dab0Sopenharmony_ci *     unum_close(nf);
1507777dab0Sopenharmony_ci *     nf = unum_open( UNUM_PERCENT, myLocale, success );
1517777dab0Sopenharmony_ci *     unum_close(nf);
1527777dab0Sopenharmony_ci * \endcode
1537777dab0Sopenharmony_ci * </pre>
1547777dab0Sopenharmony_ci * \htmlonly</blockquote>\endhtmlonly
1557777dab0Sopenharmony_ci * A <code>Locale</code> is the mechanism for identifying the kind of services
1567777dab0Sopenharmony_ci * (<code>UNumberFormat</code>) that you would like to get. The locale is
1577777dab0Sopenharmony_ci * <STRONG>just</STRONG> a mechanism for identifying these services.
1587777dab0Sopenharmony_ci *
1597777dab0Sopenharmony_ci * <P>
1607777dab0Sopenharmony_ci * Each international service that performs locale-sensitive operations
1617777dab0Sopenharmony_ci * allows you
1627777dab0Sopenharmony_ci * to get all the available objects of that type. You can sift
1637777dab0Sopenharmony_ci * through these objects by language, country, or variant,
1647777dab0Sopenharmony_ci * and use the display names to present a menu to the user.
1657777dab0Sopenharmony_ci * For example, you can create a menu of all the collation objects
1667777dab0Sopenharmony_ci * suitable for a given language. Such classes implement these
1677777dab0Sopenharmony_ci * three class methods:
1687777dab0Sopenharmony_ci * \htmlonly<blockquote>\endhtmlonly
1697777dab0Sopenharmony_ci * <pre>
1707777dab0Sopenharmony_ci * \code
1717777dab0Sopenharmony_ci *       const char* uloc_getAvailable(int32_t index);
1727777dab0Sopenharmony_ci *       int32_t uloc_countAvailable();
1737777dab0Sopenharmony_ci *       int32_t
1747777dab0Sopenharmony_ci *       uloc_getDisplayName(const char* localeID,
1757777dab0Sopenharmony_ci *                 const char* inLocaleID,
1767777dab0Sopenharmony_ci *                 UChar* result,
1777777dab0Sopenharmony_ci *                 int32_t maxResultSize,
1787777dab0Sopenharmony_ci *                  UErrorCode* err);
1797777dab0Sopenharmony_ci *
1807777dab0Sopenharmony_ci * \endcode
1817777dab0Sopenharmony_ci * </pre>
1827777dab0Sopenharmony_ci * \htmlonly</blockquote>\endhtmlonly
1837777dab0Sopenharmony_ci * <P>
1847777dab0Sopenharmony_ci * Concerning POSIX/RFC1766 Locale IDs,
1857777dab0Sopenharmony_ci *  the getLanguage/getCountry/getVariant/getName functions do understand
1867777dab0Sopenharmony_ci * the POSIX type form of  language_COUNTRY.ENCODING\@VARIANT
1877777dab0Sopenharmony_ci * and if there is not an ICU-stype variant, uloc_getVariant() for example
1887777dab0Sopenharmony_ci * will return the one listed after the \@at sign. As well, the hyphen
1897777dab0Sopenharmony_ci * "-" is recognized as a country/variant separator similarly to RFC1766.
1907777dab0Sopenharmony_ci * So for example, "en-us" will be interpreted as en_US.
1917777dab0Sopenharmony_ci * As a result, uloc_getName() is far from a no-op, and will have the
1927777dab0Sopenharmony_ci * effect of converting POSIX/RFC1766 IDs into ICU form, although it does
1937777dab0Sopenharmony_ci * NOT map any of the actual codes (i.e. russian->ru) in any way.
1947777dab0Sopenharmony_ci * Applications should call uloc_getName() at the point where a locale ID
1957777dab0Sopenharmony_ci * is coming from an external source (user entry, OS, web browser)
1967777dab0Sopenharmony_ci * and pass the resulting string to other ICU functions.  For example,
1977777dab0Sopenharmony_ci * don't use de-de\@EURO as an argument to resourcebundle.
1987777dab0Sopenharmony_ci *
1997777dab0Sopenharmony_ci * @see UResourceBundle
2007777dab0Sopenharmony_ci */
2017777dab0Sopenharmony_ci
2027777dab0Sopenharmony_ci/** Useful constant for this language. @stable ICU 2.0 */
2037777dab0Sopenharmony_ci#define ULOC_CHINESE            "zh"
2047777dab0Sopenharmony_ci/** Useful constant for this language. @stable ICU 2.0 */
2057777dab0Sopenharmony_ci#define ULOC_ENGLISH            "en"
2067777dab0Sopenharmony_ci/** Useful constant for this language. @stable ICU 2.0 */
2077777dab0Sopenharmony_ci#define ULOC_FRENCH             "fr"
2087777dab0Sopenharmony_ci/** Useful constant for this language. @stable ICU 2.0 */
2097777dab0Sopenharmony_ci#define ULOC_GERMAN             "de"
2107777dab0Sopenharmony_ci/** Useful constant for this language. @stable ICU 2.0 */
2117777dab0Sopenharmony_ci#define ULOC_ITALIAN            "it"
2127777dab0Sopenharmony_ci/** Useful constant for this language. @stable ICU 2.0 */
2137777dab0Sopenharmony_ci#define ULOC_JAPANESE           "ja"
2147777dab0Sopenharmony_ci/** Useful constant for this language. @stable ICU 2.0 */
2157777dab0Sopenharmony_ci#define ULOC_KOREAN             "ko"
2167777dab0Sopenharmony_ci/** Useful constant for this language. @stable ICU 2.0 */
2177777dab0Sopenharmony_ci#define ULOC_SIMPLIFIED_CHINESE "zh_CN"
2187777dab0Sopenharmony_ci/** Useful constant for this language. @stable ICU 2.0 */
2197777dab0Sopenharmony_ci#define ULOC_TRADITIONAL_CHINESE "zh_TW"
2207777dab0Sopenharmony_ci
2217777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2227777dab0Sopenharmony_ci#define ULOC_CANADA         "en_CA"
2237777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2247777dab0Sopenharmony_ci#define ULOC_CANADA_FRENCH  "fr_CA"
2257777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2267777dab0Sopenharmony_ci#define ULOC_CHINA          "zh_CN"
2277777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2287777dab0Sopenharmony_ci#define ULOC_PRC            "zh_CN"
2297777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2307777dab0Sopenharmony_ci#define ULOC_FRANCE         "fr_FR"
2317777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2327777dab0Sopenharmony_ci#define ULOC_GERMANY        "de_DE"
2337777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2347777dab0Sopenharmony_ci#define ULOC_ITALY          "it_IT"
2357777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2367777dab0Sopenharmony_ci#define ULOC_JAPAN          "ja_JP"
2377777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2387777dab0Sopenharmony_ci#define ULOC_KOREA          "ko_KR"
2397777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2407777dab0Sopenharmony_ci#define ULOC_TAIWAN         "zh_TW"
2417777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2427777dab0Sopenharmony_ci#define ULOC_UK             "en_GB"
2437777dab0Sopenharmony_ci/** Useful constant for this country/region. @stable ICU 2.0 */
2447777dab0Sopenharmony_ci#define ULOC_US             "en_US"
2457777dab0Sopenharmony_ci
2467777dab0Sopenharmony_ci/**
2477777dab0Sopenharmony_ci * Useful constant for the maximum size of the language part of a locale ID.
2487777dab0Sopenharmony_ci * (including the terminating NULL).
2497777dab0Sopenharmony_ci * @stable ICU 2.0
2507777dab0Sopenharmony_ci */
2517777dab0Sopenharmony_ci#define ULOC_LANG_CAPACITY 12
2527777dab0Sopenharmony_ci
2537777dab0Sopenharmony_ci/**
2547777dab0Sopenharmony_ci * Useful constant for the maximum size of the country part of a locale ID
2557777dab0Sopenharmony_ci * (including the terminating NULL).
2567777dab0Sopenharmony_ci * @stable ICU 2.0
2577777dab0Sopenharmony_ci */
2587777dab0Sopenharmony_ci#define ULOC_COUNTRY_CAPACITY 4
2597777dab0Sopenharmony_ci/**
2607777dab0Sopenharmony_ci * Useful constant for the maximum size of the whole locale ID
2617777dab0Sopenharmony_ci * (including the terminating NULL and all keywords).
2627777dab0Sopenharmony_ci * @stable ICU 2.0
2637777dab0Sopenharmony_ci */
2647777dab0Sopenharmony_ci#define ULOC_FULLNAME_CAPACITY 157
2657777dab0Sopenharmony_ci
2667777dab0Sopenharmony_ci/**
2677777dab0Sopenharmony_ci * Useful constant for the maximum size of the script part of a locale ID
2687777dab0Sopenharmony_ci * (including the terminating NULL).
2697777dab0Sopenharmony_ci * @stable ICU 2.8
2707777dab0Sopenharmony_ci */
2717777dab0Sopenharmony_ci#define ULOC_SCRIPT_CAPACITY 6
2727777dab0Sopenharmony_ci
2737777dab0Sopenharmony_ci/**
2747777dab0Sopenharmony_ci * Useful constant for the maximum size of keywords in a locale
2757777dab0Sopenharmony_ci * @stable ICU 2.8
2767777dab0Sopenharmony_ci */
2777777dab0Sopenharmony_ci#define ULOC_KEYWORDS_CAPACITY 96
2787777dab0Sopenharmony_ci
2797777dab0Sopenharmony_ci/**
2807777dab0Sopenharmony_ci * Useful constant for the maximum total size of keywords and their values in a locale
2817777dab0Sopenharmony_ci * @stable ICU 2.8
2827777dab0Sopenharmony_ci */
2837777dab0Sopenharmony_ci#define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
2847777dab0Sopenharmony_ci
2857777dab0Sopenharmony_ci/**
2867777dab0Sopenharmony_ci * Invariant character separating keywords from the locale string
2877777dab0Sopenharmony_ci * @stable ICU 2.8
2887777dab0Sopenharmony_ci */
2897777dab0Sopenharmony_ci#define ULOC_KEYWORD_SEPARATOR '@'
2907777dab0Sopenharmony_ci
2917777dab0Sopenharmony_ci/**
2927777dab0Sopenharmony_ci  * Unicode code point for '@' separating keywords from the locale string.
2937777dab0Sopenharmony_ci  * @see ULOC_KEYWORD_SEPARATOR
2947777dab0Sopenharmony_ci  * @stable ICU 4.6
2957777dab0Sopenharmony_ci  */
2967777dab0Sopenharmony_ci#define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40
2977777dab0Sopenharmony_ci
2987777dab0Sopenharmony_ci/**
2997777dab0Sopenharmony_ci * Invariant character for assigning value to a keyword
3007777dab0Sopenharmony_ci * @stable ICU 2.8
3017777dab0Sopenharmony_ci */
3027777dab0Sopenharmony_ci#define ULOC_KEYWORD_ASSIGN '='
3037777dab0Sopenharmony_ci
3047777dab0Sopenharmony_ci/**
3057777dab0Sopenharmony_ci  * Unicode code point for '=' for assigning value to a keyword.
3067777dab0Sopenharmony_ci  * @see ULOC_KEYWORD_ASSIGN
3077777dab0Sopenharmony_ci  * @stable ICU 4.6
3087777dab0Sopenharmony_ci  */
3097777dab0Sopenharmony_ci#define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D
3107777dab0Sopenharmony_ci
3117777dab0Sopenharmony_ci/**
3127777dab0Sopenharmony_ci * Invariant character separating keywords
3137777dab0Sopenharmony_ci * @stable ICU 2.8
3147777dab0Sopenharmony_ci */
3157777dab0Sopenharmony_ci#define ULOC_KEYWORD_ITEM_SEPARATOR ';'
3167777dab0Sopenharmony_ci
3177777dab0Sopenharmony_ci/**
3187777dab0Sopenharmony_ci  * Unicode code point for ';' separating keywords
3197777dab0Sopenharmony_ci  * @see ULOC_KEYWORD_ITEM_SEPARATOR
3207777dab0Sopenharmony_ci  * @stable ICU 4.6
3217777dab0Sopenharmony_ci  */
3227777dab0Sopenharmony_ci#define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B
3237777dab0Sopenharmony_ci
3247777dab0Sopenharmony_ci/**
3257777dab0Sopenharmony_ci * Constants for *_getLocale()
3267777dab0Sopenharmony_ci * Allow user to select whether she wants information on
3277777dab0Sopenharmony_ci * requested, valid or actual locale.
3287777dab0Sopenharmony_ci * For example, a collator for "en_US_CALIFORNIA" was
3297777dab0Sopenharmony_ci * requested. In the current state of ICU (2.0),
3307777dab0Sopenharmony_ci * the requested locale is "en_US_CALIFORNIA",
3317777dab0Sopenharmony_ci * the valid locale is "en_US" (most specific locale supported by ICU)
3327777dab0Sopenharmony_ci * and the actual locale is "root" (the collation data comes unmodified
3337777dab0Sopenharmony_ci * from the UCA)
3347777dab0Sopenharmony_ci * The locale is considered supported by ICU if there is a core ICU bundle
3357777dab0Sopenharmony_ci * for that locale (although it may be empty).
3367777dab0Sopenharmony_ci * @stable ICU 2.1
3377777dab0Sopenharmony_ci */
3387777dab0Sopenharmony_citypedef enum {
3397777dab0Sopenharmony_ci  /** This is locale the data actually comes from
3407777dab0Sopenharmony_ci   * @stable ICU 2.1
3417777dab0Sopenharmony_ci   */
3427777dab0Sopenharmony_ci  ULOC_ACTUAL_LOCALE    = 0,
3437777dab0Sopenharmony_ci  /** This is the most specific locale supported by ICU
3447777dab0Sopenharmony_ci   * @stable ICU 2.1
3457777dab0Sopenharmony_ci   */
3467777dab0Sopenharmony_ci  ULOC_VALID_LOCALE    = 1,
3477777dab0Sopenharmony_ci} ULocDataLocaleType;
3487777dab0Sopenharmony_ci
3497777dab0Sopenharmony_ci#ifndef U_HIDE_SYSTEM_API
3507777dab0Sopenharmony_ci/**
3517777dab0Sopenharmony_ci * Gets ICU's default locale.
3527777dab0Sopenharmony_ci * The returned string is a snapshot in time, and will remain valid
3537777dab0Sopenharmony_ci *   and unchanged even when uloc_setDefault() is called.
3547777dab0Sopenharmony_ci *   The returned storage is owned by ICU, and must not be altered or deleted
3557777dab0Sopenharmony_ci *   by the caller.
3567777dab0Sopenharmony_ci *
3577777dab0Sopenharmony_ci * @return the ICU default locale
3587777dab0Sopenharmony_ci * @system
3597777dab0Sopenharmony_ci * @stable ICU 2.0
3607777dab0Sopenharmony_ci */
3617777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
3627777dab0Sopenharmony_ciuloc_getDefault(void);
3637777dab0Sopenharmony_ci
3647777dab0Sopenharmony_ci/**
3657777dab0Sopenharmony_ci * Sets ICU's default locale.
3667777dab0Sopenharmony_ci *    By default (without calling this function), ICU's default locale will be based
3677777dab0Sopenharmony_ci *    on information obtained from the underlying system environment.
3687777dab0Sopenharmony_ci *    <p>
3697777dab0Sopenharmony_ci *    Changes to ICU's default locale do not propagate back to the
3707777dab0Sopenharmony_ci *    system environment.
3717777dab0Sopenharmony_ci *    <p>
3727777dab0Sopenharmony_ci *    Changes to ICU's default locale to not affect any ICU services that
3737777dab0Sopenharmony_ci *    may already be open based on the previous default locale value.
3747777dab0Sopenharmony_ci *
3757777dab0Sopenharmony_ci * @param localeID the new ICU default locale. A value of NULL will try to get
3767777dab0Sopenharmony_ci *                 the system's default locale.
3777777dab0Sopenharmony_ci * @param status the error information if the setting of default locale fails
3787777dab0Sopenharmony_ci * @system
3797777dab0Sopenharmony_ci * @stable ICU 2.0
3807777dab0Sopenharmony_ci */
3817777dab0Sopenharmony_ciU_CAPI void U_EXPORT2
3827777dab0Sopenharmony_ciuloc_setDefault(const char* localeID,
3837777dab0Sopenharmony_ci        UErrorCode*       status);
3847777dab0Sopenharmony_ci#endif  /* U_HIDE_SYSTEM_API */
3857777dab0Sopenharmony_ci
3867777dab0Sopenharmony_ci/**
3877777dab0Sopenharmony_ci * Gets the language code for the specified locale.
3887777dab0Sopenharmony_ci *
3897777dab0Sopenharmony_ci * @param localeID the locale to get the ISO language code with
3907777dab0Sopenharmony_ci * @param language the language code for localeID
3917777dab0Sopenharmony_ci * @param languageCapacity the size of the language buffer to store the
3927777dab0Sopenharmony_ci * language code with
3937777dab0Sopenharmony_ci * @param err error information if retrieving the language code failed
3947777dab0Sopenharmony_ci * @return the actual buffer size needed for the language code.  If it's greater
3957777dab0Sopenharmony_ci * than languageCapacity, the returned language code will be truncated.
3967777dab0Sopenharmony_ci * @stable ICU 2.0
3977777dab0Sopenharmony_ci */
3987777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
3997777dab0Sopenharmony_ciuloc_getLanguage(const char*    localeID,
4007777dab0Sopenharmony_ci         char* language,
4017777dab0Sopenharmony_ci         int32_t languageCapacity,
4027777dab0Sopenharmony_ci         UErrorCode* err);
4037777dab0Sopenharmony_ci
4047777dab0Sopenharmony_ci/**
4057777dab0Sopenharmony_ci * Gets the script code for the specified locale.
4067777dab0Sopenharmony_ci *
4077777dab0Sopenharmony_ci * @param localeID the locale to get the ISO language code with
4087777dab0Sopenharmony_ci * @param script the language code for localeID
4097777dab0Sopenharmony_ci * @param scriptCapacity the size of the language buffer to store the
4107777dab0Sopenharmony_ci * language code with
4117777dab0Sopenharmony_ci * @param err error information if retrieving the language code failed
4127777dab0Sopenharmony_ci * @return the actual buffer size needed for the language code.  If it's greater
4137777dab0Sopenharmony_ci * than scriptCapacity, the returned language code will be truncated.
4147777dab0Sopenharmony_ci * @stable ICU 2.8
4157777dab0Sopenharmony_ci */
4167777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
4177777dab0Sopenharmony_ciuloc_getScript(const char*    localeID,
4187777dab0Sopenharmony_ci         char* script,
4197777dab0Sopenharmony_ci         int32_t scriptCapacity,
4207777dab0Sopenharmony_ci         UErrorCode* err);
4217777dab0Sopenharmony_ci
4227777dab0Sopenharmony_ci/**
4237777dab0Sopenharmony_ci * Gets the  country code for the specified locale.
4247777dab0Sopenharmony_ci *
4257777dab0Sopenharmony_ci * @param localeID the locale to get the country code with
4267777dab0Sopenharmony_ci * @param country the country code for localeID
4277777dab0Sopenharmony_ci * @param countryCapacity the size of the country buffer to store the
4287777dab0Sopenharmony_ci * country code with
4297777dab0Sopenharmony_ci * @param err error information if retrieving the country code failed
4307777dab0Sopenharmony_ci * @return the actual buffer size needed for the country code.  If it's greater
4317777dab0Sopenharmony_ci * than countryCapacity, the returned country code will be truncated.
4327777dab0Sopenharmony_ci * @stable ICU 2.0
4337777dab0Sopenharmony_ci */
4347777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
4357777dab0Sopenharmony_ciuloc_getCountry(const char*    localeID,
4367777dab0Sopenharmony_ci        char* country,
4377777dab0Sopenharmony_ci        int32_t countryCapacity,
4387777dab0Sopenharmony_ci        UErrorCode* err);
4397777dab0Sopenharmony_ci
4407777dab0Sopenharmony_ci/**
4417777dab0Sopenharmony_ci * Gets the variant code for the specified locale.
4427777dab0Sopenharmony_ci *
4437777dab0Sopenharmony_ci * @param localeID the locale to get the variant code with
4447777dab0Sopenharmony_ci * @param variant the variant code for localeID
4457777dab0Sopenharmony_ci * @param variantCapacity the size of the variant buffer to store the
4467777dab0Sopenharmony_ci * variant code with
4477777dab0Sopenharmony_ci * @param err error information if retrieving the variant code failed
4487777dab0Sopenharmony_ci * @return the actual buffer size needed for the variant code.  If it's greater
4497777dab0Sopenharmony_ci * than variantCapacity, the returned variant code will be truncated.
4507777dab0Sopenharmony_ci * @stable ICU 2.0
4517777dab0Sopenharmony_ci */
4527777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
4537777dab0Sopenharmony_ciuloc_getVariant(const char*    localeID,
4547777dab0Sopenharmony_ci        char* variant,
4557777dab0Sopenharmony_ci        int32_t variantCapacity,
4567777dab0Sopenharmony_ci        UErrorCode* err);
4577777dab0Sopenharmony_ci
4587777dab0Sopenharmony_ci
4597777dab0Sopenharmony_ci/**
4607777dab0Sopenharmony_ci * Gets the full name for the specified locale.
4617777dab0Sopenharmony_ci * Note: This has the effect of 'canonicalizing' the ICU locale ID to
4627777dab0Sopenharmony_ci * a certain extent. Upper and lower case are set as needed.
4637777dab0Sopenharmony_ci * It does NOT map aliased names in any way.
4647777dab0Sopenharmony_ci * See the top of this header file.
4657777dab0Sopenharmony_ci * This API supports preflighting.
4667777dab0Sopenharmony_ci *
4677777dab0Sopenharmony_ci * @param localeID the locale to get the full name with
4687777dab0Sopenharmony_ci * @param name fill in buffer for the name without keywords.
4697777dab0Sopenharmony_ci * @param nameCapacity capacity of the fill in buffer.
4707777dab0Sopenharmony_ci * @param err error information if retrieving the full name failed
4717777dab0Sopenharmony_ci * @return the actual buffer size needed for the full name.  If it's greater
4727777dab0Sopenharmony_ci * than nameCapacity, the returned full name will be truncated.
4737777dab0Sopenharmony_ci * @stable ICU 2.0
4747777dab0Sopenharmony_ci */
4757777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
4767777dab0Sopenharmony_ciuloc_getName(const char*    localeID,
4777777dab0Sopenharmony_ci         char* name,
4787777dab0Sopenharmony_ci         int32_t nameCapacity,
4797777dab0Sopenharmony_ci         UErrorCode* err);
4807777dab0Sopenharmony_ci
4817777dab0Sopenharmony_ci/**
4827777dab0Sopenharmony_ci * Gets the full name for the specified locale.
4837777dab0Sopenharmony_ci * Note: This has the effect of 'canonicalizing' the string to
4847777dab0Sopenharmony_ci * a certain extent. Upper and lower case are set as needed,
4857777dab0Sopenharmony_ci * and if the components were in 'POSIX' format they are changed to
4867777dab0Sopenharmony_ci * ICU format.  It does NOT map aliased names in any way.
4877777dab0Sopenharmony_ci * See the top of this header file.
4887777dab0Sopenharmony_ci *
4897777dab0Sopenharmony_ci * @param localeID the locale to get the full name with
4907777dab0Sopenharmony_ci * @param name the full name for localeID
4917777dab0Sopenharmony_ci * @param nameCapacity the size of the name buffer to store the
4927777dab0Sopenharmony_ci * full name with
4937777dab0Sopenharmony_ci * @param err error information if retrieving the full name failed
4947777dab0Sopenharmony_ci * @return the actual buffer size needed for the full name.  If it's greater
4957777dab0Sopenharmony_ci * than nameCapacity, the returned full name will be truncated.
4967777dab0Sopenharmony_ci * @stable ICU 2.8
4977777dab0Sopenharmony_ci */
4987777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
4997777dab0Sopenharmony_ciuloc_canonicalize(const char*    localeID,
5007777dab0Sopenharmony_ci         char* name,
5017777dab0Sopenharmony_ci         int32_t nameCapacity,
5027777dab0Sopenharmony_ci         UErrorCode* err);
5037777dab0Sopenharmony_ci
5047777dab0Sopenharmony_ci/**
5057777dab0Sopenharmony_ci * Gets the ISO language code for the specified locale.
5067777dab0Sopenharmony_ci *
5077777dab0Sopenharmony_ci * @param localeID the locale to get the ISO language code with
5087777dab0Sopenharmony_ci * @return language the ISO language code for localeID
5097777dab0Sopenharmony_ci * @stable ICU 2.0
5107777dab0Sopenharmony_ci */
5117777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
5127777dab0Sopenharmony_ciuloc_getISO3Language(const char* localeID);
5137777dab0Sopenharmony_ci
5147777dab0Sopenharmony_ci
5157777dab0Sopenharmony_ci/**
5167777dab0Sopenharmony_ci * Gets the ISO country code for the specified locale.
5177777dab0Sopenharmony_ci *
5187777dab0Sopenharmony_ci * @param localeID the locale to get the ISO country code with
5197777dab0Sopenharmony_ci * @return country the ISO country code for localeID
5207777dab0Sopenharmony_ci * @stable ICU 2.0
5217777dab0Sopenharmony_ci */
5227777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
5237777dab0Sopenharmony_ciuloc_getISO3Country(const char* localeID);
5247777dab0Sopenharmony_ci
5257777dab0Sopenharmony_ci/**
5267777dab0Sopenharmony_ci * Gets the Win32 LCID value for the specified locale.
5277777dab0Sopenharmony_ci * If the ICU locale is not recognized by Windows, 0 will be returned.
5287777dab0Sopenharmony_ci *
5297777dab0Sopenharmony_ci * LCIDs were deprecated with Windows Vista and Microsoft recommends
5307777dab0Sopenharmony_ci * that developers use BCP47 style tags instead (uloc_toLanguageTag).
5317777dab0Sopenharmony_ci *
5327777dab0Sopenharmony_ci * @param localeID the locale to get the Win32 LCID value with
5337777dab0Sopenharmony_ci * @return country the Win32 LCID for localeID
5347777dab0Sopenharmony_ci * @stable ICU 2.0
5357777dab0Sopenharmony_ci */
5367777dab0Sopenharmony_ciU_CAPI uint32_t U_EXPORT2
5377777dab0Sopenharmony_ciuloc_getLCID(const char* localeID);
5387777dab0Sopenharmony_ci
5397777dab0Sopenharmony_ci/**
5407777dab0Sopenharmony_ci * Gets the language name suitable for display for the specified locale.
5417777dab0Sopenharmony_ci *
5427777dab0Sopenharmony_ci * @param locale the locale to get the ISO language code with
5437777dab0Sopenharmony_ci * @param displayLocale Specifies the locale to be used to display the name. In
5447777dab0Sopenharmony_ci *                 other words, if the locale's language code is "en", passing
5457777dab0Sopenharmony_ci *                 Locale::getFrench() for inLocale would result in "Anglais",
5467777dab0Sopenharmony_ci *                 while passing Locale::getGerman() for inLocale would result
5477777dab0Sopenharmony_ci *                 in "Englisch".
5487777dab0Sopenharmony_ci * @param language the displayable language code for localeID
5497777dab0Sopenharmony_ci * @param languageCapacity the size of the language buffer to store the
5507777dab0Sopenharmony_ci *                 displayable language code with.
5517777dab0Sopenharmony_ci * @param status error information if retrieving the displayable language code
5527777dab0Sopenharmony_ci *                 failed. U_USING_DEFAULT_WARNING indicates that no data was
5537777dab0Sopenharmony_ci *                 found from the locale resources and a case canonicalized
5547777dab0Sopenharmony_ci *                 language code is placed into language as fallback.
5557777dab0Sopenharmony_ci * @return the actual buffer size needed for the displayable language code. If
5567777dab0Sopenharmony_ci *                 it's greater than languageCapacity, the returned language
5577777dab0Sopenharmony_ci *                 code will be truncated.
5587777dab0Sopenharmony_ci * @stable ICU 2.0
5597777dab0Sopenharmony_ci */
5607777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
5617777dab0Sopenharmony_ciuloc_getDisplayLanguage(const char* locale,
5627777dab0Sopenharmony_ci            const char* displayLocale,
5637777dab0Sopenharmony_ci            UChar* language,
5647777dab0Sopenharmony_ci            int32_t languageCapacity,
5657777dab0Sopenharmony_ci            UErrorCode* status);
5667777dab0Sopenharmony_ci
5677777dab0Sopenharmony_ci/**
5687777dab0Sopenharmony_ci * Gets the script name suitable for display for the specified locale.
5697777dab0Sopenharmony_ci *
5707777dab0Sopenharmony_ci * @param locale the locale to get the displayable script code with. NULL may be
5717777dab0Sopenharmony_ci *                 used to specify the default.
5727777dab0Sopenharmony_ci * @param displayLocale Specifies the locale to be used to display the name. In
5737777dab0Sopenharmony_ci *                 other words, if the locale's language code is "en", passing
5747777dab0Sopenharmony_ci *                 Locale::getFrench() for inLocale would result in "", while
5757777dab0Sopenharmony_ci *                 passing Locale::getGerman() for inLocale would result in "".
5767777dab0Sopenharmony_ci *                 NULL may be used to specify the default.
5777777dab0Sopenharmony_ci * @param script the displayable script for the localeID.
5787777dab0Sopenharmony_ci * @param scriptCapacity the size of the script buffer to store the displayable
5797777dab0Sopenharmony_ci *                 script code with.
5807777dab0Sopenharmony_ci * @param status error information if retrieving the displayable script code
5817777dab0Sopenharmony_ci *                 failed. U_USING_DEFAULT_WARNING indicates that no data was
5827777dab0Sopenharmony_ci *                 found from the locale resources and a case canonicalized
5837777dab0Sopenharmony_ci *                 script code is placed into script as fallback.
5847777dab0Sopenharmony_ci * @return the actual buffer size needed for the displayable script code. If
5857777dab0Sopenharmony_ci *                 it's greater than scriptCapacity, the returned displayable
5867777dab0Sopenharmony_ci *                 script code will be truncated.
5877777dab0Sopenharmony_ci * @stable ICU 2.8
5887777dab0Sopenharmony_ci */
5897777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
5907777dab0Sopenharmony_ciuloc_getDisplayScript(const char* locale,
5917777dab0Sopenharmony_ci            const char* displayLocale,
5927777dab0Sopenharmony_ci            UChar* script,
5937777dab0Sopenharmony_ci            int32_t scriptCapacity,
5947777dab0Sopenharmony_ci            UErrorCode* status);
5957777dab0Sopenharmony_ci
5967777dab0Sopenharmony_ci/**
5977777dab0Sopenharmony_ci * Gets the country name suitable for display for the specified locale.
5987777dab0Sopenharmony_ci * Warning: this is for the region part of a valid locale ID; it cannot just be
5997777dab0Sopenharmony_ci * the region code (like "FR"). To get the display name for a region alone, or
6007777dab0Sopenharmony_ci * for other options, use ULocaleDisplayNames instead.
6017777dab0Sopenharmony_ci *
6027777dab0Sopenharmony_ci * @param locale the locale to get the displayable country code with. NULL may
6037777dab0Sopenharmony_ci *                 be used to specify the default.
6047777dab0Sopenharmony_ci * @param displayLocale Specifies the locale to be used to display the name. In
6057777dab0Sopenharmony_ci *                 other words, if the locale's language code is "en", passing
6067777dab0Sopenharmony_ci *                 Locale::getFrench() for inLocale would result in "Anglais",
6077777dab0Sopenharmony_ci *                 while passing Locale::getGerman() for inLocale would result
6087777dab0Sopenharmony_ci *                 in "Englisch". NULL may be used to specify the default.
6097777dab0Sopenharmony_ci * @param country the displayable country code for localeID.
6107777dab0Sopenharmony_ci * @param countryCapacity the size of the country buffer to store the
6117777dab0Sopenharmony_ci *                 displayable country code with.
6127777dab0Sopenharmony_ci * @param status error information if retrieving the displayable country code
6137777dab0Sopenharmony_ci *                 failed. U_USING_DEFAULT_WARNING indicates that no data was
6147777dab0Sopenharmony_ci *                 found from the locale resources and a case canonicalized
6157777dab0Sopenharmony_ci *                 country code is placed into country as fallback.
6167777dab0Sopenharmony_ci * @return the actual buffer size needed for the displayable country code. If
6177777dab0Sopenharmony_ci *                 it's greater than countryCapacity, the returned displayable
6187777dab0Sopenharmony_ci *                 country code will be truncated.
6197777dab0Sopenharmony_ci * @stable ICU 2.0
6207777dab0Sopenharmony_ci */
6217777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
6227777dab0Sopenharmony_ciuloc_getDisplayCountry(const char* locale,
6237777dab0Sopenharmony_ci                       const char* displayLocale,
6247777dab0Sopenharmony_ci                       UChar* country,
6257777dab0Sopenharmony_ci                       int32_t countryCapacity,
6267777dab0Sopenharmony_ci                       UErrorCode* status);
6277777dab0Sopenharmony_ci
6287777dab0Sopenharmony_ci
6297777dab0Sopenharmony_ci/**
6307777dab0Sopenharmony_ci * Gets the variant name suitable for display for the specified locale.
6317777dab0Sopenharmony_ci *
6327777dab0Sopenharmony_ci * @param locale the locale to get the displayable variant code with. NULL may
6337777dab0Sopenharmony_ci *                 be used to specify the default.
6347777dab0Sopenharmony_ci * @param displayLocale Specifies the locale to be used to display the name. In
6357777dab0Sopenharmony_ci *                 other words, if the locale's language code is "en", passing
6367777dab0Sopenharmony_ci *                 Locale::getFrench() for inLocale would result in "Anglais",
6377777dab0Sopenharmony_ci *                 while passing Locale::getGerman() for inLocale would result
6387777dab0Sopenharmony_ci *                 in "Englisch". NULL may be used to specify the default.
6397777dab0Sopenharmony_ci * @param variant the displayable variant code for localeID.
6407777dab0Sopenharmony_ci * @param variantCapacity the size of the variant buffer to store the
6417777dab0Sopenharmony_ci *                 displayable variant code with.
6427777dab0Sopenharmony_ci * @param status error information if retrieving the displayable variant code
6437777dab0Sopenharmony_ci *                 failed. U_USING_DEFAULT_WARNING indicates that no data was
6447777dab0Sopenharmony_ci *                 found from the locale resources and a case canonicalized
6457777dab0Sopenharmony_ci *                 variant code is placed into variant as fallback.
6467777dab0Sopenharmony_ci * @return the actual buffer size needed for the displayable variant code. If
6477777dab0Sopenharmony_ci *                 it's greater than variantCapacity, the returned displayable
6487777dab0Sopenharmony_ci *                 variant code will be truncated.
6497777dab0Sopenharmony_ci * @stable ICU 2.0
6507777dab0Sopenharmony_ci */
6517777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
6527777dab0Sopenharmony_ciuloc_getDisplayVariant(const char* locale,
6537777dab0Sopenharmony_ci                       const char* displayLocale,
6547777dab0Sopenharmony_ci                       UChar* variant,
6557777dab0Sopenharmony_ci                       int32_t variantCapacity,
6567777dab0Sopenharmony_ci                       UErrorCode* status);
6577777dab0Sopenharmony_ci
6587777dab0Sopenharmony_ci/**
6597777dab0Sopenharmony_ci * Gets the keyword name suitable for display for the specified locale. E.g:
6607777dab0Sopenharmony_ci * for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
6617777dab0Sopenharmony_ci * string for the keyword collation.
6627777dab0Sopenharmony_ci * Usage:
6637777dab0Sopenharmony_ci * <code>
6647777dab0Sopenharmony_ci *    UErrorCode status = U_ZERO_ERROR;
6657777dab0Sopenharmony_ci *    const char* keyword =NULL;
6667777dab0Sopenharmony_ci *    int32_t keywordLen = 0;
6677777dab0Sopenharmony_ci *    int32_t keywordCount = 0;
6687777dab0Sopenharmony_ci *    UChar displayKeyword[256];
6697777dab0Sopenharmony_ci *    int32_t displayKeywordLen = 0;
6707777dab0Sopenharmony_ci *    UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status);
6717777dab0Sopenharmony_ci *    for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){
6727777dab0Sopenharmony_ci *          if(U_FAILURE(status)){
6737777dab0Sopenharmony_ci *              ...something went wrong so handle the error...
6747777dab0Sopenharmony_ci *              break;
6757777dab0Sopenharmony_ci *          }
6767777dab0Sopenharmony_ci *          // the uenum_next returns NUL terminated string
6777777dab0Sopenharmony_ci *          keyword = uenum_next(keywordEnum, &keywordLen, &status);
6787777dab0Sopenharmony_ci *          displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256);
6797777dab0Sopenharmony_ci *          ... do something interesting .....
6807777dab0Sopenharmony_ci *    }
6817777dab0Sopenharmony_ci *    uenum_close(keywordEnum);
6827777dab0Sopenharmony_ci * </code>
6837777dab0Sopenharmony_ci * @param keyword           The keyword whose display string needs to be returned.
6847777dab0Sopenharmony_ci * @param displayLocale     Specifies the locale to be used to display the name.  In other words,
6857777dab0Sopenharmony_ci *                          if the locale's language code is "en", passing Locale::getFrench() for
6867777dab0Sopenharmony_ci *                          inLocale would result in "Anglais", while passing Locale::getGerman()
6877777dab0Sopenharmony_ci *                          for inLocale would result in "Englisch". NULL may be used to specify the default.
6887777dab0Sopenharmony_ci * @param dest              the buffer to which the displayable keyword should be written.
6897777dab0Sopenharmony_ci * @param destCapacity      The size of the buffer (number of UChars). If it is 0, then
6907777dab0Sopenharmony_ci *                          dest may be NULL and the function will only return the length of the
6917777dab0Sopenharmony_ci *                          result without writing any of the result string (pre-flighting).
6927777dab0Sopenharmony_ci * @param status            error information if retrieving the displayable string failed.
6937777dab0Sopenharmony_ci *                          Should not be NULL and should not indicate failure on entry.
6947777dab0Sopenharmony_ci *                          U_USING_DEFAULT_WARNING indicates that no data was found from the locale
6957777dab0Sopenharmony_ci *                          resources and the keyword is placed into dest as fallback.
6967777dab0Sopenharmony_ci * @return the actual buffer size needed for the displayable variant code.
6977777dab0Sopenharmony_ci * @see #uloc_openKeywords
6987777dab0Sopenharmony_ci * @stable ICU 2.8
6997777dab0Sopenharmony_ci */
7007777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
7017777dab0Sopenharmony_ciuloc_getDisplayKeyword(const char* keyword,
7027777dab0Sopenharmony_ci                       const char* displayLocale,
7037777dab0Sopenharmony_ci                       UChar* dest,
7047777dab0Sopenharmony_ci                       int32_t destCapacity,
7057777dab0Sopenharmony_ci                       UErrorCode* status);
7067777dab0Sopenharmony_ci/**
7077777dab0Sopenharmony_ci * Gets the value of the keyword suitable for display for the specified locale.
7087777dab0Sopenharmony_ci * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display
7097777dab0Sopenharmony_ci * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword.
7107777dab0Sopenharmony_ci *
7117777dab0Sopenharmony_ci * @param locale            The locale to get the displayable variant code with. NULL may be used to specify the default.
7127777dab0Sopenharmony_ci * @param keyword           The keyword for whose value should be used.
7137777dab0Sopenharmony_ci * @param displayLocale     Specifies the locale to be used to display the name.  In other words,
7147777dab0Sopenharmony_ci *                          if the locale's language code is "en", passing Locale::getFrench() for
7157777dab0Sopenharmony_ci *                          inLocale would result in "Anglais", while passing Locale::getGerman()
7167777dab0Sopenharmony_ci *                          for inLocale would result in "Englisch". NULL may be used to specify the default.
7177777dab0Sopenharmony_ci * @param dest              the buffer to which the displayable keyword should be written.
7187777dab0Sopenharmony_ci * @param destCapacity      The size of the buffer (number of UChars). If it is 0, then
7197777dab0Sopenharmony_ci *                          dest may be NULL and the function will only return the length of the
7207777dab0Sopenharmony_ci *                          result without writing any of the result string (pre-flighting).
7217777dab0Sopenharmony_ci * @param status            error information if retrieving the displayable string failed.
7227777dab0Sopenharmony_ci *                          Should not be NULL and must not indicate failure on entry.
7237777dab0Sopenharmony_ci *                          U_USING_DEFAULT_WARNING indicates that no data was found from the locale
7247777dab0Sopenharmony_ci *                          resources and the value of the keyword is placed into dest as fallback.
7257777dab0Sopenharmony_ci * @return the actual buffer size needed for the displayable variant code.
7267777dab0Sopenharmony_ci * @stable ICU 2.8
7277777dab0Sopenharmony_ci */
7287777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
7297777dab0Sopenharmony_ciuloc_getDisplayKeywordValue(   const char* locale,
7307777dab0Sopenharmony_ci                               const char* keyword,
7317777dab0Sopenharmony_ci                               const char* displayLocale,
7327777dab0Sopenharmony_ci                               UChar* dest,
7337777dab0Sopenharmony_ci                               int32_t destCapacity,
7347777dab0Sopenharmony_ci                               UErrorCode* status);
7357777dab0Sopenharmony_ci/**
7367777dab0Sopenharmony_ci * Gets the full name suitable for display for the specified locale.
7377777dab0Sopenharmony_ci *
7387777dab0Sopenharmony_ci * @param localeID the locale to get the displayable name with. NULL may be used to specify the default.
7397777dab0Sopenharmony_ci * @param inLocaleID Specifies the locale to be used to display the name.  In other words,
7407777dab0Sopenharmony_ci *                   if the locale's language code is "en", passing Locale::getFrench() for
7417777dab0Sopenharmony_ci *                   inLocale would result in "Anglais", while passing Locale::getGerman()
7427777dab0Sopenharmony_ci *                   for inLocale would result in "Englisch". NULL may be used to specify the default.
7437777dab0Sopenharmony_ci * @param result the displayable name for localeID
7447777dab0Sopenharmony_ci * @param maxResultSize the size of the name buffer to store the
7457777dab0Sopenharmony_ci * displayable full name with
7467777dab0Sopenharmony_ci * @param err error information if retrieving the displayable name failed
7477777dab0Sopenharmony_ci * @return the actual buffer size needed for the displayable name.  If it's greater
7487777dab0Sopenharmony_ci * than maxResultSize, the returned displayable name will be truncated.
7497777dab0Sopenharmony_ci * @stable ICU 2.0
7507777dab0Sopenharmony_ci */
7517777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
7527777dab0Sopenharmony_ciuloc_getDisplayName(const char* localeID,
7537777dab0Sopenharmony_ci            const char* inLocaleID,
7547777dab0Sopenharmony_ci            UChar* result,
7557777dab0Sopenharmony_ci            int32_t maxResultSize,
7567777dab0Sopenharmony_ci            UErrorCode* err);
7577777dab0Sopenharmony_ci
7587777dab0Sopenharmony_ci
7597777dab0Sopenharmony_ci/**
7607777dab0Sopenharmony_ci * Gets the specified locale from a list of available locales.
7617777dab0Sopenharmony_ci *
7627777dab0Sopenharmony_ci * This method corresponds to uloc_openAvailableByType called with the
7637777dab0Sopenharmony_ci * ULOC_AVAILABLE_DEFAULT type argument.
7647777dab0Sopenharmony_ci *
7657777dab0Sopenharmony_ci * The return value is a pointer to an item of a locale name array. Both this
7667777dab0Sopenharmony_ci * array and the pointers it contains are owned by ICU and should not be
7677777dab0Sopenharmony_ci * deleted or written through by the caller. The locale name is terminated by
7687777dab0Sopenharmony_ci * a null pointer.
7697777dab0Sopenharmony_ci *
7707777dab0Sopenharmony_ci * @param n the specific locale name index of the available locale list;
7717777dab0Sopenharmony_ci *     should not exceed the number returned by uloc_countAvailable.
7727777dab0Sopenharmony_ci * @return a specified locale name of all available locales
7737777dab0Sopenharmony_ci * @stable ICU 2.0
7747777dab0Sopenharmony_ci */
7757777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
7767777dab0Sopenharmony_ciuloc_getAvailable(int32_t n);
7777777dab0Sopenharmony_ci
7787777dab0Sopenharmony_ci/**
7797777dab0Sopenharmony_ci * Gets the size of the all available locale list.
7807777dab0Sopenharmony_ci *
7817777dab0Sopenharmony_ci * @return the size of the locale list
7827777dab0Sopenharmony_ci * @stable ICU 2.0
7837777dab0Sopenharmony_ci */
7847777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2 uloc_countAvailable(void);
7857777dab0Sopenharmony_ci
7867777dab0Sopenharmony_ci/**
7877777dab0Sopenharmony_ci * Types for uloc_getAvailableByType and uloc_countAvailableByType.
7887777dab0Sopenharmony_ci *
7897777dab0Sopenharmony_ci * @stable ICU 65
7907777dab0Sopenharmony_ci */
7917777dab0Sopenharmony_citypedef enum ULocAvailableType {
7927777dab0Sopenharmony_ci  /**
7937777dab0Sopenharmony_ci   * Locales that return data when passed to ICU APIs,
7947777dab0Sopenharmony_ci   * but not including legacy or alias locales.
7957777dab0Sopenharmony_ci   *
7967777dab0Sopenharmony_ci   * @stable ICU 65
7977777dab0Sopenharmony_ci   */
7987777dab0Sopenharmony_ci  ULOC_AVAILABLE_DEFAULT,
7997777dab0Sopenharmony_ci
8007777dab0Sopenharmony_ci  /**
8017777dab0Sopenharmony_ci   * Legacy or alias locales that return data when passed to ICU APIs.
8027777dab0Sopenharmony_ci   * Examples of supported legacy or alias locales:
8037777dab0Sopenharmony_ci   *
8047777dab0Sopenharmony_ci   * - iw (alias to he)
8057777dab0Sopenharmony_ci   * - mo (alias to ro)
8067777dab0Sopenharmony_ci   * - zh_CN (alias to zh_Hans_CN)
8077777dab0Sopenharmony_ci   * - sr_BA (alias to sr_Cyrl_BA)
8087777dab0Sopenharmony_ci   * - ars (alias to ar_SA)
8097777dab0Sopenharmony_ci   *
8107777dab0Sopenharmony_ci   * The locales in this set are disjoint from the ones in
8117777dab0Sopenharmony_ci   * ULOC_AVAILABLE_DEFAULT. To get both sets at the same time, use
8127777dab0Sopenharmony_ci   * ULOC_AVAILABLE_WITH_LEGACY_ALIASES.
8137777dab0Sopenharmony_ci   *
8147777dab0Sopenharmony_ci   * @stable ICU 65
8157777dab0Sopenharmony_ci   */
8167777dab0Sopenharmony_ci  ULOC_AVAILABLE_ONLY_LEGACY_ALIASES,
8177777dab0Sopenharmony_ci
8187777dab0Sopenharmony_ci  /**
8197777dab0Sopenharmony_ci   * The union of the locales in ULOC_AVAILABLE_DEFAULT and
8207777dab0Sopenharmony_ci   * ULOC_AVAILABLE_ONLY_LEGACY_ALIAS.
8217777dab0Sopenharmony_ci   *
8227777dab0Sopenharmony_ci   * @stable ICU 65
8237777dab0Sopenharmony_ci   */
8247777dab0Sopenharmony_ci  ULOC_AVAILABLE_WITH_LEGACY_ALIASES,
8257777dab0Sopenharmony_ci
8267777dab0Sopenharmony_ci#ifndef U_HIDE_INTERNAL_API
8277777dab0Sopenharmony_ci  /**
8287777dab0Sopenharmony_ci   * @internal
8297777dab0Sopenharmony_ci   */
8307777dab0Sopenharmony_ci  ULOC_AVAILABLE_COUNT
8317777dab0Sopenharmony_ci#endif  /* U_HIDE_INTERNAL_API */
8327777dab0Sopenharmony_ci} ULocAvailableType;
8337777dab0Sopenharmony_ci
8347777dab0Sopenharmony_ci/**
8357777dab0Sopenharmony_ci * Gets a list of available locales according to the type argument, allowing
8367777dab0Sopenharmony_ci * the user to access different sets of supported locales in ICU.
8377777dab0Sopenharmony_ci *
8387777dab0Sopenharmony_ci * The returned UEnumeration must be closed by the caller.
8397777dab0Sopenharmony_ci *
8407777dab0Sopenharmony_ci * @param type Type choice from ULocAvailableType.
8417777dab0Sopenharmony_ci * @param status Set if an error occurred.
8427777dab0Sopenharmony_ci * @return a UEnumeration owned by the caller, or nullptr on failure.
8437777dab0Sopenharmony_ci * @stable ICU 65
8447777dab0Sopenharmony_ci */
8457777dab0Sopenharmony_ciU_CAPI UEnumeration* U_EXPORT2
8467777dab0Sopenharmony_ciuloc_openAvailableByType(ULocAvailableType type, UErrorCode* status);
8477777dab0Sopenharmony_ci
8487777dab0Sopenharmony_ci/**
8497777dab0Sopenharmony_ci *
8507777dab0Sopenharmony_ci * Gets a list of all available 2-letter language codes defined in ISO 639,
8517777dab0Sopenharmony_ci * plus additional 3-letter codes determined to be useful for locale generation as
8527777dab0Sopenharmony_ci * defined by Unicode CLDR. This is a pointer
8537777dab0Sopenharmony_ci * to an array of pointers to arrays of char.  All of these pointers are owned
8547777dab0Sopenharmony_ci * by ICU-- do not delete them, and do not write through them.  The array is
8557777dab0Sopenharmony_ci * terminated with a null pointer.
8567777dab0Sopenharmony_ci * @return a list of all available language codes
8577777dab0Sopenharmony_ci * @stable ICU 2.0
8587777dab0Sopenharmony_ci */
8597777dab0Sopenharmony_ciU_CAPI const char* const* U_EXPORT2
8607777dab0Sopenharmony_ciuloc_getISOLanguages(void);
8617777dab0Sopenharmony_ci
8627777dab0Sopenharmony_ci/**
8637777dab0Sopenharmony_ci *
8647777dab0Sopenharmony_ci * Gets a list of all available 2-letter country codes defined in ISO 639.  This is a
8657777dab0Sopenharmony_ci * pointer to an array of pointers to arrays of char.  All of these pointers are
8667777dab0Sopenharmony_ci * owned by ICU-- do not delete them, and do not write through them.  The array is
8677777dab0Sopenharmony_ci * terminated with a null pointer.
8687777dab0Sopenharmony_ci * @return a list of all available country codes
8697777dab0Sopenharmony_ci * @stable ICU 2.0
8707777dab0Sopenharmony_ci */
8717777dab0Sopenharmony_ciU_CAPI const char* const* U_EXPORT2
8727777dab0Sopenharmony_ciuloc_getISOCountries(void);
8737777dab0Sopenharmony_ci
8747777dab0Sopenharmony_ci/**
8757777dab0Sopenharmony_ci * Truncate the locale ID string to get the parent locale ID.
8767777dab0Sopenharmony_ci * Copies the part of the string before the last underscore.
8777777dab0Sopenharmony_ci * The parent locale ID will be an empty string if there is no
8787777dab0Sopenharmony_ci * underscore, or if there is only one underscore at localeID[0].
8797777dab0Sopenharmony_ci *
8807777dab0Sopenharmony_ci * @param localeID Input locale ID string.
8817777dab0Sopenharmony_ci * @param parent   Output string buffer for the parent locale ID.
8827777dab0Sopenharmony_ci * @param parentCapacity Size of the output buffer.
8837777dab0Sopenharmony_ci * @param err A UErrorCode value.
8847777dab0Sopenharmony_ci * @return The length of the parent locale ID.
8857777dab0Sopenharmony_ci * @stable ICU 2.0
8867777dab0Sopenharmony_ci */
8877777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
8887777dab0Sopenharmony_ciuloc_getParent(const char*    localeID,
8897777dab0Sopenharmony_ci                 char* parent,
8907777dab0Sopenharmony_ci                 int32_t parentCapacity,
8917777dab0Sopenharmony_ci                 UErrorCode* err);
8927777dab0Sopenharmony_ci
8937777dab0Sopenharmony_ci
8947777dab0Sopenharmony_ci
8957777dab0Sopenharmony_ci
8967777dab0Sopenharmony_ci/**
8977777dab0Sopenharmony_ci * Gets the full name for the specified locale, like uloc_getName(),
8987777dab0Sopenharmony_ci * but without keywords.
8997777dab0Sopenharmony_ci *
9007777dab0Sopenharmony_ci * Note: This has the effect of 'canonicalizing' the string to
9017777dab0Sopenharmony_ci * a certain extent. Upper and lower case are set as needed,
9027777dab0Sopenharmony_ci * and if the components were in 'POSIX' format they are changed to
9037777dab0Sopenharmony_ci * ICU format.  It does NOT map aliased names in any way.
9047777dab0Sopenharmony_ci * See the top of this header file.
9057777dab0Sopenharmony_ci *
9067777dab0Sopenharmony_ci * This API strips off the keyword part, so "de_DE\@collation=phonebook"
9077777dab0Sopenharmony_ci * will become "de_DE".
9087777dab0Sopenharmony_ci * This API supports preflighting.
9097777dab0Sopenharmony_ci *
9107777dab0Sopenharmony_ci * @param localeID the locale to get the full name with
9117777dab0Sopenharmony_ci * @param name fill in buffer for the name without keywords.
9127777dab0Sopenharmony_ci * @param nameCapacity capacity of the fill in buffer.
9137777dab0Sopenharmony_ci * @param err error information if retrieving the full name failed
9147777dab0Sopenharmony_ci * @return the actual buffer size needed for the full name.  If it's greater
9157777dab0Sopenharmony_ci * than nameCapacity, the returned full name will be truncated.
9167777dab0Sopenharmony_ci * @stable ICU 2.8
9177777dab0Sopenharmony_ci */
9187777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
9197777dab0Sopenharmony_ciuloc_getBaseName(const char*    localeID,
9207777dab0Sopenharmony_ci         char* name,
9217777dab0Sopenharmony_ci         int32_t nameCapacity,
9227777dab0Sopenharmony_ci         UErrorCode* err);
9237777dab0Sopenharmony_ci
9247777dab0Sopenharmony_ci/**
9257777dab0Sopenharmony_ci * Gets an enumeration of keywords for the specified locale. Enumeration
9267777dab0Sopenharmony_ci * must get disposed of by the client using uenum_close function.
9277777dab0Sopenharmony_ci *
9287777dab0Sopenharmony_ci * @param localeID the locale to get the variant code with
9297777dab0Sopenharmony_ci * @param status error information if retrieving the keywords failed
9307777dab0Sopenharmony_ci * @return enumeration of keywords or NULL if there are no keywords.
9317777dab0Sopenharmony_ci * @stable ICU 2.8
9327777dab0Sopenharmony_ci */
9337777dab0Sopenharmony_ciU_CAPI UEnumeration* U_EXPORT2
9347777dab0Sopenharmony_ciuloc_openKeywords(const char* localeID,
9357777dab0Sopenharmony_ci                        UErrorCode* status);
9367777dab0Sopenharmony_ci
9377777dab0Sopenharmony_ci/**
9387777dab0Sopenharmony_ci * Get the value for a keyword. Locale name does not need to be normalized.
9397777dab0Sopenharmony_ci *
9407777dab0Sopenharmony_ci * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK")
9417777dab0Sopenharmony_ci * @param keywordName name of the keyword for which we want the value; must not be
9427777dab0Sopenharmony_ci *  NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
9437777dab0Sopenharmony_ci * @param buffer receiving buffer
9447777dab0Sopenharmony_ci * @param bufferCapacity capacity of receiving buffer
9457777dab0Sopenharmony_ci * @param status containing error code: e.g. buffer not big enough or ill-formed localeID
9467777dab0Sopenharmony_ci *  or keywordName parameters.
9477777dab0Sopenharmony_ci * @return the length of keyword value
9487777dab0Sopenharmony_ci * @stable ICU 2.8
9497777dab0Sopenharmony_ci */
9507777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
9517777dab0Sopenharmony_ciuloc_getKeywordValue(const char* localeID,
9527777dab0Sopenharmony_ci                     const char* keywordName,
9537777dab0Sopenharmony_ci                     char* buffer, int32_t bufferCapacity,
9547777dab0Sopenharmony_ci                     UErrorCode* status);
9557777dab0Sopenharmony_ci
9567777dab0Sopenharmony_ci
9577777dab0Sopenharmony_ci/**
9587777dab0Sopenharmony_ci * Sets or removes the value of the specified keyword.
9597777dab0Sopenharmony_ci *
9607777dab0Sopenharmony_ci * For removing all keywords, use uloc_getBaseName().
9617777dab0Sopenharmony_ci *
9627777dab0Sopenharmony_ci * NOTE: Unlike almost every other ICU function which takes a
9637777dab0Sopenharmony_ci * buffer, this function will NOT truncate the output text, and will
9647777dab0Sopenharmony_ci * not update the buffer with unterminated text setting a status of
9657777dab0Sopenharmony_ci * U_STRING_NOT_TERMINATED_WARNING. If a BUFFER_OVERFLOW_ERROR is received,
9667777dab0Sopenharmony_ci * it means a terminated version of the updated locale ID would not fit
9677777dab0Sopenharmony_ci * in the buffer, and the original buffer is untouched. This is done to
9687777dab0Sopenharmony_ci * prevent incorrect or possibly even malformed locales from being generated
9697777dab0Sopenharmony_ci * and used.
9707777dab0Sopenharmony_ci *
9717777dab0Sopenharmony_ci * @param keywordName name of the keyword to be set; must not be
9727777dab0Sopenharmony_ci *  NULL or empty, and must consist only of [A-Za-z0-9]. Case insensitive.
9737777dab0Sopenharmony_ci * @param keywordValue value of the keyword to be set. If 0-length or
9747777dab0Sopenharmony_ci *  NULL, will result in the keyword being removed; no error is given if
9757777dab0Sopenharmony_ci *  that keyword does not exist. Otherwise, must consist only of
9767777dab0Sopenharmony_ci *  [A-Za-z0-9] and [/_+-].
9777777dab0Sopenharmony_ci * @param buffer input buffer containing well-formed locale ID to be
9787777dab0Sopenharmony_ci *  modified.
9797777dab0Sopenharmony_ci * @param bufferCapacity capacity of receiving buffer
9807777dab0Sopenharmony_ci * @param status containing error code: e.g. buffer not big enough
9817777dab0Sopenharmony_ci *  or ill-formed keywordName or keywordValue parameters, or ill-formed
9827777dab0Sopenharmony_ci *  locale ID in buffer on input.
9837777dab0Sopenharmony_ci * @return the length needed for the buffer
9847777dab0Sopenharmony_ci * @see uloc_getKeywordValue
9857777dab0Sopenharmony_ci * @stable ICU 3.2
9867777dab0Sopenharmony_ci */
9877777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
9887777dab0Sopenharmony_ciuloc_setKeywordValue(const char* keywordName,
9897777dab0Sopenharmony_ci                     const char* keywordValue,
9907777dab0Sopenharmony_ci                     char* buffer, int32_t bufferCapacity,
9917777dab0Sopenharmony_ci                     UErrorCode* status);
9927777dab0Sopenharmony_ci
9937777dab0Sopenharmony_ci/**
9947777dab0Sopenharmony_ci * Returns whether the locale's script is written right-to-left.
9957777dab0Sopenharmony_ci * If there is no script subtag, then the likely script is used, see uloc_addLikelySubtags().
9967777dab0Sopenharmony_ci * If no likely script is known, then false is returned.
9977777dab0Sopenharmony_ci *
9987777dab0Sopenharmony_ci * A script is right-to-left according to the CLDR script metadata
9997777dab0Sopenharmony_ci * which corresponds to whether the script's letters have Bidi_Class=R or AL.
10007777dab0Sopenharmony_ci *
10017777dab0Sopenharmony_ci * Returns true for "ar" and "en-Hebr", false for "zh" and "fa-Cyrl".
10027777dab0Sopenharmony_ci *
10037777dab0Sopenharmony_ci * @param locale input locale ID
10047777dab0Sopenharmony_ci * @return true if the locale's script is written right-to-left
10057777dab0Sopenharmony_ci * @stable ICU 54
10067777dab0Sopenharmony_ci */
10077777dab0Sopenharmony_ciU_CAPI UBool U_EXPORT2
10087777dab0Sopenharmony_ciuloc_isRightToLeft(const char *locale);
10097777dab0Sopenharmony_ci
10107777dab0Sopenharmony_ci/**
10117777dab0Sopenharmony_ci * enums for the  return value for the character and line orientation
10127777dab0Sopenharmony_ci * functions.
10137777dab0Sopenharmony_ci * @stable ICU 4.0
10147777dab0Sopenharmony_ci */
10157777dab0Sopenharmony_citypedef enum {
10167777dab0Sopenharmony_ci  ULOC_LAYOUT_LTR   = 0,  /* left-to-right. */
10177777dab0Sopenharmony_ci  ULOC_LAYOUT_RTL    = 1,  /* right-to-left. */
10187777dab0Sopenharmony_ci  ULOC_LAYOUT_TTB    = 2,  /* top-to-bottom. */
10197777dab0Sopenharmony_ci  ULOC_LAYOUT_BTT    = 3,   /* bottom-to-top. */
10207777dab0Sopenharmony_ci  ULOC_LAYOUT_UNKNOWN
10217777dab0Sopenharmony_ci} ULayoutType;
10227777dab0Sopenharmony_ci
10237777dab0Sopenharmony_ci/**
10247777dab0Sopenharmony_ci * Get the layout character orientation for the specified locale.
10257777dab0Sopenharmony_ci *
10267777dab0Sopenharmony_ci * @param localeId locale name
10277777dab0Sopenharmony_ci * @param status Error status
10287777dab0Sopenharmony_ci * @return an enum indicating the layout orientation for characters.
10297777dab0Sopenharmony_ci * @stable ICU 4.0
10307777dab0Sopenharmony_ci */
10317777dab0Sopenharmony_ciU_CAPI ULayoutType U_EXPORT2
10327777dab0Sopenharmony_ciuloc_getCharacterOrientation(const char* localeId,
10337777dab0Sopenharmony_ci                             UErrorCode *status);
10347777dab0Sopenharmony_ci
10357777dab0Sopenharmony_ci/**
10367777dab0Sopenharmony_ci * Get the layout line orientation for the specified locale.
10377777dab0Sopenharmony_ci *
10387777dab0Sopenharmony_ci * @param localeId locale name
10397777dab0Sopenharmony_ci * @param status Error status
10407777dab0Sopenharmony_ci * @return an enum indicating the layout orientation for lines.
10417777dab0Sopenharmony_ci * @stable ICU 4.0
10427777dab0Sopenharmony_ci */
10437777dab0Sopenharmony_ciU_CAPI ULayoutType U_EXPORT2
10447777dab0Sopenharmony_ciuloc_getLineOrientation(const char* localeId,
10457777dab0Sopenharmony_ci                        UErrorCode *status);
10467777dab0Sopenharmony_ci
10477777dab0Sopenharmony_ci/**
10487777dab0Sopenharmony_ci * Output values which uloc_acceptLanguage() writes to the 'outResult' parameter.
10497777dab0Sopenharmony_ci *
10507777dab0Sopenharmony_ci * @see uloc_acceptLanguageFromHTTP
10517777dab0Sopenharmony_ci * @see uloc_acceptLanguage
10527777dab0Sopenharmony_ci * @stable ICU 3.2
10537777dab0Sopenharmony_ci */
10547777dab0Sopenharmony_citypedef enum {
10557777dab0Sopenharmony_ci    /**
10567777dab0Sopenharmony_ci     * No exact match was found.
10577777dab0Sopenharmony_ci     * @stable ICU 3.2
10587777dab0Sopenharmony_ci     */
10597777dab0Sopenharmony_ci    ULOC_ACCEPT_FAILED   = 0,
10607777dab0Sopenharmony_ci    /**
10617777dab0Sopenharmony_ci     * An exact match was found.
10627777dab0Sopenharmony_ci     * @stable ICU 3.2
10637777dab0Sopenharmony_ci     */
10647777dab0Sopenharmony_ci    ULOC_ACCEPT_VALID    = 1,
10657777dab0Sopenharmony_ci    /**
10667777dab0Sopenharmony_ci     * A fallback was found. For example, the Accept-Language list includes 'ja_JP'
10677777dab0Sopenharmony_ci     * and is matched with available locale 'ja'.
10687777dab0Sopenharmony_ci     * @stable ICU 3.2
10697777dab0Sopenharmony_ci     */
10707777dab0Sopenharmony_ci    ULOC_ACCEPT_FALLBACK = 2   /*  */
10717777dab0Sopenharmony_ci} UAcceptResult;
10727777dab0Sopenharmony_ci
10737777dab0Sopenharmony_ci/**
10747777dab0Sopenharmony_ci * Based on a HTTP header from a web browser and a list of available locales,
10757777dab0Sopenharmony_ci * determine an acceptable locale for the user.
10767777dab0Sopenharmony_ci *
10777777dab0Sopenharmony_ci * This is a thin wrapper over C++ class LocaleMatcher.
10787777dab0Sopenharmony_ci *
10797777dab0Sopenharmony_ci * @param result - buffer to accept the result locale
10807777dab0Sopenharmony_ci * @param resultAvailable the size of the result buffer.
10817777dab0Sopenharmony_ci * @param outResult - An out parameter that contains the fallback status
10827777dab0Sopenharmony_ci * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP.
10837777dab0Sopenharmony_ci * @param availableLocales - list of available locales to match
10847777dab0Sopenharmony_ci * @param status ICU error code. Its input value must pass the U_SUCCESS() test,
10857777dab0Sopenharmony_ci *               or else the function returns immediately. Check for U_FAILURE()
10867777dab0Sopenharmony_ci *               on output or use with function chaining. (See User Guide for details.)
10877777dab0Sopenharmony_ci * @return length needed for the locale.
10887777dab0Sopenharmony_ci * @stable ICU 3.2
10897777dab0Sopenharmony_ci */
10907777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
10917777dab0Sopenharmony_ciuloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
10927777dab0Sopenharmony_ci                            UAcceptResult *outResult,
10937777dab0Sopenharmony_ci                            const char *httpAcceptLanguage,
10947777dab0Sopenharmony_ci                            UEnumeration* availableLocales,
10957777dab0Sopenharmony_ci                            UErrorCode *status);
10967777dab0Sopenharmony_ci
10977777dab0Sopenharmony_ci/**
10987777dab0Sopenharmony_ci * Based on a list of available locales,
10997777dab0Sopenharmony_ci * determine an acceptable locale for the user.
11007777dab0Sopenharmony_ci *
11017777dab0Sopenharmony_ci * This is a thin wrapper over C++ class LocaleMatcher.
11027777dab0Sopenharmony_ci *
11037777dab0Sopenharmony_ci * @param result - buffer to accept the result locale
11047777dab0Sopenharmony_ci * @param resultAvailable the size of the result buffer.
11057777dab0Sopenharmony_ci * @param outResult - An out parameter that contains the fallback status
11067777dab0Sopenharmony_ci * @param acceptList - list of acceptable languages
11077777dab0Sopenharmony_ci * @param acceptListCount - count of acceptList items
11087777dab0Sopenharmony_ci * @param availableLocales - list of available locales to match
11097777dab0Sopenharmony_ci * @param status ICU error code. Its input value must pass the U_SUCCESS() test,
11107777dab0Sopenharmony_ci *               or else the function returns immediately. Check for U_FAILURE()
11117777dab0Sopenharmony_ci *               on output or use with function chaining. (See User Guide for details.)
11127777dab0Sopenharmony_ci * @return length needed for the locale.
11137777dab0Sopenharmony_ci * @stable ICU 3.2
11147777dab0Sopenharmony_ci */
11157777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
11167777dab0Sopenharmony_ciuloc_acceptLanguage(char *result, int32_t resultAvailable,
11177777dab0Sopenharmony_ci                    UAcceptResult *outResult, const char **acceptList,
11187777dab0Sopenharmony_ci                    int32_t acceptListCount,
11197777dab0Sopenharmony_ci                    UEnumeration* availableLocales,
11207777dab0Sopenharmony_ci                    UErrorCode *status);
11217777dab0Sopenharmony_ci
11227777dab0Sopenharmony_ci
11237777dab0Sopenharmony_ci/**
11247777dab0Sopenharmony_ci * Gets the ICU locale ID for the specified Win32 LCID value.
11257777dab0Sopenharmony_ci *
11267777dab0Sopenharmony_ci * @param hostID the Win32 LCID to translate
11277777dab0Sopenharmony_ci * @param locale the output buffer for the ICU locale ID, which will be NUL-terminated
11287777dab0Sopenharmony_ci *  if there is room.
11297777dab0Sopenharmony_ci * @param localeCapacity the size of the output buffer
11307777dab0Sopenharmony_ci * @param status an error is returned if the LCID is unrecognized or the output buffer
11317777dab0Sopenharmony_ci *  is too small
11327777dab0Sopenharmony_ci * @return actual the actual size of the locale ID, not including NUL-termination
11337777dab0Sopenharmony_ci * @stable ICU 3.8
11347777dab0Sopenharmony_ci */
11357777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
11367777dab0Sopenharmony_ciuloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
11377777dab0Sopenharmony_ci                    UErrorCode *status);
11387777dab0Sopenharmony_ci
11397777dab0Sopenharmony_ci
11407777dab0Sopenharmony_ci/**
11417777dab0Sopenharmony_ci * Add the likely subtags for a provided locale ID, per the algorithm described
11427777dab0Sopenharmony_ci * in the following CLDR technical report:
11437777dab0Sopenharmony_ci *
11447777dab0Sopenharmony_ci *   http://www.unicode.org/reports/tr35/#Likely_Subtags
11457777dab0Sopenharmony_ci *
11467777dab0Sopenharmony_ci * If localeID is already in the maximal form, or there is no data available
11477777dab0Sopenharmony_ci * for maximization, it will be copied to the output buffer.  For example,
11487777dab0Sopenharmony_ci * "und-Zzzz" cannot be maximized, since there is no reasonable maximization.
11497777dab0Sopenharmony_ci *
11507777dab0Sopenharmony_ci * Examples:
11517777dab0Sopenharmony_ci *
11527777dab0Sopenharmony_ci * "en" maximizes to "en_Latn_US"
11537777dab0Sopenharmony_ci *
11547777dab0Sopenharmony_ci * "de" maximizes to "de_Latn_US"
11557777dab0Sopenharmony_ci *
11567777dab0Sopenharmony_ci * "sr" maximizes to "sr_Cyrl_RS"
11577777dab0Sopenharmony_ci *
11587777dab0Sopenharmony_ci * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.)
11597777dab0Sopenharmony_ci *
11607777dab0Sopenharmony_ci * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.)
11617777dab0Sopenharmony_ci *
11627777dab0Sopenharmony_ci * @param localeID The locale to maximize
11637777dab0Sopenharmony_ci * @param maximizedLocaleID The maximized locale
11647777dab0Sopenharmony_ci * @param maximizedLocaleIDCapacity The capacity of the maximizedLocaleID buffer
11657777dab0Sopenharmony_ci * @param err Error information if maximizing the locale failed.  If the length
11667777dab0Sopenharmony_ci * of the localeID and the null-terminator is greater than the maximum allowed size,
11677777dab0Sopenharmony_ci * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
11687777dab0Sopenharmony_ci * @return The actual buffer size needed for the maximized locale.  If it's
11697777dab0Sopenharmony_ci * greater than maximizedLocaleIDCapacity, the returned ID will be truncated.
11707777dab0Sopenharmony_ci * On error, the return value is -1.
11717777dab0Sopenharmony_ci * @stable ICU 4.0
11727777dab0Sopenharmony_ci */
11737777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
11747777dab0Sopenharmony_ciuloc_addLikelySubtags(const char*    localeID,
11757777dab0Sopenharmony_ci         char* maximizedLocaleID,
11767777dab0Sopenharmony_ci         int32_t maximizedLocaleIDCapacity,
11777777dab0Sopenharmony_ci         UErrorCode* err);
11787777dab0Sopenharmony_ci
11797777dab0Sopenharmony_ci
11807777dab0Sopenharmony_ci/**
11817777dab0Sopenharmony_ci * Minimize the subtags for a provided locale ID, per the algorithm described
11827777dab0Sopenharmony_ci * in the following CLDR technical report:
11837777dab0Sopenharmony_ci *
11847777dab0Sopenharmony_ci *   http://www.unicode.org/reports/tr35/#Likely_Subtags
11857777dab0Sopenharmony_ci *
11867777dab0Sopenharmony_ci * If localeID is already in the minimal form, or there is no data available
11877777dab0Sopenharmony_ci * for minimization, it will be copied to the output buffer.  Since the
11887777dab0Sopenharmony_ci * minimization algorithm relies on proper maximization, see the comments
11897777dab0Sopenharmony_ci * for uloc_addLikelySubtags for reasons why there might not be any data.
11907777dab0Sopenharmony_ci *
11917777dab0Sopenharmony_ci * Examples:
11927777dab0Sopenharmony_ci *
11937777dab0Sopenharmony_ci * "en_Latn_US" minimizes to "en"
11947777dab0Sopenharmony_ci *
11957777dab0Sopenharmony_ci * "de_Latn_US" minimizes to "de"
11967777dab0Sopenharmony_ci *
11977777dab0Sopenharmony_ci * "sr_Cyrl_RS" minimizes to "sr"
11987777dab0Sopenharmony_ci *
11997777dab0Sopenharmony_ci * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the
12007777dab0Sopenharmony_ci * script, and minimizing to "zh" would imply "zh_Hans_CN".)
12017777dab0Sopenharmony_ci *
12027777dab0Sopenharmony_ci * @param localeID The locale to minimize
12037777dab0Sopenharmony_ci * @param minimizedLocaleID The minimized locale
12047777dab0Sopenharmony_ci * @param minimizedLocaleIDCapacity The capacity of the minimizedLocaleID buffer
12057777dab0Sopenharmony_ci * @param err Error information if minimizing the locale failed.  If the length
12067777dab0Sopenharmony_ci * of the localeID and the null-terminator is greater than the maximum allowed size,
12077777dab0Sopenharmony_ci * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR.
12087777dab0Sopenharmony_ci * @return The actual buffer size needed for the minimized locale.  If it's
12097777dab0Sopenharmony_ci * greater than minimizedLocaleIDCapacity, the returned ID will be truncated.
12107777dab0Sopenharmony_ci * On error, the return value is -1.
12117777dab0Sopenharmony_ci * @stable ICU 4.0
12127777dab0Sopenharmony_ci */
12137777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
12147777dab0Sopenharmony_ciuloc_minimizeSubtags(const char*    localeID,
12157777dab0Sopenharmony_ci         char* minimizedLocaleID,
12167777dab0Sopenharmony_ci         int32_t minimizedLocaleIDCapacity,
12177777dab0Sopenharmony_ci         UErrorCode* err);
12187777dab0Sopenharmony_ci
12197777dab0Sopenharmony_ci/**
12207777dab0Sopenharmony_ci * Returns a locale ID for the specified BCP47 language tag string.
12217777dab0Sopenharmony_ci * If the specified language tag contains any ill-formed subtags,
12227777dab0Sopenharmony_ci * the first such subtag and all following subtags are ignored.
12237777dab0Sopenharmony_ci * <p>
12247777dab0Sopenharmony_ci * This implements the 'Language-Tag' production of BCP 47, and so
12257777dab0Sopenharmony_ci * supports legacy language tags (marked as “Type: grandfathered” in BCP 47)
12267777dab0Sopenharmony_ci * (regular and irregular) as well as private use language tags.
12277777dab0Sopenharmony_ci *
12287777dab0Sopenharmony_ci * Private use tags are represented as 'x-whatever',
12297777dab0Sopenharmony_ci * and legacy tags are converted to their canonical replacements where they exist.
12307777dab0Sopenharmony_ci *
12317777dab0Sopenharmony_ci * Note that a few legacy tags have no modern replacement;
12327777dab0Sopenharmony_ci * these will be converted using the fallback described in
12337777dab0Sopenharmony_ci * the first paragraph, so some information might be lost.
12347777dab0Sopenharmony_ci *
12357777dab0Sopenharmony_ci * @param langtag   the input BCP47 language tag.
12367777dab0Sopenharmony_ci * @param localeID  the output buffer receiving a locale ID for the
12377777dab0Sopenharmony_ci *                  specified BCP47 language tag.
12387777dab0Sopenharmony_ci * @param localeIDCapacity  the size of the locale ID output buffer.
12397777dab0Sopenharmony_ci * @param parsedLength  if not NULL, successfully parsed length
12407777dab0Sopenharmony_ci *                      for the input language tag is set.
12417777dab0Sopenharmony_ci * @param err       error information if receiving the locald ID
12427777dab0Sopenharmony_ci *                  failed.
12437777dab0Sopenharmony_ci * @return          the length of the locale ID.
12447777dab0Sopenharmony_ci * @stable ICU 4.2
12457777dab0Sopenharmony_ci */
12467777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
12477777dab0Sopenharmony_ciuloc_forLanguageTag(const char* langtag,
12487777dab0Sopenharmony_ci                    char* localeID,
12497777dab0Sopenharmony_ci                    int32_t localeIDCapacity,
12507777dab0Sopenharmony_ci                    int32_t* parsedLength,
12517777dab0Sopenharmony_ci                    UErrorCode* err);
12527777dab0Sopenharmony_ci
12537777dab0Sopenharmony_ci/**
12547777dab0Sopenharmony_ci * Returns a well-formed language tag for this locale ID.
12557777dab0Sopenharmony_ci * <p>
12567777dab0Sopenharmony_ci * <b>Note</b>: When <code>strict</code> is false, any locale
12577777dab0Sopenharmony_ci * fields which do not satisfy the BCP47 syntax requirement will
12587777dab0Sopenharmony_ci * be omitted from the result.  When <code>strict</code> is
12597777dab0Sopenharmony_ci * true, this function sets U_ILLEGAL_ARGUMENT_ERROR to the
12607777dab0Sopenharmony_ci * <code>err</code> if any locale fields do not satisfy the
12617777dab0Sopenharmony_ci * BCP47 syntax requirement.
12627777dab0Sopenharmony_ci * @param localeID  the input locale ID
12637777dab0Sopenharmony_ci * @param langtag   the output buffer receiving BCP47 language
12647777dab0Sopenharmony_ci *                  tag for the locale ID.
12657777dab0Sopenharmony_ci * @param langtagCapacity   the size of the BCP47 language tag
12667777dab0Sopenharmony_ci *                          output buffer.
12677777dab0Sopenharmony_ci * @param strict    boolean value indicating if the function returns
12687777dab0Sopenharmony_ci *                  an error for an ill-formed input locale ID.
12697777dab0Sopenharmony_ci * @param err       error information if receiving the language
12707777dab0Sopenharmony_ci *                  tag failed.
12717777dab0Sopenharmony_ci * @return          The length of the BCP47 language tag.
12727777dab0Sopenharmony_ci * @stable ICU 4.2
12737777dab0Sopenharmony_ci */
12747777dab0Sopenharmony_ciU_CAPI int32_t U_EXPORT2
12757777dab0Sopenharmony_ciuloc_toLanguageTag(const char* localeID,
12767777dab0Sopenharmony_ci                   char* langtag,
12777777dab0Sopenharmony_ci                   int32_t langtagCapacity,
12787777dab0Sopenharmony_ci                   UBool strict,
12797777dab0Sopenharmony_ci                   UErrorCode* err);
12807777dab0Sopenharmony_ci
12817777dab0Sopenharmony_ci/**
12827777dab0Sopenharmony_ci * Converts the specified keyword (legacy key, or BCP 47 Unicode locale
12837777dab0Sopenharmony_ci * extension key) to the equivalent BCP 47 Unicode locale extension key.
12847777dab0Sopenharmony_ci * For example, BCP 47 Unicode locale extension key "co" is returned for
12857777dab0Sopenharmony_ci * the input keyword "collation".
12867777dab0Sopenharmony_ci * <p>
12877777dab0Sopenharmony_ci * When the specified keyword is unknown, but satisfies the BCP syntax,
12887777dab0Sopenharmony_ci * then the pointer to the input keyword itself will be returned.
12897777dab0Sopenharmony_ci * For example,
12907777dab0Sopenharmony_ci * <code>uloc_toUnicodeLocaleKey("ZZ")</code> returns "ZZ".
12917777dab0Sopenharmony_ci *
12927777dab0Sopenharmony_ci * @param keyword       the input locale keyword (either legacy key
12937777dab0Sopenharmony_ci *                      such as "collation" or BCP 47 Unicode locale extension
12947777dab0Sopenharmony_ci *                      key such as "co").
12957777dab0Sopenharmony_ci * @return              the well-formed BCP 47 Unicode locale extension key,
12967777dab0Sopenharmony_ci *                      or NULL if the specified locale keyword cannot be
12977777dab0Sopenharmony_ci *                      mapped to a well-formed BCP 47 Unicode locale extension
12987777dab0Sopenharmony_ci *                      key.
12997777dab0Sopenharmony_ci * @see uloc_toLegacyKey
13007777dab0Sopenharmony_ci * @stable ICU 54
13017777dab0Sopenharmony_ci */
13027777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
13037777dab0Sopenharmony_ciuloc_toUnicodeLocaleKey(const char* keyword);
13047777dab0Sopenharmony_ci
13057777dab0Sopenharmony_ci/**
13067777dab0Sopenharmony_ci * Converts the specified keyword value (legacy type, or BCP 47
13077777dab0Sopenharmony_ci * Unicode locale extension type) to the well-formed BCP 47 Unicode locale
13087777dab0Sopenharmony_ci * extension type for the specified keyword (category). For example, BCP 47
13097777dab0Sopenharmony_ci * Unicode locale extension type "phonebk" is returned for the input
13107777dab0Sopenharmony_ci * keyword value "phonebook", with the keyword "collation" (or "co").
13117777dab0Sopenharmony_ci * <p>
13127777dab0Sopenharmony_ci * When the specified keyword is not recognized, but the specified value
13137777dab0Sopenharmony_ci * satisfies the syntax of the BCP 47 Unicode locale extension type,
13147777dab0Sopenharmony_ci * or when the specified keyword allows 'variable' type and the specified
13157777dab0Sopenharmony_ci * value satisfies the syntax,  then the pointer to the input type value itself
13167777dab0Sopenharmony_ci * will be returned.
13177777dab0Sopenharmony_ci * For example,
13187777dab0Sopenharmony_ci * <code>uloc_toUnicodeLocaleType("Foo", "Bar")</code> returns "Bar",
13197777dab0Sopenharmony_ci * <code>uloc_toUnicodeLocaleType("variableTop", "00A4")</code> returns "00A4".
13207777dab0Sopenharmony_ci *
13217777dab0Sopenharmony_ci * @param keyword       the locale keyword (either legacy key such as
13227777dab0Sopenharmony_ci *                      "collation" or BCP 47 Unicode locale extension
13237777dab0Sopenharmony_ci *                      key such as "co").
13247777dab0Sopenharmony_ci * @param value         the locale keyword value (either legacy type
13257777dab0Sopenharmony_ci *                      such as "phonebook" or BCP 47 Unicode locale extension
13267777dab0Sopenharmony_ci *                      type such as "phonebk").
13277777dab0Sopenharmony_ci * @return              the well-formed BCP47 Unicode locale extension type,
13287777dab0Sopenharmony_ci *                      or NULL if the locale keyword value cannot be mapped to
13297777dab0Sopenharmony_ci *                      a well-formed BCP 47 Unicode locale extension type.
13307777dab0Sopenharmony_ci * @see uloc_toLegacyType
13317777dab0Sopenharmony_ci * @stable ICU 54
13327777dab0Sopenharmony_ci */
13337777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
13347777dab0Sopenharmony_ciuloc_toUnicodeLocaleType(const char* keyword, const char* value);
13357777dab0Sopenharmony_ci
13367777dab0Sopenharmony_ci/**
13377777dab0Sopenharmony_ci * Converts the specified keyword (BCP 47 Unicode locale extension key, or
13387777dab0Sopenharmony_ci * legacy key) to the legacy key. For example, legacy key "collation" is
13397777dab0Sopenharmony_ci * returned for the input BCP 47 Unicode locale extension key "co".
13407777dab0Sopenharmony_ci *
13417777dab0Sopenharmony_ci * @param keyword       the input locale keyword (either BCP 47 Unicode locale
13427777dab0Sopenharmony_ci *                      extension key or legacy key).
13437777dab0Sopenharmony_ci * @return              the well-formed legacy key, or NULL if the specified
13447777dab0Sopenharmony_ci *                      keyword cannot be mapped to a well-formed legacy key.
13457777dab0Sopenharmony_ci * @see toUnicodeLocaleKey
13467777dab0Sopenharmony_ci * @stable ICU 54
13477777dab0Sopenharmony_ci */
13487777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
13497777dab0Sopenharmony_ciuloc_toLegacyKey(const char* keyword);
13507777dab0Sopenharmony_ci
13517777dab0Sopenharmony_ci/**
13527777dab0Sopenharmony_ci * Converts the specified keyword value (BCP 47 Unicode locale extension type,
13537777dab0Sopenharmony_ci * or legacy type or type alias) to the canonical legacy type. For example,
13547777dab0Sopenharmony_ci * the legacy type "phonebook" is returned for the input BCP 47 Unicode
13557777dab0Sopenharmony_ci * locale extension type "phonebk" with the keyword "collation" (or "co").
13567777dab0Sopenharmony_ci * <p>
13577777dab0Sopenharmony_ci * When the specified keyword is not recognized, but the specified value
13587777dab0Sopenharmony_ci * satisfies the syntax of legacy key, or when the specified keyword
13597777dab0Sopenharmony_ci * allows 'variable' type and the specified value satisfies the syntax,
13607777dab0Sopenharmony_ci * then the pointer to the input type value itself will be returned.
13617777dab0Sopenharmony_ci * For example,
13627777dab0Sopenharmony_ci * <code>uloc_toLegacyType("Foo", "Bar")</code> returns "Bar",
13637777dab0Sopenharmony_ci * <code>uloc_toLegacyType("vt", "00A4")</code> returns "00A4".
13647777dab0Sopenharmony_ci *
13657777dab0Sopenharmony_ci * @param keyword       the locale keyword (either legacy keyword such as
13667777dab0Sopenharmony_ci *                      "collation" or BCP 47 Unicode locale extension
13677777dab0Sopenharmony_ci *                      key such as "co").
13687777dab0Sopenharmony_ci * @param value         the locale keyword value (either BCP 47 Unicode locale
13697777dab0Sopenharmony_ci *                      extension type such as "phonebk" or legacy keyword value
13707777dab0Sopenharmony_ci *                      such as "phonebook").
13717777dab0Sopenharmony_ci * @return              the well-formed legacy type, or NULL if the specified
13727777dab0Sopenharmony_ci *                      keyword value cannot be mapped to a well-formed legacy
13737777dab0Sopenharmony_ci *                      type.
13747777dab0Sopenharmony_ci * @see toUnicodeLocaleType
13757777dab0Sopenharmony_ci * @stable ICU 54
13767777dab0Sopenharmony_ci */
13777777dab0Sopenharmony_ciU_CAPI const char* U_EXPORT2
13787777dab0Sopenharmony_ciuloc_toLegacyType(const char* keyword, const char* value);
13797777dab0Sopenharmony_ci
13807777dab0Sopenharmony_ci#endif /*_ULOC*/
1381