michael@0: /* michael@0: ********************************************************************** michael@0: * Copyright (C) 1997-2013, International Business Machines michael@0: * Corporation and others. All Rights Reserved. michael@0: ********************************************************************** michael@0: * michael@0: * File ULOC.H michael@0: * michael@0: * Modification History: michael@0: * michael@0: * Date Name Description michael@0: * 04/01/97 aliu Creation. michael@0: * 08/22/98 stephen JDK 1.2 sync. michael@0: * 12/08/98 rtg New C API for Locale michael@0: * 03/30/99 damiba overhaul michael@0: * 03/31/99 helena Javadoc for uloc functions. michael@0: * 04/15/99 Madhu Updated Javadoc michael@0: ******************************************************************************** michael@0: */ michael@0: michael@0: #ifndef ULOC_H michael@0: #define ULOC_H michael@0: michael@0: #include "unicode/utypes.h" michael@0: #include "unicode/uenum.h" michael@0: michael@0: /** michael@0: * \file michael@0: * \brief C API: Locale michael@0: * michael@0: *

ULoc C API for Locale

michael@0: * A Locale represents a specific geographical, political, michael@0: * or cultural region. An operation that requires a Locale to perform michael@0: * its task is called locale-sensitive and uses the Locale michael@0: * to tailor information for the user. For example, displaying a number michael@0: * is a locale-sensitive operation--the number should be formatted michael@0: * according to the customs/conventions of the user's native country, michael@0: * region, or culture. In the C APIs, a locales is simply a const char string. michael@0: * michael@0: *

michael@0: * You create a Locale with one of the three options listed below. michael@0: * Each of the component is separated by '_' in the locale string. michael@0: * \htmlonly

\endhtmlonly michael@0: *
michael@0:  * \code
michael@0:  *       newLanguage
michael@0:  * 
michael@0:  *       newLanguage + newCountry
michael@0:  * 
michael@0:  *       newLanguage + newCountry + newVariant
michael@0:  * \endcode
michael@0:  * 
michael@0: * \htmlonly
\endhtmlonly michael@0: * The first option is a valid ISO michael@0: * Language Code. These codes are the lower-case two-letter michael@0: * codes as defined by ISO-639. michael@0: * You can find a full list of these codes at a number of sites, such as: michael@0: *
michael@0: * http://www.ics.uci.edu/pub/ietf/http/related/iso639.txt michael@0: * michael@0: *

michael@0: * The second option includes an additonal ISO Country michael@0: * Code. These codes are the upper-case two-letter codes michael@0: * as defined by ISO-3166. michael@0: * You can find a full list of these codes at a number of sites, such as: michael@0: *
michael@0: * http://www.chemie.fu-berlin.de/diverse/doc/ISO_3166.html michael@0: * michael@0: *

michael@0: * The third option requires another additonal information--the michael@0: * Variant. michael@0: * The Variant codes are vendor and browser-specific. michael@0: * For example, use WIN for Windows, MAC for Macintosh, and POSIX for POSIX. michael@0: * Where there are two variants, separate them with an underscore, and michael@0: * put the most important one first. For michael@0: * example, a Traditional Spanish collation might be referenced, with michael@0: * "ES", "ES", "Traditional_WIN". michael@0: * michael@0: *

michael@0: * Because a Locale is just an identifier for a region, michael@0: * no validity check is performed when you specify a Locale. michael@0: * If you want to see whether particular resources are available for the michael@0: * Locale you asked for, you must query those resources. For michael@0: * example, ask the UNumberFormat for the locales it supports michael@0: * using its getAvailable method. michael@0: *
Note: When you ask for a resource for a particular michael@0: * locale, you get back the best available match, not necessarily michael@0: * precisely what you asked for. For more information, look at michael@0: * UResourceBundle. michael@0: * michael@0: *

michael@0: * The Locale provides a number of convenient constants michael@0: * that you can use to specify the commonly used michael@0: * locales. For example, the following refers to a locale michael@0: * for the United States: michael@0: * \htmlonly

\endhtmlonly michael@0: *
michael@0:  * \code
michael@0:  *       ULOC_US
michael@0:  * \endcode
michael@0:  * 
michael@0: * \htmlonly
\endhtmlonly michael@0: * michael@0: *

michael@0: * Once you've specified a locale you can query it for information about michael@0: * itself. Use uloc_getCountry to get the ISO Country Code and michael@0: * uloc_getLanguage to get the ISO Language Code. You can michael@0: * use uloc_getDisplayCountry to get the michael@0: * name of the country suitable for displaying to the user. Similarly, michael@0: * you can use uloc_getDisplayLanguage to get the name of michael@0: * the language suitable for displaying to the user. Interestingly, michael@0: * the uloc_getDisplayXXX methods are themselves locale-sensitive michael@0: * and have two versions: one that uses the default locale and one michael@0: * that takes a locale as an argument and displays the name or country in michael@0: * a language appropriate to that locale. michael@0: * michael@0: *

michael@0: * The ICU provides a number of services that perform locale-sensitive michael@0: * operations. For example, the unum_xxx functions format michael@0: * numbers, currency, or percentages in a locale-sensitive manner. michael@0: *

michael@0: * \htmlonly
\endhtmlonly michael@0: *
michael@0:  * \code
michael@0:  *     UErrorCode success = U_ZERO_ERROR;
michael@0:  *     UNumberFormat *nf;
michael@0:  *     const char* myLocale = "fr_FR";
michael@0:  * 
michael@0:  *     nf = unum_open( UNUM_DEFAULT, NULL, success );          
michael@0:  *     unum_close(nf);
michael@0:  *     nf = unum_open( UNUM_CURRENCY, NULL, success );
michael@0:  *     unum_close(nf);
michael@0:  *     nf = unum_open( UNUM_PERCENT, NULL, success );   
michael@0:  *     unum_close(nf);
michael@0:  * \endcode
michael@0:  * 
michael@0: * \htmlonly
\endhtmlonly michael@0: * Each of these methods has two variants; one with an explicit locale michael@0: * and one without; the latter using the default locale. michael@0: * \htmlonly
\endhtmlonly michael@0: *
michael@0:  * \code 
michael@0:  * 
michael@0:  *     nf = unum_open( UNUM_DEFAULT, myLocale, success );          
michael@0:  *     unum_close(nf);
michael@0:  *     nf = unum_open( UNUM_CURRENCY, myLocale, success );
michael@0:  *     unum_close(nf);
michael@0:  *     nf = unum_open( UNUM_PERCENT, myLocale, success );   
michael@0:  *     unum_close(nf);
michael@0:  * \endcode
michael@0:  * 
michael@0: * \htmlonly
\endhtmlonly michael@0: * A Locale is the mechanism for identifying the kind of services michael@0: * (UNumberFormat) that you would like to get. The locale is michael@0: * just a mechanism for identifying these services. michael@0: * michael@0: *

michael@0: * Each international serivce that performs locale-sensitive operations michael@0: * allows you michael@0: * to get all the available objects of that type. You can sift michael@0: * through these objects by language, country, or variant, michael@0: * and use the display names to present a menu to the user. michael@0: * For example, you can create a menu of all the collation objects michael@0: * suitable for a given language. Such classes implement these michael@0: * three class methods: michael@0: * \htmlonly

\endhtmlonly michael@0: *
michael@0:  * \code
michael@0:  *       const char* uloc_getAvailable(int32_t index);
michael@0:  *       int32_t uloc_countAvailable();
michael@0:  *       int32_t
michael@0:  *       uloc_getDisplayName(const char* localeID,
michael@0:  *                 const char* inLocaleID, 
michael@0:  *                 UChar* result,
michael@0:  *                 int32_t maxResultSize,
michael@0:  *                  UErrorCode* err);
michael@0:  * 
michael@0:  * \endcode
michael@0:  * 
michael@0: * \htmlonly
\endhtmlonly michael@0: *

michael@0: * Concerning POSIX/RFC1766 Locale IDs, michael@0: * the getLanguage/getCountry/getVariant/getName functions do understand michael@0: * the POSIX type form of language_COUNTRY.ENCODING\@VARIANT michael@0: * and if there is not an ICU-stype variant, uloc_getVariant() for example michael@0: * will return the one listed after the \@at sign. As well, the hyphen michael@0: * "-" is recognized as a country/variant separator similarly to RFC1766. michael@0: * So for example, "en-us" will be interpreted as en_US. michael@0: * As a result, uloc_getName() is far from a no-op, and will have the michael@0: * effect of converting POSIX/RFC1766 IDs into ICU form, although it does michael@0: * NOT map any of the actual codes (i.e. russian->ru) in any way. michael@0: * Applications should call uloc_getName() at the point where a locale ID michael@0: * is coming from an external source (user entry, OS, web browser) michael@0: * and pass the resulting string to other ICU functions. For example, michael@0: * don't use de-de\@EURO as an argument to resourcebundle. michael@0: * michael@0: * @see UResourceBundle michael@0: */ michael@0: michael@0: /** Useful constant for this language. @stable ICU 2.0 */ michael@0: #define ULOC_CHINESE "zh" michael@0: /** Useful constant for this language. @stable ICU 2.0 */ michael@0: #define ULOC_ENGLISH "en" michael@0: /** Useful constant for this language. @stable ICU 2.0 */ michael@0: #define ULOC_FRENCH "fr" michael@0: /** Useful constant for this language. @stable ICU 2.0 */ michael@0: #define ULOC_GERMAN "de" michael@0: /** Useful constant for this language. @stable ICU 2.0 */ michael@0: #define ULOC_ITALIAN "it" michael@0: /** Useful constant for this language. @stable ICU 2.0 */ michael@0: #define ULOC_JAPANESE "ja" michael@0: /** Useful constant for this language. @stable ICU 2.0 */ michael@0: #define ULOC_KOREAN "ko" michael@0: /** Useful constant for this language. @stable ICU 2.0 */ michael@0: #define ULOC_SIMPLIFIED_CHINESE "zh_CN" michael@0: /** Useful constant for this language. @stable ICU 2.0 */ michael@0: #define ULOC_TRADITIONAL_CHINESE "zh_TW" michael@0: michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_CANADA "en_CA" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_CANADA_FRENCH "fr_CA" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_CHINA "zh_CN" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_PRC "zh_CN" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_FRANCE "fr_FR" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_GERMANY "de_DE" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_ITALY "it_IT" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_JAPAN "ja_JP" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_KOREA "ko_KR" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_TAIWAN "zh_TW" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_UK "en_GB" michael@0: /** Useful constant for this country/region. @stable ICU 2.0 */ michael@0: #define ULOC_US "en_US" michael@0: michael@0: /** michael@0: * Useful constant for the maximum size of the language part of a locale ID. michael@0: * (including the terminating NULL). michael@0: * @stable ICU 2.0 michael@0: */ michael@0: #define ULOC_LANG_CAPACITY 12 michael@0: michael@0: /** michael@0: * Useful constant for the maximum size of the country part of a locale ID michael@0: * (including the terminating NULL). michael@0: * @stable ICU 2.0 michael@0: */ michael@0: #define ULOC_COUNTRY_CAPACITY 4 michael@0: /** michael@0: * Useful constant for the maximum size of the whole locale ID michael@0: * (including the terminating NULL and all keywords). michael@0: * @stable ICU 2.0 michael@0: */ michael@0: #define ULOC_FULLNAME_CAPACITY 157 michael@0: michael@0: /** michael@0: * Useful constant for the maximum size of the script part of a locale ID michael@0: * (including the terminating NULL). michael@0: * @stable ICU 2.8 michael@0: */ michael@0: #define ULOC_SCRIPT_CAPACITY 6 michael@0: michael@0: /** michael@0: * Useful constant for the maximum size of keywords in a locale michael@0: * @stable ICU 2.8 michael@0: */ michael@0: #define ULOC_KEYWORDS_CAPACITY 50 michael@0: michael@0: /** michael@0: * Useful constant for the maximum total size of keywords and their values in a locale michael@0: * @stable ICU 2.8 michael@0: */ michael@0: #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100 michael@0: michael@0: /** michael@0: * Invariant character separating keywords from the locale string michael@0: * @stable ICU 2.8 michael@0: */ michael@0: #define ULOC_KEYWORD_SEPARATOR '@' michael@0: michael@0: /** michael@0: * Unicode code point for '@' separating keywords from the locale string. michael@0: * @see ULOC_KEYWORD_SEPARATOR michael@0: * @stable ICU 4.6 michael@0: */ michael@0: #define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40 michael@0: michael@0: /** michael@0: * Invariant character for assigning value to a keyword michael@0: * @stable ICU 2.8 michael@0: */ michael@0: #define ULOC_KEYWORD_ASSIGN '=' michael@0: michael@0: /** michael@0: * Unicode code point for '=' for assigning value to a keyword. michael@0: * @see ULOC_KEYWORD_ASSIGN michael@0: * @stable ICU 4.6 michael@0: */ michael@0: #define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D michael@0: michael@0: /** michael@0: * Invariant character separating keywords michael@0: * @stable ICU 2.8 michael@0: */ michael@0: #define ULOC_KEYWORD_ITEM_SEPARATOR ';' michael@0: michael@0: /** michael@0: * Unicode code point for ';' separating keywords michael@0: * @see ULOC_KEYWORD_ITEM_SEPARATOR michael@0: * @stable ICU 4.6 michael@0: */ michael@0: #define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B michael@0: michael@0: /** michael@0: * Constants for *_getLocale() michael@0: * Allow user to select whether she wants information on michael@0: * requested, valid or actual locale. michael@0: * For example, a collator for "en_US_CALIFORNIA" was michael@0: * requested. In the current state of ICU (2.0), michael@0: * the requested locale is "en_US_CALIFORNIA", michael@0: * the valid locale is "en_US" (most specific locale supported by ICU) michael@0: * and the actual locale is "root" (the collation data comes unmodified michael@0: * from the UCA) michael@0: * The locale is considered supported by ICU if there is a core ICU bundle michael@0: * for that locale (although it may be empty). michael@0: * @stable ICU 2.1 michael@0: */ michael@0: typedef enum { michael@0: /** This is locale the data actually comes from michael@0: * @stable ICU 2.1 michael@0: */ michael@0: ULOC_ACTUAL_LOCALE = 0, michael@0: /** This is the most specific locale supported by ICU michael@0: * @stable ICU 2.1 michael@0: */ michael@0: ULOC_VALID_LOCALE = 1, michael@0: michael@0: #ifndef U_HIDE_DEPRECATED_API michael@0: /** This is the requested locale michael@0: * @deprecated ICU 2.8 michael@0: */ michael@0: ULOC_REQUESTED_LOCALE = 2, michael@0: #endif /* U_HIDE_DEPRECATED_API */ michael@0: michael@0: ULOC_DATA_LOCALE_TYPE_LIMIT = 3 michael@0: } ULocDataLocaleType ; michael@0: michael@0: #ifndef U_HIDE_SYSTEM_API michael@0: /** michael@0: * Gets ICU's default locale. michael@0: * The returned string is a snapshot in time, and will remain valid michael@0: * and unchanged even when uloc_setDefault() is called. michael@0: * The returned storage is owned by ICU, and must not be altered or deleted michael@0: * by the caller. michael@0: * michael@0: * @return the ICU default locale michael@0: * @system michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE const char* U_EXPORT2 michael@0: uloc_getDefault(void); michael@0: michael@0: /** michael@0: * Sets ICU's default locale. michael@0: * By default (without calling this function), ICU's default locale will be based michael@0: * on information obtained from the underlying system environment. michael@0: *

michael@0: * Changes to ICU's default locale do not propagate back to the michael@0: * system environment. michael@0: *

michael@0: * Changes to ICU's default locale to not affect any ICU services that michael@0: * may already be open based on the previous default locale value. michael@0: * michael@0: * @param localeID the new ICU default locale. A value of NULL will try to get michael@0: * the system's default locale. michael@0: * @param status the error information if the setting of default locale fails michael@0: * @system michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE void U_EXPORT2 michael@0: uloc_setDefault(const char* localeID, michael@0: UErrorCode* status); michael@0: #endif /* U_HIDE_SYSTEM_API */ michael@0: michael@0: /** michael@0: * Gets the language code for the specified locale. michael@0: * michael@0: * @param localeID the locale to get the ISO language code with michael@0: * @param language the language code for localeID michael@0: * @param languageCapacity the size of the language buffer to store the michael@0: * language code with michael@0: * @param err error information if retrieving the language code failed michael@0: * @return the actual buffer size needed for the language code. If it's greater michael@0: * than languageCapacity, the returned language code will be truncated. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getLanguage(const char* localeID, michael@0: char* language, michael@0: int32_t languageCapacity, michael@0: UErrorCode* err); michael@0: michael@0: /** michael@0: * Gets the script code for the specified locale. michael@0: * michael@0: * @param localeID the locale to get the ISO language code with michael@0: * @param script the language code for localeID michael@0: * @param scriptCapacity the size of the language buffer to store the michael@0: * language code with michael@0: * @param err error information if retrieving the language code failed michael@0: * @return the actual buffer size needed for the language code. If it's greater michael@0: * than scriptCapacity, the returned language code will be truncated. michael@0: * @stable ICU 2.8 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getScript(const char* localeID, michael@0: char* script, michael@0: int32_t scriptCapacity, michael@0: UErrorCode* err); michael@0: michael@0: /** michael@0: * Gets the country code for the specified locale. michael@0: * michael@0: * @param localeID the locale to get the country code with michael@0: * @param country the country code for localeID michael@0: * @param countryCapacity the size of the country buffer to store the michael@0: * country code with michael@0: * @param err error information if retrieving the country code failed michael@0: * @return the actual buffer size needed for the country code. If it's greater michael@0: * than countryCapacity, the returned country code will be truncated. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getCountry(const char* localeID, michael@0: char* country, michael@0: int32_t countryCapacity, michael@0: UErrorCode* err); michael@0: michael@0: /** michael@0: * Gets the variant code for the specified locale. michael@0: * michael@0: * @param localeID the locale to get the variant code with michael@0: * @param variant the variant code for localeID michael@0: * @param variantCapacity the size of the variant buffer to store the michael@0: * variant code with michael@0: * @param err error information if retrieving the variant code failed michael@0: * @return the actual buffer size needed for the variant code. If it's greater michael@0: * than variantCapacity, the returned variant code will be truncated. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getVariant(const char* localeID, michael@0: char* variant, michael@0: int32_t variantCapacity, michael@0: UErrorCode* err); michael@0: michael@0: michael@0: /** michael@0: * Gets the full name for the specified locale. michael@0: * Note: This has the effect of 'canonicalizing' the ICU locale ID to michael@0: * a certain extent. Upper and lower case are set as needed. michael@0: * It does NOT map aliased names in any way. michael@0: * See the top of this header file. michael@0: * This API supports preflighting. michael@0: * michael@0: * @param localeID the locale to get the full name with michael@0: * @param name fill in buffer for the name without keywords. michael@0: * @param nameCapacity capacity of the fill in buffer. michael@0: * @param err error information if retrieving the full name failed michael@0: * @return the actual buffer size needed for the full name. If it's greater michael@0: * than nameCapacity, the returned full name will be truncated. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getName(const char* localeID, michael@0: char* name, michael@0: int32_t nameCapacity, michael@0: UErrorCode* err); michael@0: michael@0: /** michael@0: * Gets the full name for the specified locale. michael@0: * Note: This has the effect of 'canonicalizing' the string to michael@0: * a certain extent. Upper and lower case are set as needed, michael@0: * and if the components were in 'POSIX' format they are changed to michael@0: * ICU format. It does NOT map aliased names in any way. michael@0: * See the top of this header file. michael@0: * michael@0: * @param localeID the locale to get the full name with michael@0: * @param name the full name for localeID michael@0: * @param nameCapacity the size of the name buffer to store the michael@0: * full name with michael@0: * @param err error information if retrieving the full name failed michael@0: * @return the actual buffer size needed for the full name. If it's greater michael@0: * than nameCapacity, the returned full name will be truncated. michael@0: * @stable ICU 2.8 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_canonicalize(const char* localeID, michael@0: char* name, michael@0: int32_t nameCapacity, michael@0: UErrorCode* err); michael@0: michael@0: /** michael@0: * Gets the ISO language code for the specified locale. michael@0: * michael@0: * @param localeID the locale to get the ISO language code with michael@0: * @return language the ISO language code for localeID michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE const char* U_EXPORT2 michael@0: uloc_getISO3Language(const char* localeID); michael@0: michael@0: michael@0: /** michael@0: * Gets the ISO country code for the specified locale. michael@0: * michael@0: * @param localeID the locale to get the ISO country code with michael@0: * @return country the ISO country code for localeID michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE const char* U_EXPORT2 michael@0: uloc_getISO3Country(const char* localeID); michael@0: michael@0: /** michael@0: * Gets the Win32 LCID value for the specified locale. michael@0: * If the ICU locale is not recognized by Windows, 0 will be returned. michael@0: * michael@0: * @param localeID the locale to get the Win32 LCID value with michael@0: * @return country the Win32 LCID for localeID michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE uint32_t U_EXPORT2 michael@0: uloc_getLCID(const char* localeID); michael@0: michael@0: /** michael@0: * Gets the language name suitable for display for the specified locale. michael@0: * michael@0: * @param locale the locale to get the ISO language code with michael@0: * @param displayLocale Specifies the locale to be used to display the name. In other words, michael@0: * if the locale's language code is "en", passing Locale::getFrench() for michael@0: * inLocale would result in "Anglais", while passing Locale::getGerman() michael@0: * for inLocale would result in "Englisch". michael@0: * @param language the displayable language code for localeID michael@0: * @param languageCapacity the size of the language buffer to store the michael@0: * displayable language code with michael@0: * @param status error information if retrieving the displayable language code failed michael@0: * @return the actual buffer size needed for the displayable language code. If it's greater michael@0: * than languageCapacity, the returned language code will be truncated. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getDisplayLanguage(const char* locale, michael@0: const char* displayLocale, michael@0: UChar* language, michael@0: int32_t languageCapacity, michael@0: UErrorCode* status); michael@0: michael@0: /** michael@0: * Gets the script name suitable for display for the specified locale. michael@0: * michael@0: * @param locale the locale to get the displayable script code with. NULL may be used to specify the default. michael@0: * @param displayLocale Specifies the locale to be used to display the name. In other words, michael@0: * if the locale's language code is "en", passing Locale::getFrench() for michael@0: * inLocale would result in "", while passing Locale::getGerman() michael@0: * for inLocale would result in "". NULL may be used to specify the default. michael@0: * @param script the displayable country code for localeID michael@0: * @param scriptCapacity the size of the script buffer to store the michael@0: * displayable script code with michael@0: * @param status error information if retrieving the displayable script code failed michael@0: * @return the actual buffer size needed for the displayable script code. If it's greater michael@0: * than scriptCapacity, the returned displayable script code will be truncated. michael@0: * @stable ICU 2.8 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getDisplayScript(const char* locale, michael@0: const char* displayLocale, michael@0: UChar* script, michael@0: int32_t scriptCapacity, michael@0: UErrorCode* status); michael@0: michael@0: /** michael@0: * Gets the country name suitable for display for the specified locale. michael@0: * michael@0: * @param locale the locale to get the displayable country code with. NULL may be used to specify the default. michael@0: * @param displayLocale Specifies the locale to be used to display the name. In other words, michael@0: * if the locale's language code is "en", passing Locale::getFrench() for michael@0: * inLocale would result in "Anglais", while passing Locale::getGerman() michael@0: * for inLocale would result in "Englisch". NULL may be used to specify the default. michael@0: * @param country the displayable country code for localeID michael@0: * @param countryCapacity the size of the country buffer to store the michael@0: * displayable country code with michael@0: * @param status error information if retrieving the displayable country code failed michael@0: * @return the actual buffer size needed for the displayable country code. If it's greater michael@0: * than countryCapacity, the returned displayable country code will be truncated. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getDisplayCountry(const char* locale, michael@0: const char* displayLocale, michael@0: UChar* country, michael@0: int32_t countryCapacity, michael@0: UErrorCode* status); michael@0: michael@0: michael@0: /** michael@0: * Gets the variant name suitable for display for the specified locale. michael@0: * michael@0: * @param locale the locale to get the displayable variant code with. NULL may be used to specify the default. michael@0: * @param displayLocale Specifies the locale to be used to display the name. In other words, michael@0: * if the locale's language code is "en", passing Locale::getFrench() for michael@0: * inLocale would result in "Anglais", while passing Locale::getGerman() michael@0: * for inLocale would result in "Englisch". NULL may be used to specify the default. michael@0: * @param variant the displayable variant code for localeID michael@0: * @param variantCapacity the size of the variant buffer to store the michael@0: * displayable variant code with michael@0: * @param status error information if retrieving the displayable variant code failed michael@0: * @return the actual buffer size needed for the displayable variant code. If it's greater michael@0: * than variantCapacity, the returned displayable variant code will be truncated. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getDisplayVariant(const char* locale, michael@0: const char* displayLocale, michael@0: UChar* variant, michael@0: int32_t variantCapacity, michael@0: UErrorCode* status); michael@0: michael@0: /** michael@0: * Gets the keyword name suitable for display for the specified locale. michael@0: * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display michael@0: * string for the keyword collation. michael@0: * Usage: michael@0: * michael@0: * UErrorCode status = U_ZERO_ERROR; michael@0: * const char* keyword =NULL; michael@0: * int32_t keywordLen = 0; michael@0: * int32_t keywordCount = 0; michael@0: * UChar displayKeyword[256]; michael@0: * int32_t displayKeywordLen = 0; michael@0: * UEnumeration* keywordEnum = uloc_openKeywords("de_DE@collation=PHONEBOOK;calendar=TRADITIONAL", &status); michael@0: * for(keywordCount = uenum_count(keywordEnum, &status); keywordCount > 0 ; keywordCount--){ michael@0: * if(U_FAILURE(status)){ michael@0: * ...something went wrong so handle the error... michael@0: * break; michael@0: * } michael@0: * // the uenum_next returns NUL terminated string michael@0: * keyword = uenum_next(keywordEnum, &keywordLen, &status); michael@0: * displayKeywordLen = uloc_getDisplayKeyword(keyword, "en_US", displayKeyword, 256); michael@0: * ... do something interesting ..... michael@0: * } michael@0: * uenum_close(keywordEnum); michael@0: * michael@0: * @param keyword The keyword whose display string needs to be returned. michael@0: * @param displayLocale Specifies the locale to be used to display the name. In other words, michael@0: * if the locale's language code is "en", passing Locale::getFrench() for michael@0: * inLocale would result in "Anglais", while passing Locale::getGerman() michael@0: * for inLocale would result in "Englisch". NULL may be used to specify the default. michael@0: * @param dest the buffer to which the displayable keyword should be written. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param status error information if retrieving the displayable string failed. michael@0: * Should not be NULL and should not indicate failure on entry. michael@0: * @return the actual buffer size needed for the displayable variant code. michael@0: * @see #uloc_openKeywords michael@0: * @stable ICU 2.8 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getDisplayKeyword(const char* keyword, michael@0: const char* displayLocale, michael@0: UChar* dest, michael@0: int32_t destCapacity, michael@0: UErrorCode* status); michael@0: /** michael@0: * Gets the value of the keyword suitable for display for the specified locale. michael@0: * E.g: for the locale string de_DE\@collation=PHONEBOOK, this API gets the display michael@0: * string for PHONEBOOK, in the display locale, when "collation" is specified as the keyword. michael@0: * michael@0: * @param locale The locale to get the displayable variant code with. NULL may be used to specify the default. michael@0: * @param keyword The keyword for whose value should be used. michael@0: * @param displayLocale Specifies the locale to be used to display the name. In other words, michael@0: * if the locale's language code is "en", passing Locale::getFrench() for michael@0: * inLocale would result in "Anglais", while passing Locale::getGerman() michael@0: * for inLocale would result in "Englisch". NULL may be used to specify the default. michael@0: * @param dest the buffer to which the displayable keyword should be written. michael@0: * @param destCapacity The size of the buffer (number of UChars). If it is 0, then michael@0: * dest may be NULL and the function will only return the length of the michael@0: * result without writing any of the result string (pre-flighting). michael@0: * @param status error information if retrieving the displayable string failed. michael@0: * Should not be NULL and must not indicate failure on entry. michael@0: * @return the actual buffer size needed for the displayable variant code. michael@0: * @stable ICU 2.8 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getDisplayKeywordValue( const char* locale, michael@0: const char* keyword, michael@0: const char* displayLocale, michael@0: UChar* dest, michael@0: int32_t destCapacity, michael@0: UErrorCode* status); michael@0: /** michael@0: * Gets the full name suitable for display for the specified locale. michael@0: * michael@0: * @param localeID the locale to get the displayable name with. NULL may be used to specify the default. michael@0: * @param inLocaleID Specifies the locale to be used to display the name. In other words, michael@0: * if the locale's language code is "en", passing Locale::getFrench() for michael@0: * inLocale would result in "Anglais", while passing Locale::getGerman() michael@0: * for inLocale would result in "Englisch". NULL may be used to specify the default. michael@0: * @param result the displayable name for localeID michael@0: * @param maxResultSize the size of the name buffer to store the michael@0: * displayable full name with michael@0: * @param err error information if retrieving the displayable name failed michael@0: * @return the actual buffer size needed for the displayable name. If it's greater michael@0: * than maxResultSize, the returned displayable name will be truncated. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getDisplayName(const char* localeID, michael@0: const char* inLocaleID, michael@0: UChar* result, michael@0: int32_t maxResultSize, michael@0: UErrorCode* err); michael@0: michael@0: michael@0: /** michael@0: * Gets the specified locale from a list of all available locales. michael@0: * The return value is a pointer to an item of michael@0: * a locale name array. Both this array and the pointers michael@0: * it contains are owned by ICU and should not be deleted or written through michael@0: * by the caller. The locale name is terminated by a null pointer. michael@0: * @param n the specific locale name index of the available locale list michael@0: * @return a specified locale name of all available locales michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE const char* U_EXPORT2 michael@0: uloc_getAvailable(int32_t n); michael@0: michael@0: /** michael@0: * Gets the size of the all available locale list. michael@0: * michael@0: * @return the size of the locale list michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void); michael@0: michael@0: /** michael@0: * michael@0: * Gets a list of all available 2-letter language codes defined in ISO 639, michael@0: * plus additional 3-letter codes determined to be useful for locale generation as michael@0: * defined by Unicode CLDR. This is a pointer michael@0: * to an array of pointers to arrays of char. All of these pointers are owned michael@0: * by ICU-- do not delete them, and do not write through them. The array is michael@0: * terminated with a null pointer. michael@0: * @return a list of all available language codes michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE const char* const* U_EXPORT2 michael@0: uloc_getISOLanguages(void); michael@0: michael@0: /** michael@0: * michael@0: * Gets a list of all available 2-letter country codes defined in ISO 639. This is a michael@0: * pointer to an array of pointers to arrays of char. All of these pointers are michael@0: * owned by ICU-- do not delete them, and do not write through them. The array is michael@0: * terminated with a null pointer. michael@0: * @return a list of all available country codes michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE const char* const* U_EXPORT2 michael@0: uloc_getISOCountries(void); michael@0: michael@0: /** michael@0: * Truncate the locale ID string to get the parent locale ID. michael@0: * Copies the part of the string before the last underscore. michael@0: * The parent locale ID will be an empty string if there is no michael@0: * underscore, or if there is only one underscore at localeID[0]. michael@0: * michael@0: * @param localeID Input locale ID string. michael@0: * @param parent Output string buffer for the parent locale ID. michael@0: * @param parentCapacity Size of the output buffer. michael@0: * @param err A UErrorCode value. michael@0: * @return The length of the parent locale ID. michael@0: * @stable ICU 2.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getParent(const char* localeID, michael@0: char* parent, michael@0: int32_t parentCapacity, michael@0: UErrorCode* err); michael@0: michael@0: michael@0: michael@0: michael@0: /** michael@0: * Gets the full name for the specified locale, like uloc_getName(), michael@0: * but without keywords. michael@0: * michael@0: * Note: This has the effect of 'canonicalizing' the string to michael@0: * a certain extent. Upper and lower case are set as needed, michael@0: * and if the components were in 'POSIX' format they are changed to michael@0: * ICU format. It does NOT map aliased names in any way. michael@0: * See the top of this header file. michael@0: * michael@0: * This API strips off the keyword part, so "de_DE\@collation=phonebook" michael@0: * will become "de_DE". michael@0: * This API supports preflighting. michael@0: * michael@0: * @param localeID the locale to get the full name with michael@0: * @param name fill in buffer for the name without keywords. michael@0: * @param nameCapacity capacity of the fill in buffer. michael@0: * @param err error information if retrieving the full name failed michael@0: * @return the actual buffer size needed for the full name. If it's greater michael@0: * than nameCapacity, the returned full name will be truncated. michael@0: * @stable ICU 2.8 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getBaseName(const char* localeID, michael@0: char* name, michael@0: int32_t nameCapacity, michael@0: UErrorCode* err); michael@0: michael@0: /** michael@0: * Gets an enumeration of keywords for the specified locale. Enumeration michael@0: * must get disposed of by the client using uenum_close function. michael@0: * michael@0: * @param localeID the locale to get the variant code with michael@0: * @param status error information if retrieving the keywords failed michael@0: * @return enumeration of keywords or NULL if there are no keywords. michael@0: * @stable ICU 2.8 michael@0: */ michael@0: U_STABLE UEnumeration* U_EXPORT2 michael@0: uloc_openKeywords(const char* localeID, michael@0: UErrorCode* status); michael@0: michael@0: /** michael@0: * Get the value for a keyword. Locale name does not need to be normalized. michael@0: * michael@0: * @param localeID locale name containing the keyword ("de_DE@currency=EURO;collation=PHONEBOOK") michael@0: * @param keywordName name of the keyword for which we want the value. Case insensitive. michael@0: * @param buffer receiving buffer michael@0: * @param bufferCapacity capacity of receiving buffer michael@0: * @param status containing error code - buffer not big enough. michael@0: * @return the length of keyword value michael@0: * @stable ICU 2.8 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getKeywordValue(const char* localeID, michael@0: const char* keywordName, michael@0: char* buffer, int32_t bufferCapacity, michael@0: UErrorCode* status); michael@0: michael@0: michael@0: /** michael@0: * Sets or removes the value of the specified keyword. michael@0: * michael@0: * For removing all keywords, use uloc_getBaseName(). michael@0: * michael@0: * NOTE: Unlike almost every other ICU function which takes a michael@0: * buffer, this function will NOT truncate the output text. If a michael@0: * BUFFER_OVERFLOW_ERROR is received, it means that the original michael@0: * buffer is untouched. This is done to prevent incorrect or possibly michael@0: * even malformed locales from being generated and used. michael@0: * michael@0: * @param keywordName name of the keyword to be set. Case insensitive. michael@0: * @param keywordValue value of the keyword to be set. If 0-length or michael@0: * NULL, will result in the keyword being removed. No error is given if michael@0: * that keyword does not exist. michael@0: * @param buffer input buffer containing locale to be modified. michael@0: * @param bufferCapacity capacity of receiving buffer michael@0: * @param status containing error code - buffer not big enough. michael@0: * @return the length needed for the buffer michael@0: * @see uloc_getKeywordValue michael@0: * @stable ICU 3.2 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_setKeywordValue(const char* keywordName, michael@0: const char* keywordValue, michael@0: char* buffer, int32_t bufferCapacity, michael@0: UErrorCode* status); michael@0: michael@0: /** michael@0: * enums for the return value for the character and line orientation michael@0: * functions. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: typedef enum { michael@0: ULOC_LAYOUT_LTR = 0, /* left-to-right. */ michael@0: ULOC_LAYOUT_RTL = 1, /* right-to-left. */ michael@0: ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */ michael@0: ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */ michael@0: ULOC_LAYOUT_UNKNOWN michael@0: } ULayoutType; michael@0: michael@0: /** michael@0: * Get the layout character orientation for the specified locale. michael@0: * michael@0: * @param localeId locale name michael@0: * @param status Error status michael@0: * @return an enum indicating the layout orientation for characters. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: U_STABLE ULayoutType U_EXPORT2 michael@0: uloc_getCharacterOrientation(const char* localeId, michael@0: UErrorCode *status); michael@0: michael@0: /** michael@0: * Get the layout line orientation for the specified locale. michael@0: * michael@0: * @param localeId locale name michael@0: * @param status Error status michael@0: * @return an enum indicating the layout orientation for lines. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: U_STABLE ULayoutType U_EXPORT2 michael@0: uloc_getLineOrientation(const char* localeId, michael@0: UErrorCode *status); michael@0: michael@0: /** michael@0: * enums for the 'outResult' parameter return value michael@0: * @see uloc_acceptLanguageFromHTTP michael@0: * @see uloc_acceptLanguage michael@0: * @stable ICU 3.2 michael@0: */ michael@0: typedef enum { michael@0: ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */ michael@0: ULOC_ACCEPT_VALID = 1, /* An exact match was found. */ michael@0: ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example, michael@0: Accept list contained 'ja_JP' michael@0: which matched available locale 'ja'. */ michael@0: } UAcceptResult; michael@0: michael@0: michael@0: /** michael@0: * Based on a HTTP header from a web browser and a list of available locales, michael@0: * determine an acceptable locale for the user. michael@0: * @param result - buffer to accept the result locale michael@0: * @param resultAvailable the size of the result buffer. michael@0: * @param outResult - An out parameter that contains the fallback status michael@0: * @param httpAcceptLanguage - "Accept-Language:" header as per HTTP. michael@0: * @param availableLocales - list of available locales to match michael@0: * @param status Error status, may be BUFFER_OVERFLOW_ERROR michael@0: * @return length needed for the locale. michael@0: * @stable ICU 3.2 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, michael@0: UAcceptResult *outResult, michael@0: const char *httpAcceptLanguage, michael@0: UEnumeration* availableLocales, michael@0: UErrorCode *status); michael@0: michael@0: /** michael@0: * Based on a list of available locales, michael@0: * determine an acceptable locale for the user. michael@0: * @param result - buffer to accept the result locale michael@0: * @param resultAvailable the size of the result buffer. michael@0: * @param outResult - An out parameter that contains the fallback status michael@0: * @param acceptList - list of acceptable languages michael@0: * @param acceptListCount - count of acceptList items michael@0: * @param availableLocales - list of available locales to match michael@0: * @param status Error status, may be BUFFER_OVERFLOW_ERROR michael@0: * @return length needed for the locale. michael@0: * @stable ICU 3.2 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_acceptLanguage(char *result, int32_t resultAvailable, michael@0: UAcceptResult *outResult, const char **acceptList, michael@0: int32_t acceptListCount, michael@0: UEnumeration* availableLocales, michael@0: UErrorCode *status); michael@0: michael@0: michael@0: /** michael@0: * Gets the ICU locale ID for the specified Win32 LCID value. michael@0: * michael@0: * @param hostID the Win32 LCID to translate michael@0: * @param locale the output buffer for the ICU locale ID, which will be NUL-terminated michael@0: * if there is room. michael@0: * @param localeCapacity the size of the output buffer michael@0: * @param status an error is returned if the LCID is unrecognized or the output buffer michael@0: * is too small michael@0: * @return actual the actual size of the locale ID, not including NUL-termination michael@0: * @stable ICU 3.8 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, michael@0: UErrorCode *status); michael@0: michael@0: michael@0: /** michael@0: * Add the likely subtags for a provided locale ID, per the algorithm described michael@0: * in the following CLDR technical report: michael@0: * michael@0: * http://www.unicode.org/reports/tr35/#Likely_Subtags michael@0: * michael@0: * If localeID is already in the maximal form, or there is no data available michael@0: * for maximization, it will be copied to the output buffer. For example, michael@0: * "und-Zzzz" cannot be maximized, since there is no reasonable maximization. michael@0: * michael@0: * Examples: michael@0: * michael@0: * "en" maximizes to "en_Latn_US" michael@0: * michael@0: * "de" maximizes to "de_Latn_US" michael@0: * michael@0: * "sr" maximizes to "sr_Cyrl_RS" michael@0: * michael@0: * "sh" maximizes to "sr_Latn_RS" (Note this will not reverse.) michael@0: * michael@0: * "zh_Hani" maximizes to "zh_Hans_CN" (Note this will not reverse.) michael@0: * michael@0: * @param localeID The locale to maximize michael@0: * @param maximizedLocaleID The maximized locale michael@0: * @param maximizedLocaleIDCapacity The capacity of the maximizedLocaleID buffer michael@0: * @param err Error information if maximizing the locale failed. If the length michael@0: * of the localeID and the null-terminator is greater than the maximum allowed size, michael@0: * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. michael@0: * @return The actual buffer size needed for the maximized locale. If it's michael@0: * greater than maximizedLocaleIDCapacity, the returned ID will be truncated. michael@0: * On error, the return value is -1. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_addLikelySubtags(const char* localeID, michael@0: char* maximizedLocaleID, michael@0: int32_t maximizedLocaleIDCapacity, michael@0: UErrorCode* err); michael@0: michael@0: michael@0: /** michael@0: * Minimize the subtags for a provided locale ID, per the algorithm described michael@0: * in the following CLDR technical report: michael@0: * michael@0: * http://www.unicode.org/reports/tr35/#Likely_Subtags michael@0: * michael@0: * If localeID is already in the minimal form, or there is no data available michael@0: * for minimization, it will be copied to the output buffer. Since the michael@0: * minimization algorithm relies on proper maximization, see the comments michael@0: * for uloc_addLikelySubtags for reasons why there might not be any data. michael@0: * michael@0: * Examples: michael@0: * michael@0: * "en_Latn_US" minimizes to "en" michael@0: * michael@0: * "de_Latn_US" minimizes to "de" michael@0: * michael@0: * "sr_Cyrl_RS" minimizes to "sr" michael@0: * michael@0: * "zh_Hant_TW" minimizes to "zh_TW" (The region is preferred to the michael@0: * script, and minimizing to "zh" would imply "zh_Hans_CN".) michael@0: * michael@0: * @param localeID The locale to minimize michael@0: * @param minimizedLocaleID The minimized locale michael@0: * @param minimizedLocaleIDCapacity The capacity of the minimizedLocaleID buffer michael@0: * @param err Error information if minimizing the locale failed. If the length michael@0: * of the localeID and the null-terminator is greater than the maximum allowed size, michael@0: * or the localeId is not well-formed, the error code is U_ILLEGAL_ARGUMENT_ERROR. michael@0: * @return The actual buffer size needed for the minimized locale. If it's michael@0: * greater than minimizedLocaleIDCapacity, the returned ID will be truncated. michael@0: * On error, the return value is -1. michael@0: * @stable ICU 4.0 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_minimizeSubtags(const char* localeID, michael@0: char* minimizedLocaleID, michael@0: int32_t minimizedLocaleIDCapacity, michael@0: UErrorCode* err); michael@0: michael@0: /** michael@0: * Returns a locale ID for the specified BCP47 language tag string. michael@0: * If the specified language tag contains any ill-formed subtags, michael@0: * the first such subtag and all following subtags are ignored. michael@0: *

michael@0: * This implements the 'Language-Tag' production of BCP47, and so michael@0: * supports grandfathered (regular and irregular) as well as private michael@0: * use language tags. Private use tags are represented as 'x-whatever', michael@0: * and grandfathered tags are converted to their canonical replacements michael@0: * where they exist. Note that a few grandfathered tags have no modern michael@0: * replacement, these will be converted using the fallback described in michael@0: * the first paragraph, so some information might be lost. michael@0: * @param langtag the input BCP47 language tag. michael@0: * @param localeID the output buffer receiving a locale ID for the michael@0: * specified BCP47 language tag. michael@0: * @param localeIDCapacity the size of the locale ID output buffer. michael@0: * @param parsedLength if not NULL, successfully parsed length michael@0: * for the input language tag is set. michael@0: * @param err error information if receiving the locald ID michael@0: * failed. michael@0: * @return the length of the locale ID. michael@0: * @stable ICU 4.2 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_forLanguageTag(const char* langtag, michael@0: char* localeID, michael@0: int32_t localeIDCapacity, michael@0: int32_t* parsedLength, michael@0: UErrorCode* err); michael@0: michael@0: /** michael@0: * Returns a well-formed language tag for this locale ID. michael@0: *

michael@0: * Note: When strict is FALSE, any locale michael@0: * fields which do not satisfy the BCP47 syntax requirement will michael@0: * be omitted from the result. When strict is michael@0: * TRUE, this function sets U_ILLEGAL_ARGUMENT_ERROR to the michael@0: * err if any locale fields do not satisfy the michael@0: * BCP47 syntax requirement. michael@0: * @param localeID the input locale ID michael@0: * @param langtag the output buffer receiving BCP47 language michael@0: * tag for the locale ID. michael@0: * @param langtagCapacity the size of the BCP47 language tag michael@0: * output buffer. michael@0: * @param strict boolean value indicating if the function returns michael@0: * an error for an ill-formed input locale ID. michael@0: * @param err error information if receiving the language michael@0: * tag failed. michael@0: * @return The length of the BCP47 language tag. michael@0: * @stable ICU 4.2 michael@0: */ michael@0: U_STABLE int32_t U_EXPORT2 michael@0: uloc_toLanguageTag(const char* localeID, michael@0: char* langtag, michael@0: int32_t langtagCapacity, michael@0: UBool strict, michael@0: UErrorCode* err); michael@0: michael@0: #endif /*_ULOC*/