ICU 49.1.1  49.1.1
uloc.h
Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1997-2012, International Business Machines
00004 *   Corporation and others.  All Rights Reserved.
00005 **********************************************************************
00006 *
00007 * File ULOC.H
00008 *
00009 * Modification History:
00010 *
00011 *   Date        Name        Description
00012 *   04/01/97    aliu        Creation.
00013 *   08/22/98    stephen     JDK 1.2 sync.
00014 *   12/08/98    rtg         New C API for Locale
00015 *   03/30/99    damiba      overhaul
00016 *   03/31/99    helena      Javadoc for uloc functions.
00017 *   04/15/99    Madhu       Updated Javadoc
00018 ********************************************************************************
00019 */
00020 
00021 #ifndef ULOC_H
00022 #define ULOC_H
00023 
00024 #include "unicode/utypes.h"
00025 #include "unicode/uenum.h"
00026 
00201 #define ULOC_CHINESE            "zh"
00202 
00203 #define ULOC_ENGLISH            "en"
00204 
00205 #define ULOC_FRENCH             "fr"
00206 
00207 #define ULOC_GERMAN             "de"
00208 
00209 #define ULOC_ITALIAN            "it"
00210 
00211 #define ULOC_JAPANESE           "ja"
00212 
00213 #define ULOC_KOREAN             "ko"
00214 
00215 #define ULOC_SIMPLIFIED_CHINESE "zh_CN"
00216 
00217 #define ULOC_TRADITIONAL_CHINESE "zh_TW"
00218 
00220 #define ULOC_CANADA         "en_CA"
00221 
00222 #define ULOC_CANADA_FRENCH  "fr_CA"
00223 
00224 #define ULOC_CHINA          "zh_CN"
00225 
00226 #define ULOC_PRC            "zh_CN"
00227 
00228 #define ULOC_FRANCE         "fr_FR"
00229 
00230 #define ULOC_GERMANY        "de_DE"
00231 
00232 #define ULOC_ITALY          "it_IT"
00233 
00234 #define ULOC_JAPAN          "ja_JP"
00235 
00236 #define ULOC_KOREA          "ko_KR"
00237 
00238 #define ULOC_TAIWAN         "zh_TW"
00239 
00240 #define ULOC_UK             "en_GB"
00241 
00242 #define ULOC_US             "en_US"
00243 
00249 #define ULOC_LANG_CAPACITY 12
00250 
00256 #define ULOC_COUNTRY_CAPACITY 4
00257 
00262 #define ULOC_FULLNAME_CAPACITY 157
00263 
00269 #define ULOC_SCRIPT_CAPACITY 6
00270 
00275 #define ULOC_KEYWORDS_CAPACITY 50
00276 
00281 #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
00282 
00287 #define ULOC_KEYWORD_SEPARATOR '@'
00288 
00294 #define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40
00295 
00300 #define ULOC_KEYWORD_ASSIGN '='
00301 
00307 #define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D
00308 
00313 #define ULOC_KEYWORD_ITEM_SEPARATOR ';'
00314 
00320 #define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B
00321 
00336 typedef enum {
00340   ULOC_ACTUAL_LOCALE    = 0,
00344   ULOC_VALID_LOCALE    = 1,
00345 
00346 #ifndef U_HIDE_DEPRECATED_API
00347 
00350   ULOC_REQUESTED_LOCALE = 2,
00351 #endif /* U_HIDE_DEPRECATED_API */
00352 
00353   ULOC_DATA_LOCALE_TYPE_LIMIT = 3
00354 } ULocDataLocaleType ;
00355 
00356 #ifndef U_HIDE_SYSTEM_API
00357 
00368 U_STABLE const char* U_EXPORT2
00369 uloc_getDefault(void);
00370 
00388 U_STABLE void U_EXPORT2
00389 uloc_setDefault(const char* localeID,
00390         UErrorCode*       status);
00391 #endif  /* U_HIDE_SYSTEM_API */
00392 
00405 U_STABLE int32_t U_EXPORT2
00406 uloc_getLanguage(const char*    localeID,
00407          char* language,
00408          int32_t languageCapacity,
00409          UErrorCode* err);
00410 
00423 U_STABLE int32_t U_EXPORT2
00424 uloc_getScript(const char*    localeID,
00425          char* script,
00426          int32_t scriptCapacity,
00427          UErrorCode* err);
00428 
00441 U_STABLE int32_t U_EXPORT2
00442 uloc_getCountry(const char*    localeID,
00443         char* country,
00444         int32_t countryCapacity,
00445         UErrorCode* err);
00446 
00459 U_STABLE int32_t U_EXPORT2
00460 uloc_getVariant(const char*    localeID,
00461         char* variant,
00462         int32_t variantCapacity,
00463         UErrorCode* err);
00464 
00465 
00482 U_STABLE int32_t U_EXPORT2
00483 uloc_getName(const char*    localeID,
00484          char* name,
00485          int32_t nameCapacity,
00486          UErrorCode* err);
00487 
00505 U_STABLE int32_t U_EXPORT2
00506 uloc_canonicalize(const char*    localeID,
00507          char* name,
00508          int32_t nameCapacity,
00509          UErrorCode* err);
00510 
00518 U_STABLE const char* U_EXPORT2
00519 uloc_getISO3Language(const char* localeID);
00520 
00521 
00529 U_STABLE const char* U_EXPORT2
00530 uloc_getISO3Country(const char* localeID);
00531 
00540 U_STABLE uint32_t U_EXPORT2
00541 uloc_getLCID(const char* localeID);
00542 
00559 U_STABLE int32_t U_EXPORT2
00560 uloc_getDisplayLanguage(const char* locale,
00561             const char* displayLocale,
00562             UChar* language,
00563             int32_t languageCapacity,
00564             UErrorCode* status);
00565 
00582 U_STABLE int32_t U_EXPORT2
00583 uloc_getDisplayScript(const char* locale,
00584             const char* displayLocale,
00585             UChar* script,
00586             int32_t scriptCapacity,
00587             UErrorCode* status);
00588 
00605 U_STABLE int32_t U_EXPORT2
00606 uloc_getDisplayCountry(const char* locale,
00607                        const char* displayLocale,
00608                        UChar* country,
00609                        int32_t countryCapacity,
00610                        UErrorCode* status);
00611 
00612 
00629 U_STABLE int32_t U_EXPORT2
00630 uloc_getDisplayVariant(const char* locale,
00631                        const char* displayLocale,
00632                        UChar* variant,
00633                        int32_t variantCapacity,
00634                        UErrorCode* status);
00635 
00676 U_STABLE int32_t U_EXPORT2
00677 uloc_getDisplayKeyword(const char* keyword,
00678                        const char* displayLocale,
00679                        UChar* dest,
00680                        int32_t destCapacity,
00681                        UErrorCode* status);
00702 U_STABLE int32_t U_EXPORT2
00703 uloc_getDisplayKeywordValue(   const char* locale,
00704                                const char* keyword,
00705                                const char* displayLocale,
00706                                UChar* dest,
00707                                int32_t destCapacity,
00708                                UErrorCode* status);
00725 U_STABLE int32_t U_EXPORT2
00726 uloc_getDisplayName(const char* localeID,
00727             const char* inLocaleID,
00728             UChar* result,
00729             int32_t maxResultSize,
00730             UErrorCode* err);
00731 
00732 
00743 U_STABLE const char* U_EXPORT2
00744 uloc_getAvailable(int32_t n);
00745 
00752 U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void);
00753 
00763 U_STABLE const char* const* U_EXPORT2
00764 uloc_getISOLanguages(void);
00765 
00775 U_STABLE const char* const* U_EXPORT2
00776 uloc_getISOCountries(void);
00777 
00791 U_STABLE int32_t U_EXPORT2
00792 uloc_getParent(const char*    localeID,
00793                  char* parent,
00794                  int32_t parentCapacity,
00795                  UErrorCode* err);
00796 
00797 
00798 
00799 
00819 U_STABLE int32_t U_EXPORT2
00820 uloc_getBaseName(const char*    localeID,
00821          char* name,
00822          int32_t nameCapacity,
00823          UErrorCode* err);
00824 
00834 U_STABLE UEnumeration* U_EXPORT2
00835 uloc_openKeywords(const char* localeID,
00836                         UErrorCode* status);
00837 
00849 U_STABLE int32_t U_EXPORT2
00850 uloc_getKeywordValue(const char* localeID,
00851                      const char* keywordName,
00852                      char* buffer, int32_t bufferCapacity,
00853                      UErrorCode* status);
00854 
00855 
00875 U_STABLE int32_t U_EXPORT2
00876 uloc_setKeywordValue(const char* keywordName,
00877                      const char* keywordValue,
00878                      char* buffer, int32_t bufferCapacity,
00879                      UErrorCode* status);
00880 
00886 typedef enum {
00887   ULOC_LAYOUT_LTR   = 0,  /* left-to-right. */
00888   ULOC_LAYOUT_RTL    = 1,  /* right-to-left. */
00889   ULOC_LAYOUT_TTB    = 2,  /* top-to-bottom. */
00890   ULOC_LAYOUT_BTT    = 3,   /* bottom-to-top. */
00891   ULOC_LAYOUT_UNKNOWN
00892 } ULayoutType;
00893 
00902 U_STABLE ULayoutType U_EXPORT2
00903 uloc_getCharacterOrientation(const char* localeId,
00904                              UErrorCode *status);
00905 
00914 U_STABLE ULayoutType U_EXPORT2
00915 uloc_getLineOrientation(const char* localeId,
00916                         UErrorCode *status);
00917 
00924 typedef enum {
00925   ULOC_ACCEPT_FAILED   = 0,  /* No exact match was found. */
00926   ULOC_ACCEPT_VALID    = 1,  /* An exact match was found. */
00927   ULOC_ACCEPT_FALLBACK = 2   /* A fallback was found, for example, 
00928                                 Accept list contained 'ja_JP'
00929                                 which matched available locale 'ja'. */
00930 } UAcceptResult;
00931 
00932 
00945 U_STABLE int32_t U_EXPORT2
00946 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
00947                             UAcceptResult *outResult,
00948                             const char *httpAcceptLanguage,
00949                             UEnumeration* availableLocales,
00950                             UErrorCode *status);
00951 
00965 U_STABLE int32_t U_EXPORT2
00966 uloc_acceptLanguage(char *result, int32_t resultAvailable, 
00967                     UAcceptResult *outResult, const char **acceptList,
00968                     int32_t acceptListCount,
00969                     UEnumeration* availableLocales,
00970                     UErrorCode *status);
00971 
00972 
00985 U_STABLE int32_t U_EXPORT2
00986 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
00987                     UErrorCode *status);
00988 
00989 
01023 U_STABLE int32_t U_EXPORT2
01024 uloc_addLikelySubtags(const char*    localeID,
01025          char* maximizedLocaleID,
01026          int32_t maximizedLocaleIDCapacity,
01027          UErrorCode* err);
01028 
01029 
01063 U_STABLE int32_t U_EXPORT2
01064 uloc_minimizeSubtags(const char*    localeID,
01065          char* minimizedLocaleID,
01066          int32_t minimizedLocaleIDCapacity,
01067          UErrorCode* err);
01068 
01092 U_DRAFT int32_t U_EXPORT2
01093 uloc_forLanguageTag(const char* langtag,
01094                     char* localeID,
01095                     int32_t localeIDCapacity,
01096                     int32_t* parsedLength,
01097                     UErrorCode* err);
01098 
01120 U_DRAFT int32_t U_EXPORT2
01121 uloc_toLanguageTag(const char* localeID,
01122                    char* langtag,
01123                    int32_t langtagCapacity,
01124                    UBool strict,
01125                    UErrorCode* err);
01126 
01127 #endif /*_ULOC*/