ICU 73.2  73.2
uloc.h
Go to the documentation of this file.
00001 // © 2016 and later: Unicode, Inc. and others.
00002 // License & terms of use: http://www.unicode.org/copyright.html
00003 /*
00004 **********************************************************************
00005 *   Copyright (C) 1997-2016, International Business Machines
00006 *   Corporation and others.  All Rights Reserved.
00007 **********************************************************************
00008 *
00009 * File ULOC.H
00010 *
00011 * Modification History:
00012 *
00013 *   Date        Name        Description
00014 *   04/01/97    aliu        Creation.
00015 *   08/22/98    stephen     JDK 1.2 sync.
00016 *   12/08/98    rtg         New C API for Locale
00017 *   03/30/99    damiba      overhaul
00018 *   03/31/99    helena      Javadoc for uloc functions.
00019 *   04/15/99    Madhu       Updated Javadoc
00020 ********************************************************************************
00021 */
00022 
00023 #ifndef ULOC_H
00024 #define ULOC_H
00025 
00026 #include "unicode/utypes.h"
00027 #include "unicode/uenum.h"
00028 
00203 #define ULOC_CHINESE            "zh"
00204 
00205 #define ULOC_ENGLISH            "en"
00206 
00207 #define ULOC_FRENCH             "fr"
00208 
00209 #define ULOC_GERMAN             "de"
00210 
00211 #define ULOC_ITALIAN            "it"
00212 
00213 #define ULOC_JAPANESE           "ja"
00214 
00215 #define ULOC_KOREAN             "ko"
00216 
00217 #define ULOC_SIMPLIFIED_CHINESE "zh_CN"
00218 
00219 #define ULOC_TRADITIONAL_CHINESE "zh_TW"
00220 
00222 #define ULOC_CANADA         "en_CA"
00223 
00224 #define ULOC_CANADA_FRENCH  "fr_CA"
00225 
00226 #define ULOC_CHINA          "zh_CN"
00227 
00228 #define ULOC_PRC            "zh_CN"
00229 
00230 #define ULOC_FRANCE         "fr_FR"
00231 
00232 #define ULOC_GERMANY        "de_DE"
00233 
00234 #define ULOC_ITALY          "it_IT"
00235 
00236 #define ULOC_JAPAN          "ja_JP"
00237 
00238 #define ULOC_KOREA          "ko_KR"
00239 
00240 #define ULOC_TAIWAN         "zh_TW"
00241 
00242 #define ULOC_UK             "en_GB"
00243 
00244 #define ULOC_US             "en_US"
00245 
00251 #define ULOC_LANG_CAPACITY 12
00252 
00258 #define ULOC_COUNTRY_CAPACITY 4
00259 
00264 #define ULOC_FULLNAME_CAPACITY 157
00265 
00271 #define ULOC_SCRIPT_CAPACITY 6
00272 
00277 #define ULOC_KEYWORDS_CAPACITY 96
00278 
00283 #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
00284 
00289 #define ULOC_KEYWORD_SEPARATOR '@'
00290 
00296 #define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40
00297 
00302 #define ULOC_KEYWORD_ASSIGN '='
00303 
00309 #define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D
00310 
00315 #define ULOC_KEYWORD_ITEM_SEPARATOR ';'
00316 
00322 #define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B
00323 
00338 typedef enum {
00342   ULOC_ACTUAL_LOCALE    = 0,
00346   ULOC_VALID_LOCALE    = 1,
00347 
00348 #ifndef U_HIDE_DEPRECATED_API
00349 
00352   ULOC_REQUESTED_LOCALE = 2,
00353 
00358     ULOC_DATA_LOCALE_TYPE_LIMIT = 3
00359 #endif  // U_HIDE_DEPRECATED_API
00360 } ULocDataLocaleType;
00361 
00362 #ifndef U_HIDE_SYSTEM_API
00363 
00374 U_CAPI const char* U_EXPORT2
00375 uloc_getDefault(void);
00376 
00394 U_CAPI void U_EXPORT2
00395 uloc_setDefault(const char* localeID,
00396         UErrorCode*       status);
00397 #endif  /* U_HIDE_SYSTEM_API */
00398 
00411 U_CAPI int32_t U_EXPORT2
00412 uloc_getLanguage(const char*    localeID,
00413          char* language,
00414          int32_t languageCapacity,
00415          UErrorCode* err);
00416 
00429 U_CAPI int32_t U_EXPORT2
00430 uloc_getScript(const char*    localeID,
00431          char* script,
00432          int32_t scriptCapacity,
00433          UErrorCode* err);
00434 
00447 U_CAPI int32_t U_EXPORT2
00448 uloc_getCountry(const char*    localeID,
00449         char* country,
00450         int32_t countryCapacity,
00451         UErrorCode* err);
00452 
00465 U_CAPI int32_t U_EXPORT2
00466 uloc_getVariant(const char*    localeID,
00467         char* variant,
00468         int32_t variantCapacity,
00469         UErrorCode* err);
00470 
00471 
00488 U_CAPI int32_t U_EXPORT2
00489 uloc_getName(const char*    localeID,
00490          char* name,
00491          int32_t nameCapacity,
00492          UErrorCode* err);
00493 
00511 U_CAPI int32_t U_EXPORT2
00512 uloc_canonicalize(const char*    localeID,
00513          char* name,
00514          int32_t nameCapacity,
00515          UErrorCode* err);
00516 
00524 U_CAPI const char* U_EXPORT2
00525 uloc_getISO3Language(const char* localeID);
00526 
00527 
00535 U_CAPI const char* U_EXPORT2
00536 uloc_getISO3Country(const char* localeID);
00537 
00549 U_CAPI uint32_t U_EXPORT2
00550 uloc_getLCID(const char* localeID);
00551 
00573 U_CAPI int32_t U_EXPORT2
00574 uloc_getDisplayLanguage(const char* locale,
00575             const char* displayLocale,
00576             UChar* language,
00577             int32_t languageCapacity,
00578             UErrorCode* status);
00579 
00602 U_CAPI int32_t U_EXPORT2
00603 uloc_getDisplayScript(const char* locale,
00604             const char* displayLocale,
00605             UChar* script,
00606             int32_t scriptCapacity,
00607             UErrorCode* status);
00608 
00634 U_CAPI int32_t U_EXPORT2
00635 uloc_getDisplayCountry(const char* locale,
00636                        const char* displayLocale,
00637                        UChar* country,
00638                        int32_t countryCapacity,
00639                        UErrorCode* status);
00640 
00641 
00664 U_CAPI int32_t U_EXPORT2
00665 uloc_getDisplayVariant(const char* locale,
00666                        const char* displayLocale,
00667                        UChar* variant,
00668                        int32_t variantCapacity,
00669                        UErrorCode* status);
00670 
00713 U_CAPI int32_t U_EXPORT2
00714 uloc_getDisplayKeyword(const char* keyword,
00715                        const char* displayLocale,
00716                        UChar* dest,
00717                        int32_t destCapacity,
00718                        UErrorCode* status);
00741 U_CAPI int32_t U_EXPORT2
00742 uloc_getDisplayKeywordValue(   const char* locale,
00743                                const char* keyword,
00744                                const char* displayLocale,
00745                                UChar* dest,
00746                                int32_t destCapacity,
00747                                UErrorCode* status);
00764 U_CAPI int32_t U_EXPORT2
00765 uloc_getDisplayName(const char* localeID,
00766             const char* inLocaleID,
00767             UChar* result,
00768             int32_t maxResultSize,
00769             UErrorCode* err);
00770 
00771 
00788 U_CAPI const char* U_EXPORT2
00789 uloc_getAvailable(int32_t n);
00790 
00797 U_CAPI int32_t U_EXPORT2 uloc_countAvailable(void);
00798 
00804 typedef enum ULocAvailableType {
00811   ULOC_AVAILABLE_DEFAULT,
00812 
00829   ULOC_AVAILABLE_ONLY_LEGACY_ALIASES,
00830 
00837   ULOC_AVAILABLE_WITH_LEGACY_ALIASES,
00838 
00839 #ifndef U_HIDE_INTERNAL_API
00840 
00843   ULOC_AVAILABLE_COUNT
00844 #endif  /* U_HIDE_INTERNAL_API */
00845 } ULocAvailableType;
00846 
00858 U_CAPI UEnumeration* U_EXPORT2
00859 uloc_openAvailableByType(ULocAvailableType type, UErrorCode* status);
00860 
00872 U_CAPI const char* const* U_EXPORT2
00873 uloc_getISOLanguages(void);
00874 
00884 U_CAPI const char* const* U_EXPORT2
00885 uloc_getISOCountries(void);
00886 
00900 U_CAPI int32_t U_EXPORT2
00901 uloc_getParent(const char*    localeID,
00902                  char* parent,
00903                  int32_t parentCapacity,
00904                  UErrorCode* err);
00905 
00906 
00907 
00908 
00931 U_CAPI int32_t U_EXPORT2
00932 uloc_getBaseName(const char*    localeID,
00933          char* name,
00934          int32_t nameCapacity,
00935          UErrorCode* err);
00936 
00946 U_CAPI UEnumeration* U_EXPORT2
00947 uloc_openKeywords(const char* localeID,
00948                         UErrorCode* status);
00949 
00963 U_CAPI int32_t U_EXPORT2
00964 uloc_getKeywordValue(const char* localeID,
00965                      const char* keywordName,
00966                      char* buffer, int32_t bufferCapacity,
00967                      UErrorCode* status);
00968 
00969 
01000 U_CAPI int32_t U_EXPORT2
01001 uloc_setKeywordValue(const char* keywordName,
01002                      const char* keywordValue,
01003                      char* buffer, int32_t bufferCapacity,
01004                      UErrorCode* status);
01005 
01020 U_CAPI UBool U_EXPORT2
01021 uloc_isRightToLeft(const char *locale);
01022 
01028 typedef enum {
01029   ULOC_LAYOUT_LTR   = 0,  /* left-to-right. */
01030   ULOC_LAYOUT_RTL    = 1,  /* right-to-left. */
01031   ULOC_LAYOUT_TTB    = 2,  /* top-to-bottom. */
01032   ULOC_LAYOUT_BTT    = 3,   /* bottom-to-top. */
01033   ULOC_LAYOUT_UNKNOWN
01034 } ULayoutType;
01035 
01044 U_CAPI ULayoutType U_EXPORT2
01045 uloc_getCharacterOrientation(const char* localeId,
01046                              UErrorCode *status);
01047 
01056 U_CAPI ULayoutType U_EXPORT2
01057 uloc_getLineOrientation(const char* localeId,
01058                         UErrorCode *status);
01059 
01067 typedef enum {
01072     ULOC_ACCEPT_FAILED   = 0,
01077     ULOC_ACCEPT_VALID    = 1,
01083     ULOC_ACCEPT_FALLBACK = 2   /*  */
01084 } UAcceptResult;
01085 
01103 U_CAPI int32_t U_EXPORT2
01104 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
01105                             UAcceptResult *outResult,
01106                             const char *httpAcceptLanguage,
01107                             UEnumeration* availableLocales,
01108                             UErrorCode *status);
01109 
01128 U_CAPI int32_t U_EXPORT2
01129 uloc_acceptLanguage(char *result, int32_t resultAvailable, 
01130                     UAcceptResult *outResult, const char **acceptList,
01131                     int32_t acceptListCount,
01132                     UEnumeration* availableLocales,
01133                     UErrorCode *status);
01134 
01135 
01148 U_CAPI int32_t U_EXPORT2
01149 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
01150                     UErrorCode *status);
01151 
01152 
01186 U_CAPI int32_t U_EXPORT2
01187 uloc_addLikelySubtags(const char*    localeID,
01188          char* maximizedLocaleID,
01189          int32_t maximizedLocaleIDCapacity,
01190          UErrorCode* err);
01191 
01192 
01226 U_CAPI int32_t U_EXPORT2
01227 uloc_minimizeSubtags(const char*    localeID,
01228          char* minimizedLocaleID,
01229          int32_t minimizedLocaleIDCapacity,
01230          UErrorCode* err);
01231 
01259 U_CAPI int32_t U_EXPORT2
01260 uloc_forLanguageTag(const char* langtag,
01261                     char* localeID,
01262                     int32_t localeIDCapacity,
01263                     int32_t* parsedLength,
01264                     UErrorCode* err);
01265 
01287 U_CAPI int32_t U_EXPORT2
01288 uloc_toLanguageTag(const char* localeID,
01289                    char* langtag,
01290                    int32_t langtagCapacity,
01291                    UBool strict,
01292                    UErrorCode* err);
01293 
01315 U_CAPI const char* U_EXPORT2
01316 uloc_toUnicodeLocaleKey(const char* keyword);
01317 
01346 U_CAPI const char* U_EXPORT2
01347 uloc_toUnicodeLocaleType(const char* keyword, const char* value);
01348 
01361 U_CAPI const char* U_EXPORT2
01362 uloc_toLegacyKey(const char* keyword);
01363 
01390 U_CAPI const char* U_EXPORT2
01391 uloc_toLegacyType(const char* keyword, const char* value);
01392 
01393 #endif /*_ULOC*/