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