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/** 28427f654740f2a26ad62a5c155af9199af9e69b889claireho * Invariant character separating keywords from the locale string 285b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 286b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 287b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ULOC_KEYWORD_SEPARATOR '@' 28827f654740f2a26ad62a5c155af9199af9e69b889claireho 28927f654740f2a26ad62a5c155af9199af9e69b889claireho/** 29027f654740f2a26ad62a5c155af9199af9e69b889claireho * Unicode code point for '@' separating keywords from the locale string. 29127f654740f2a26ad62a5c155af9199af9e69b889claireho * @see ULOC_KEYWORD_SEPARATOR 29227f654740f2a26ad62a5c155af9199af9e69b889claireho * @draft ICU 4.6 29327f654740f2a26ad62a5c155af9199af9e69b889claireho */ 29427f654740f2a26ad62a5c155af9199af9e69b889claireho#define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40 29527f654740f2a26ad62a5c155af9199af9e69b889claireho 296b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 29727f654740f2a26ad62a5c155af9199af9e69b889claireho * Invariant character for assigning value to a keyword 298b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 299b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 300b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ULOC_KEYWORD_ASSIGN '=' 30127f654740f2a26ad62a5c155af9199af9e69b889claireho 302b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 30327f654740f2a26ad62a5c155af9199af9e69b889claireho * Unicode code point for '=' for assigning value to a keyword. 30427f654740f2a26ad62a5c155af9199af9e69b889claireho * @see ULOC_KEYWORD_ASSIGN 30527f654740f2a26ad62a5c155af9199af9e69b889claireho * @draft ICU 4.6 30627f654740f2a26ad62a5c155af9199af9e69b889claireho */ 30727f654740f2a26ad62a5c155af9199af9e69b889claireho#define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D 30827f654740f2a26ad62a5c155af9199af9e69b889claireho 30927f654740f2a26ad62a5c155af9199af9e69b889claireho/** 31027f654740f2a26ad62a5c155af9199af9e69b889claireho * Invariant character separating keywords 311b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 312b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 313b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#define ULOC_KEYWORD_ITEM_SEPARATOR ';' 314b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 315b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 31627f654740f2a26ad62a5c155af9199af9e69b889claireho * Unicode code point for ';' separating keywords 31727f654740f2a26ad62a5c155af9199af9e69b889claireho * @see ULOC_KEYWORD_ITEM_SEPARATOR 31827f654740f2a26ad62a5c155af9199af9e69b889claireho * @draft ICU 4.6 31927f654740f2a26ad62a5c155af9199af9e69b889claireho */ 32027f654740f2a26ad62a5c155af9199af9e69b889claireho#define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B 32127f654740f2a26ad62a5c155af9199af9e69b889claireho 32227f654740f2a26ad62a5c155af9199af9e69b889claireho/** 323b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Constants for *_getLocale() 324b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Allow user to select whether she wants information on 325b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * requested, valid or actual locale. 326b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * For example, a collator for "en_US_CALIFORNIA" was 327b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * requested. In the current state of ICU (2.0), 328b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the requested locale is "en_US_CALIFORNIA", 329b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the valid locale is "en_US" (most specific locale supported by ICU) 330b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and the actual locale is "root" (the collation data comes unmodified 331b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * from the UCA) 332b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The locale is considered supported by ICU if there is a core ICU bundle 333b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for that locale (although it may be empty). 334b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.1 335b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 336b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum { 337b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** This is locale the data actually comes from 338b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.1 339b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 340b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ULOC_ACTUAL_LOCALE = 0, 341b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** This is the most specific locale supported by ICU 342b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.1 343b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 344b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ULOC_VALID_LOCALE = 1, 345b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 346b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#ifndef U_HIDE_DEPRECATED_API 347b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru /** This is the requested locale 348b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @deprecated ICU 2.8 349b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 350b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ULOC_REQUESTED_LOCALE = 2, 351b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru#endif /* U_HIDE_DEPRECATED_API */ 352b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 353b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ULOC_DATA_LOCALE_TYPE_LIMIT = 3 354b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} ULocDataLocaleType ; 355b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 356b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 357b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 358b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets ICU's default locale. 359b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The returned string is a snapshot in time, and will remain valid 360b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and unchanged even when uloc_setDefault() is called. 361b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The returned storage is owned by ICU, and must not be altered or deleted 362b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * by the caller. 363b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 364b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the ICU default locale 365b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @system 366b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 367b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 368b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char* U_EXPORT2 369b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getDefault(void); 370b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 371b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 372b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Sets ICU's default locale. 373b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * By default (without calling this function), ICU's default locale will be based 374b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * on information obtained from the underlying system environment. 375b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 376b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Changes to ICU's default locale do not propagate back to the 377b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * system environment. 378b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <p> 379b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Changes to ICU's default locale to not affect any ICU services that 380b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * may already be open based on the previous default locale value. 381b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 382b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the new ICU default locale. A value of NULL will try to get 383b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * the system's default locale. 384b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status the error information if the setting of default locale fails 385b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @system 386b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 387b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 388b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE void U_EXPORT2 389b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_setDefault(const char* localeID, 390b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 391b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 392b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 393b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the language code for the specified locale. 394b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 395b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the ISO language code with 396b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param language the language code for localeID 397b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param languageCapacity the size of the language buffer to store the 398b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * language code with 399b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param err error information if retrieving the language code failed 400b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the language code. If it's greater 401b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than languageCapacity, the returned language code will be truncated. 402b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 403b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 404b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 405b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getLanguage(const char* localeID, 406b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* language, 407b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t languageCapacity, 408b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 409b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 410b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 411b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the script code for the specified locale. 412b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 413b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the ISO language code with 414b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param script the language code for localeID 415b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param scriptCapacity the size of the language buffer to store the 416b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * language code with 417b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param err error information if retrieving the language code failed 418b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the language code. If it's greater 419b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than scriptCapacity, the returned language code will be truncated. 420b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 421b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 422b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 423b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getScript(const char* localeID, 424b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* script, 425b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t scriptCapacity, 426b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 427b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 428b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 429b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the country code for the specified locale. 430b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 431b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the country code with 432b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param country the country code for localeID 433b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param countryCapacity the size of the country buffer to store the 434b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * country code with 435b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param err error information if retrieving the country code failed 436b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the country code. If it's greater 437b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than countryCapacity, the returned country code will be truncated. 438b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 439b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 440b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 441b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getCountry(const char* localeID, 442b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* country, 443b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t countryCapacity, 444b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 445b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 446b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 447b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the variant code for the specified locale. 448b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 449b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the variant code with 450b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param variant the variant code for localeID 451b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param variantCapacity the size of the variant buffer to store the 452b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * variant code with 453b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param err error information if retrieving the variant code failed 454b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the variant code. If it's greater 455b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than variantCapacity, the returned variant code will be truncated. 456b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 457b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 458b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 459b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getVariant(const char* localeID, 460b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* variant, 461b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t variantCapacity, 462b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 463b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 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 ICU locale ID to 468b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a certain extent. Upper and lower case are set as needed. 469b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * It does NOT map aliased names in any way. 470b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * See the top of this header file. 471b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This API supports preflighting. 472b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 473b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the full name with 474b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param name fill in buffer for the name without keywords. 475b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param nameCapacity capacity of the fill in buffer. 476b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param err error information if retrieving the full name failed 477b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the full name. If it's greater 478b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than nameCapacity, the returned full name will be truncated. 479b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 480b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 481b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 482b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getName(const char* localeID, 483b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* name, 484b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t nameCapacity, 485b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 486b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 487b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 488b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the full name for the specified locale. 489b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Note: This has the effect of 'canonicalizing' the string to 490b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a certain extent. Upper and lower case are set as needed, 491b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and if the components were in 'POSIX' format they are changed to 492b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ICU format. It does NOT map aliased names in any way. 493b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * See the top of this header file. 494b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 495b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the full name with 496b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param name the full name for localeID 497b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param nameCapacity the size of the name buffer to store the 498b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * full name with 499b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param err error information if retrieving the full name failed 500b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the full name. If it's greater 501b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than nameCapacity, the returned full name will be truncated. 502b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 503b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 504b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 505b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_canonicalize(const char* localeID, 506b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* name, 507b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t nameCapacity, 508b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 509b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 510b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 511b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the ISO language code for the specified locale. 512b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 513b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the ISO language code with 514b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return language the ISO language code for localeID 515b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 516b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 517b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char* U_EXPORT2 518b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getISO3Language(const char* localeID); 519b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 520b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 521b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 522b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the ISO country code for the specified locale. 523b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 524b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the ISO country code with 525b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return country the ISO country code for localeID 526b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 527b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 528b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char* U_EXPORT2 529b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getISO3Country(const char* localeID); 530b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 531b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 532b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the Win32 LCID value for the specified locale. 533b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * If the ICU locale is not recognized by Windows, 0 will be returned. 534b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 535b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the Win32 LCID value with 536b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return country the Win32 LCID for localeID 537b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 538b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 539b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE uint32_t U_EXPORT2 540b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getLCID(const char* localeID); 541b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 542b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 543b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the language name suitable for display for the specified locale. 544b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 545b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale the locale to get the ISO language code with 546b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param displayLocale Specifies the locale to be used to display the name. In other words, 547b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the locale's language code is "en", passing Locale::getFrench() for 548b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * inLocale would result in "Anglais", while passing Locale::getGerman() 549b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for inLocale would result in "Englisch". 550b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param language the displayable language code for localeID 551b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param languageCapacity the size of the language buffer to store the 552b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * displayable language code with 553b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error information if retrieving the displayable language code failed 554b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the displayable language code. If it's greater 555b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than languageCapacity, the returned language code will be truncated. 556b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 557b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 558b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 559b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getDisplayLanguage(const char* locale, 560b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* displayLocale, 561b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar* language, 562b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t languageCapacity, 563b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 564b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 565b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 566b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the script name suitable for display for the specified locale. 567b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 568b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale the locale to get the displayable script code with. NULL may be used to specify the default. 569b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param displayLocale Specifies the locale to be used to display the name. In other words, 570b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the locale's language code is "en", passing Locale::getFrench() for 571b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * inLocale would result in "", while passing Locale::getGerman() 572b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for inLocale would result in "". NULL may be used to specify the default. 573b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param script the displayable country code for localeID 574b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param scriptCapacity the size of the script buffer to store the 575b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * displayable script code with 576b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error information if retrieving the displayable script code failed 577b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the displayable script code. If it's greater 578b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than scriptCapacity, the returned displayable script code will be truncated. 579b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 580b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 581b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 582b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getDisplayScript(const char* locale, 583b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* displayLocale, 584b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar* script, 585b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t scriptCapacity, 586b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 587b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 588b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 589b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the country name suitable for display for the specified locale. 590b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 591b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale the locale to get the displayable country code with. NULL may be used to specify the default. 592b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param displayLocale Specifies the locale to be used to display the name. In other words, 593b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the locale's language code is "en", passing Locale::getFrench() for 594b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * inLocale would result in "Anglais", while passing Locale::getGerman() 595b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for inLocale would result in "Englisch". NULL may be used to specify the default. 596b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param country the displayable country code for localeID 597b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param countryCapacity the size of the country buffer to store the 598b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * displayable country code with 599b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error information if retrieving the displayable country code failed 600b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the displayable country code. If it's greater 601b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than countryCapacity, the returned displayable country code will be truncated. 602b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 603b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 604b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 605b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getDisplayCountry(const char* locale, 606b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* displayLocale, 607b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar* country, 608b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t countryCapacity, 609b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 610b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 611b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 612b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 613b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the variant name suitable for display for the specified locale. 614b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 615b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale the locale to get the displayable variant code with. NULL may be used to specify the default. 616b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param displayLocale Specifies the locale to be used to display the name. In other words, 617b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the locale's language code is "en", passing Locale::getFrench() for 618b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * inLocale would result in "Anglais", while passing Locale::getGerman() 619b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for inLocale would result in "Englisch". NULL may be used to specify the default. 620b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param variant the displayable variant code for localeID 621b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param variantCapacity the size of the variant buffer to store the 622b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * displayable variant code with 623b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error information if retrieving the displayable variant code failed 624b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the displayable variant code. If it's greater 625b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than variantCapacity, the returned displayable variant code will be truncated. 626b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 627b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 628b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 629b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getDisplayVariant(const char* locale, 630b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* displayLocale, 631b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar* variant, 632b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t variantCapacity, 633b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 634b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 635b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 636b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the keyword name suitable for display for the specified locale. 637b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display 638b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * string for the keyword collation. 639b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Usage: 640b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * <code> 641b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UErrorCode status = U_ZERO_ERROR; 642b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * const char* keyword =NULL; 643b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * int32_t keywordLen = 0; 644b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * int32_t keywordCount = 0; 645b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UChar displayKeyword[256]; 646b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * int32_t displayKeywordLen = 0; 647b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status); 648b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){ 649b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if(U_FAILURE(status)){ 650b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ...something went wrong so handle the error... 651b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * break; 652b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * } 653b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * // the uenum_next returns NUL terminated string 654b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * keyword = uenum_next(keywordEnum, &keywordLen, &status); 655b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256); 656b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ... do something interesting ..... 657b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * } 658b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * uenum_close(keywordEnum); 659b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * </code> 660b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param keyword The keyword whose display string needs to be returned. 661b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param displayLocale Specifies the locale to be used to display the name. In other words, 662b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the locale's language code is "en", passing Locale::getFrench() for 663b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * inLocale would result in "Anglais", while passing Locale::getGerman() 664b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for inLocale would result in "Englisch". NULL may be used to specify the default. 665b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest the buffer to which the displayable keyword should be written. 666b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 667b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 668b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 669b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error information if retrieving the displayable string failed. 670b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Should not be NULL and should not indicate failure on entry. 671b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the displayable variant code. 672b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see #uloc_openKeywords 673b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 674b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 675b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 676b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getDisplayKeyword(const char* keyword, 677b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* displayLocale, 678b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar* dest, 679b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 680b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 681b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 682b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the value of the keyword suitable for display for the specified locale. 683b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display 684b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword. 685b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 686b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale The locale to get the displayable variant code with. NULL may be used to specify the default. 687b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param keyword The keyword for whose value should be used. 688b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param displayLocale Specifies the locale to be used to display the name. In other words, 689b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the locale's language code is "en", passing Locale::getFrench() for 690b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * inLocale would result in "Anglais", while passing Locale::getGerman() 691b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for inLocale would result in "Englisch". NULL may be used to specify the default. 692b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param dest the buffer to which the displayable keyword should be written. 693b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param destCapacity The size of the buffer (number of UChars). If it is 0, then 694b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * dest may be NULL and the function will only return the length of the 695b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * result without writing any of the result string (pre-flighting). 696b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error information if retrieving the displayable string failed. 697b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Should not be NULL and must not indicate failure on entry. 698b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the displayable variant code. 699b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 700b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 701b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 702b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getDisplayKeywordValue( const char* locale, 703b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* keyword, 704b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* displayLocale, 705b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar* dest, 706b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t destCapacity, 707b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 708b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 709b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the full name suitable for display for the specified locale. 710b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 711b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the displayable name with. NULL may be used to specify the default. 712b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param inLocaleID Specifies the locale to be used to display the name. In other words, 713b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if the locale's language code is "en", passing Locale::getFrench() for 714b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * inLocale would result in "Anglais", while passing Locale::getGerman() 715b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * for inLocale would result in "Englisch". NULL may be used to specify the default. 716b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result the displayable name for localeID 717b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param maxResultSize the size of the name buffer to store the 718b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * displayable full name with 719b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param err error information if retrieving the displayable name failed 720b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the displayable name. If it's greater 721b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than maxResultSize, the returned displayable name will be truncated. 722b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 723b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 724b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 725b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getDisplayName(const char* localeID, 726b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* inLocaleID, 727b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UChar* result, 728b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t maxResultSize, 729b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 730b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 731b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 732b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 733b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the specified locale from a list of all available locales. 734b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The return value is a pointer to an item of 735b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a locale name array. Both this array and the pointers 736b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * it contains are owned by ICU and should not be deleted or written through 737b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * by the caller. The locale name is terminated by a null pointer. 738b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param n the specific locale name index of the available locale list 739b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a specified locale name of all available locales 740b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 741b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 742b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char* U_EXPORT2 743b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getAvailable(int32_t n); 744b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 745b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 746b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the size of the all available locale list. 747b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 748b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the size of the locale list 749b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 750b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 751b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 uloc_countAvailable(void); 752b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 753b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 754b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 755b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets a list of all available language codes defined in ISO 639. This is a pointer 756b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * to an array of pointers to arrays of char. All of these pointers are owned 757b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * by ICU-- do not delete them, and do not write through them. The array is 758b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * terminated with a null pointer. 759b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a list of all available language codes 760b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 761b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 762b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char* const* U_EXPORT2 763b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getISOLanguages(void); 764b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 765b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 766b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 767b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets a list of all available 2-letter country codes defined in ISO 639. This is a 768b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * pointer to an array of pointers to arrays of char. All of these pointers are 769b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * owned by ICU-- do not delete them, and do not write through them. The array is 770b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * terminated with a null pointer. 771b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return a list of all available country codes 772b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 773b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 774b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE const char* const* U_EXPORT2 775b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getISOCountries(void); 776b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 777b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 778b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Truncate the locale ID string to get the parent locale ID. 779b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Copies the part of the string before the last underscore. 780b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * The parent locale ID will be an empty string if there is no 781b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * underscore, or if there is only one underscore at localeID[0]. 782b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 783b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID Input locale ID string. 784b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param parent Output string buffer for the parent locale ID. 785b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param parentCapacity Size of the output buffer. 786b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param err A UErrorCode value. 787b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return The length of the parent locale ID. 788b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.0 789b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 790b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 791b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getParent(const char* localeID, 792b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* parent, 793b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t parentCapacity, 794b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 795b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 796b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 797b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 798b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 799b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 800b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the full name for the specified locale. 801b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Note: This has the effect of 'canonicalizing' the string to 802b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * a certain extent. Upper and lower case are set as needed, 803b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * and if the components were in 'POSIX' format they are changed to 804b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * ICU format. It does NOT map aliased names in any way. 805b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * See the top of this header file. 806b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This API strips off the keyword part, so "de_DE\@collation=phonebook" 807b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * will become "de_DE". 808b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * This API supports preflighting. 809b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 810b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the full name with 811b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param name fill in buffer for the name without keywords. 812b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param nameCapacity capacity of the fill in buffer. 813b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param err error information if retrieving the full name failed 814b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the actual buffer size needed for the full name. If it's greater 815b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * than nameCapacity, the returned full name will be truncated. 816b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 817b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 818b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 819b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getBaseName(const char* localeID, 820b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* name, 821b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t nameCapacity, 822b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* err); 823b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 824b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 825b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets an enumeration of keywords for the specified locale. Enumeration 826b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * must get disposed of by the client using uenum_close function. 827b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 828b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID the locale to get the variant code with 829b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status error information if retrieving the keywords failed 830b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return enumeration of keywords or NULL if there are no keywords. 831b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 832b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 833b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE UEnumeration* U_EXPORT2 834b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_openKeywords(const char* localeID, 835b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 836b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 837b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 838b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Get the value for a keyword. Locale name does not need to be normalized. 839b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 840b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK") 841b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param keywordName name of the keyword for which we want the value. Case insensitive. 842b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param buffer receiving buffer 843b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param bufferCapacity capacity of receiving buffer 844b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status containing error code - buffer not big enough. 845b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the length of keyword value 846b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 2.8 847b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 848b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 849b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getKeywordValue(const char* localeID, 850b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* keywordName, 851b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* buffer, int32_t bufferCapacity, 852b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 853b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 854b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 855b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 856b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Set the value of the specified keyword. 857b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * NOTE: Unlike almost every other ICU function which takes a 858b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * buffer, this function will NOT truncate the output text. If a 859b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * BUFFER_OVERFLOW_ERROR is received, it means that the original 860b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * buffer is untouched. This is done to prevent incorrect or possibly 861b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * even malformed locales from being generated and used. 862b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 863b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param keywordName name of the keyword to be set. Case insensitive. 864b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param keywordValue value of the keyword to be set. If 0-length or 865b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * NULL, will result in the keyword being removed. No error is given if 866b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * that keyword does not exist. 867b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param buffer input buffer containing locale to be modified. 868b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param bufferCapacity capacity of receiving buffer 869b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status containing error code - buffer not big enough. 870b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return the length needed for the buffer 871b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see uloc_getKeywordValue 872b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 873b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 874b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 875b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_setKeywordValue(const char* keywordName, 876b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char* keywordValue, 877b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru char* buffer, int32_t bufferCapacity, 878b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode* status); 879b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 880b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 881c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * enums for the return value for the character and line orientation 882c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * functions. 883b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 884c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 885c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Querutypedef enum { 886c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru ULOC_LAYOUT_LTR = 0, /* left-to-right. */ 887c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru ULOC_LAYOUT_RTL = 1, /* right-to-left. */ 888c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */ 889c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */ 890c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru ULOC_LAYOUT_UNKNOWN 891c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru} ULayoutType; 892c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 893c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 894c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Get the layout character orientation for the specified locale. 895c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 896c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param localeId locale name 897c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status Error status 898c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return an enum indicating the layout orientation for characters. 899b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 900c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 90150294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE ULayoutType U_EXPORT2 902c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuloc_getCharacterOrientation(const char* localeId, 903c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 904c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 905c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 906c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Get the layout line orientation for the specified locale. 907c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 908c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param localeId locale name 909c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param status Error status 910c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return an enum indicating the layout orientation for lines. 911b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 912c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 91350294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE ULayoutType U_EXPORT2 914c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuloc_getLineOrientation(const char* localeId, 915c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode *status); 916c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 917c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 918b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * enums for the 'outResult' parameter return value 919b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see uloc_acceptLanguageFromHTTP 920b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @see uloc_acceptLanguage 921b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 922b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 923b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Querutypedef enum { 924b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */ 925b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ULOC_ACCEPT_VALID = 1, /* An exact match was found. */ 926b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example, 927b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru Accept list contained 'ja_JP' 928b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru which matched available locale 'ja'. */ 929b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru} UAcceptResult; 930b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 931b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 932b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 933b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Based on a HTTP header from a web browser and a list of available locales, 934b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * determine an acceptable locale for the user. 935b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result - buffer to accept the result locale 936b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resultAvailable the size of the result buffer. 937b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param outResult - An out parameter that contains the fallback status 938b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP. 939b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param availableLocales - list of available locales to match 940b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Error status, may be BUFFER_OVERFLOW_ERROR 941b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return length needed for the locale. 942b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 943b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 944b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 945b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, 946b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UAcceptResult *outResult, 947b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru const char *httpAcceptLanguage, 948b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UEnumeration* availableLocales, 949b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 950b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 951b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 952b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Based on a list of available locales, 953b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * determine an acceptable locale for the user. 954b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param result - buffer to accept the result locale 955b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param resultAvailable the size of the result buffer. 956b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param outResult - An out parameter that contains the fallback status 957b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param acceptList - list of acceptable languages 958b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param acceptListCount - count of acceptList items 959b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param availableLocales - list of available locales to match 960b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status Error status, may be BUFFER_OVERFLOW_ERROR 961b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return length needed for the locale. 962b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @stable ICU 3.2 963b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 964b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste QueruU_STABLE int32_t U_EXPORT2 965b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_acceptLanguage(char *result, int32_t resultAvailable, 966b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UAcceptResult *outResult, const char **acceptList, 967b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru int32_t acceptListCount, 968b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UEnumeration* availableLocales, 969b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 970b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 971b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 972b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru/** 973b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * Gets the ICU locale ID for the specified Win32 LCID value. 974b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * 975b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param hostID the Win32 LCID to translate 976b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param locale the output buffer for the ICU locale ID, which will be NUL-terminated 977b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * if there is room. 978b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param localeCapacity the size of the output buffer 979b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @param status an error is returned if the LCID is unrecognized or the output buffer 980b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * is too small 981b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru * @return actual the actual size of the locale ID, not including NUL-termination 982b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 3.8 983b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru */ 98450294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2 985b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queruuloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, 986b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru UErrorCode *status); 987b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 988b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 989c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 990c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Add the likely subtags for a provided locale ID, per the algorithm described 991c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * in the following CLDR technical report: 992c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 993c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * http://www.unicode.org/reports/tr35/#Likely_Subtags 994c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 995c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * If localeID is already in the maximal form, or there is no data available 996c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * for maximization, it will be copied to the output buffer. For example, 997c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "und-Zzzz" cannot be maximized, since there is no reasonable maximization. 998c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 999c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Examples: 1000c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1001c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "en" maximizes to "en_Latn_US" 1002c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1003c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "de" maximizes to "de_Latn_US" 1004c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1005c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "sr" maximizes to "sr_Cyrl_RS" 1006c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1007c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.) 1008c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1009c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.) 1010c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1011c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param localeID The locale to maximize 1012c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param maximizedLocaleID The maximized locale 1013c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param maximizedLocaleIDCapacity The capacity of the maximizedLocaleID buffer 1014c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param err Error information if maximizing the locale failed. If the length 1015c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * of the localeID and the null-terminator is greater than the maximum allowed size, 1016c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. 1017c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return The actual buffer size needed for the maximized locale. If it's 1018c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * greater than maximizedLocaleIDCapacity, the returned ID will be truncated. 1019c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * On error, the return value is -1. 1020b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1021c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 102250294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2 1023c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuloc_addLikelySubtags(const char* localeID, 1024c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru char* maximizedLocaleID, 1025c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru int32_t maximizedLocaleIDCapacity, 1026c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode* err); 1027c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1028c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru 1029c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru/** 1030c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Minimize the subtags for a provided locale ID, per the algorithm described 1031c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * in the following CLDR technical report: 1032c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1033c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * http://www.unicode.org/reports/tr35/#Likely_Subtags 1034c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1035c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * If localeID is already in the minimal form, or there is no data available 1036c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * for minimization, it will be copied to the output buffer. Since the 1037c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * minimization algorithm relies on proper maximization, see the comments 1038c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * for uloc_addLikelySubtags for reasons why there might not be any data. 1039c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1040c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * Examples: 1041c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1042c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "en_Latn_US" minimizes to "en" 1043c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1044c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "de_Latn_US" minimizes to "de" 1045c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1046c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "sr_Cyrl_RS" minimizes to "sr" 1047c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1048c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the 1049c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * script, and minimizing to "zh" would imply "zh_Hans_CN".) 1050c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * 1051c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param localeID The locale to minimize 1052c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param minimizedLocaleID The minimized locale 1053c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param minimizedLocaleIDCapacity The capacity of the minimizedLocaleID buffer 1054c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @param err Error information if minimizing the locale failed. If the length 1055c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * of the localeID and the null-terminator is greater than the maximum allowed size, 1056c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. 1057c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * @return The actual buffer size needed for the minimized locale. If it's 1058c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * greater than minimizedLocaleIDCapacity, the returned ID will be truncated. 1059c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru * On error, the return value is -1. 1060b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @stable ICU 4.0 1061c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru */ 106250294ead5e5d23f5bbfed76e00e6b510bd41eee1clairehoU_STABLE int32_t U_EXPORT2 1063c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queruuloc_minimizeSubtags(const char* localeID, 1064c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru char* minimizedLocaleID, 1065c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru int32_t minimizedLocaleIDCapacity, 1066c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru UErrorCode* err); 1067b13da9df870a61b11249bf741347908dbea0edd8Jean-Baptiste Queru 1068b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru/** 1069b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Returns a locale ID for the specified BCP47 language tag string. 1070b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * If the specified language tag contains any ill-formed subtags, 1071b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * the first such subtag and all following subtags are ignored. 1072b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * <p> 1073b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * This implements the 'Language-Tag' production of BCP47, and so 1074b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * supports grandfathered (regular and irregular) as well as private 1075b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * use language tags. Private use tags are represented as 'x-whatever', 1076b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * and grandfathered tags are converted to their canonical replacements 1077b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * where they exist. Note that a few grandfathered tags have no modern 1078b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * replacement, these will be converted using the fallback described in 1079b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * the first paragraph, so some information might be lost. 1080b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param langtag the input BCP47 language tag. 1081b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param localeID the output buffer receiving a locale ID for the 1082b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * specified BCP47 language tag. 1083b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param localeIDCapacity the size of the locale ID output buffer. 1084b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param parsedLength if not NULL, succsessfully parsed length 1085b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * for the input language tag is set. 1086b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param err error information if receiving the locald ID 1087b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * failed. 1088b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @return the length of the locale ID. 1089b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @draft ICU 4.2 1090b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru */ 1091b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste QueruU_DRAFT int32_t U_EXPORT2 1092b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queruuloc_forLanguageTag(const char* langtag, 1093b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru char* localeID, 1094b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t localeIDCapacity, 1095b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t* parsedLength, 1096b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UErrorCode* err); 1097b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru 1098b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru/** 1099b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * Returns a well-formed language tag for this locale ID. 1100b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * <p> 1101b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * <b>Note</b>: When <code>strict</code> is FALSE, any locale 1102b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * fields which do not satisfy the BCP47 syntax requirement will 1103b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * be omitted from the result. When <code>strict</code> is 1104b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the 1105b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * <code>err</code> if any locale fields do not satisfy the 1106b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * BCP47 syntax requirement. 1107b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param localeID the input lcoale ID 1108b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param langtag the output buffer receiving BCP47 language 1109b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * tag for the locale ID. 1110b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param langtagCapacity the size of the BCP47 language tag 1111b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * output buffer. 1112b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param strict boolean value indicating if the function returns 1113b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * an error for an ill-formed input locale ID. 1114b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @param err error information if receiving the language 1115b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * tag failed. 1116b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @return The length of the BCP47 language tag. 1117b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru * @draft ICU 4.2 1118b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru */ 1119b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste QueruU_DRAFT int32_t U_EXPORT2 1120b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queruuloc_toLanguageTag(const char* localeID, 1121b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru char* langtag, 1122b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru int32_t langtagCapacity, 1123b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UBool strict, 1124b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru UErrorCode* err); 1125b0ac937921a2c196d8b9da665135bf6ba01a1ccfJean-Baptiste Queru 1126c69afcec261fc345fda8daf46f0ea6b4351dc777Jean-Baptiste Queru#endif /*_ULOC*/ 1127