ICU 4.8.1.1  4.8.1.1
uloc.h
Go to the documentation of this file.
00001 /*
00002 **********************************************************************
00003 *   Copyright (C) 1997-2010, 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 
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 
00404 U_STABLE int32_t U_EXPORT2
00405 uloc_getLanguage(const char*    localeID,
00406          char* language,
00407          int32_t languageCapacity,
00408          UErrorCode* err);
00409 
00422 U_STABLE int32_t U_EXPORT2
00423 uloc_getScript(const char*    localeID,
00424          char* script,
00425          int32_t scriptCapacity,
00426          UErrorCode* err);
00427 
00440 U_STABLE int32_t U_EXPORT2
00441 uloc_getCountry(const char*    localeID,
00442         char* country,
00443         int32_t countryCapacity,
00444         UErrorCode* err);
00445 
00458 U_STABLE int32_t U_EXPORT2
00459 uloc_getVariant(const char*    localeID,
00460         char* variant,
00461         int32_t variantCapacity,
00462         UErrorCode* err);
00463 
00464 
00481 U_STABLE int32_t U_EXPORT2
00482 uloc_getName(const char*    localeID,
00483          char* name,
00484          int32_t nameCapacity,
00485          UErrorCode* err);
00486 
00504 U_STABLE int32_t U_EXPORT2
00505 uloc_canonicalize(const char*    localeID,
00506          char* name,
00507          int32_t nameCapacity,
00508          UErrorCode* err);
00509 
00517 U_STABLE const char* U_EXPORT2
00518 uloc_getISO3Language(const char* localeID);
00519 
00520 
00528 U_STABLE const char* U_EXPORT2
00529 uloc_getISO3Country(const char* localeID);
00530 
00539 U_STABLE uint32_t U_EXPORT2
00540 uloc_getLCID(const char* localeID);
00541 
00558 U_STABLE int32_t U_EXPORT2
00559 uloc_getDisplayLanguage(const char* locale,
00560             const char* displayLocale,
00561             UChar* language,
00562             int32_t languageCapacity,
00563             UErrorCode* status);
00564 
00581 U_STABLE int32_t U_EXPORT2
00582 uloc_getDisplayScript(const char* locale,
00583             const char* displayLocale,
00584             UChar* script,
00585             int32_t scriptCapacity,
00586             UErrorCode* status);
00587 
00604 U_STABLE int32_t U_EXPORT2
00605 uloc_getDisplayCountry(const char* locale,
00606                        const char* displayLocale,
00607                        UChar* country,
00608                        int32_t countryCapacity,
00609                        UErrorCode* status);
00610 
00611 
00628 U_STABLE int32_t U_EXPORT2
00629 uloc_getDisplayVariant(const char* locale,
00630                        const char* displayLocale,
00631                        UChar* variant,
00632                        int32_t variantCapacity,
00633                        UErrorCode* status);
00634 
00675 U_STABLE int32_t U_EXPORT2
00676 uloc_getDisplayKeyword(const char* keyword,
00677                        const char* displayLocale,
00678                        UChar* dest,
00679                        int32_t destCapacity,
00680                        UErrorCode* status);
00701 U_STABLE int32_t U_EXPORT2
00702 uloc_getDisplayKeywordValue(   const char* locale,
00703                                const char* keyword,
00704                                const char* displayLocale,
00705                                UChar* dest,
00706                                int32_t destCapacity,
00707                                UErrorCode* status);
00724 U_STABLE int32_t U_EXPORT2
00725 uloc_getDisplayName(const char* localeID,
00726             const char* inLocaleID,
00727             UChar* result,
00728             int32_t maxResultSize,
00729             UErrorCode* err);
00730 
00731 
00742 U_STABLE const char* U_EXPORT2
00743 uloc_getAvailable(int32_t n);
00744 
00751 U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void);
00752 
00762 U_STABLE const char* const* U_EXPORT2
00763 uloc_getISOLanguages(void);
00764 
00774 U_STABLE const char* const* U_EXPORT2
00775 uloc_getISOCountries(void);
00776 
00790 U_STABLE int32_t U_EXPORT2
00791 uloc_getParent(const char*    localeID,
00792                  char* parent,
00793                  int32_t parentCapacity,
00794                  UErrorCode* err);
00795 
00796 
00797 
00798 
00818 U_STABLE int32_t U_EXPORT2
00819 uloc_getBaseName(const char*    localeID,
00820          char* name,
00821          int32_t nameCapacity,
00822          UErrorCode* err);
00823 
00833 U_STABLE UEnumeration* U_EXPORT2
00834 uloc_openKeywords(const char* localeID,
00835                         UErrorCode* status);
00836 
00848 U_STABLE int32_t U_EXPORT2
00849 uloc_getKeywordValue(const char* localeID,
00850                      const char* keywordName,
00851                      char* buffer, int32_t bufferCapacity,
00852                      UErrorCode* status);
00853 
00854 
00874 U_STABLE int32_t U_EXPORT2
00875 uloc_setKeywordValue(const char* keywordName,
00876                      const char* keywordValue,
00877                      char* buffer, int32_t bufferCapacity,
00878                      UErrorCode* status);
00879 
00885 typedef enum {
00886   ULOC_LAYOUT_LTR   = 0,  /* left-to-right. */
00887   ULOC_LAYOUT_RTL    = 1,  /* right-to-left. */
00888   ULOC_LAYOUT_TTB    = 2,  /* top-to-bottom. */
00889   ULOC_LAYOUT_BTT    = 3,   /* bottom-to-top. */
00890   ULOC_LAYOUT_UNKNOWN
00891 } ULayoutType;
00892 
00901 U_STABLE ULayoutType U_EXPORT2
00902 uloc_getCharacterOrientation(const char* localeId,
00903                              UErrorCode *status);
00904 
00913 U_STABLE ULayoutType U_EXPORT2
00914 uloc_getLineOrientation(const char* localeId,
00915                         UErrorCode *status);
00916 
00923 typedef enum {
00924   ULOC_ACCEPT_FAILED   = 0,  /* No exact match was found. */
00925   ULOC_ACCEPT_VALID    = 1,  /* An exact match was found. */
00926   ULOC_ACCEPT_FALLBACK = 2   /* A fallback was found, for example, 
00927                                 Accept list contained 'ja_JP'
00928                                 which matched available locale 'ja'. */
00929 } UAcceptResult;
00930 
00931 
00944 U_STABLE int32_t U_EXPORT2
00945 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
00946                             UAcceptResult *outResult,
00947                             const char *httpAcceptLanguage,
00948                             UEnumeration* availableLocales,
00949                             UErrorCode *status);
00950 
00964 U_STABLE int32_t U_EXPORT2
00965 uloc_acceptLanguage(char *result, int32_t resultAvailable, 
00966                     UAcceptResult *outResult, const char **acceptList,
00967                     int32_t acceptListCount,
00968                     UEnumeration* availableLocales,
00969                     UErrorCode *status);
00970 
00971 
00984 U_STABLE int32_t U_EXPORT2
00985 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
00986                     UErrorCode *status);
00987 
00988 
01022 U_STABLE int32_t U_EXPORT2
01023 uloc_addLikelySubtags(const char*    localeID,
01024          char* maximizedLocaleID,
01025          int32_t maximizedLocaleIDCapacity,
01026          UErrorCode* err);
01027 
01028 
01062 U_STABLE int32_t U_EXPORT2
01063 uloc_minimizeSubtags(const char*    localeID,
01064          char* minimizedLocaleID,
01065          int32_t minimizedLocaleIDCapacity,
01066          UErrorCode* err);
01067 
01091 U_DRAFT int32_t U_EXPORT2
01092 uloc_forLanguageTag(const char* langtag,
01093                     char* localeID,
01094                     int32_t localeIDCapacity,
01095                     int32_t* parsedLength,
01096                     UErrorCode* err);
01097 
01119 U_DRAFT int32_t U_EXPORT2
01120 uloc_toLanguageTag(const char* localeID,
01121                    char* langtag,
01122                    int32_t langtagCapacity,
01123                    UBool strict,
01124                    UErrorCode* err);
01125 
01126 #endif /*_ULOC*/
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Defines