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