ICU 4.2.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
uloc.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 1997-2009, International Business Machines
4 * Corporation and others. All Rights Reserved.
5 **********************************************************************
6 *
7 * File ULOC.H
8 *
9 * Modification History:
10 *
11 * Date Name Description
12 * 04/01/97 aliu Creation.
13 * 08/22/98 stephen JDK 1.2 sync.
14 * 12/08/98 rtg New C API for Locale
15 * 03/30/99 damiba overhaul
16 * 03/31/99 helena Javadoc for uloc functions.
17 * 04/15/99 Madhu Updated Javadoc
18 ********************************************************************************
19 */
20 
21 #ifndef ULOC_H
22 #define ULOC_H
23 
24 #include "unicode/utypes.h"
25 #include "unicode/uenum.h"
26 
201 #define ULOC_CHINESE "zh"
202 
203 #define ULOC_ENGLISH "en"
204 
205 #define ULOC_FRENCH "fr"
206 
207 #define ULOC_GERMAN "de"
208 
209 #define ULOC_ITALIAN "it"
210 
211 #define ULOC_JAPANESE "ja"
212 
213 #define ULOC_KOREAN "ko"
214 
215 #define ULOC_SIMPLIFIED_CHINESE "zh_CN"
216 
217 #define ULOC_TRADITIONAL_CHINESE "zh_TW"
218 
220 #define ULOC_CANADA "en_CA"
221 
222 #define ULOC_CANADA_FRENCH "fr_CA"
223 
224 #define ULOC_CHINA "zh_CN"
225 
226 #define ULOC_PRC "zh_CN"
227 
228 #define ULOC_FRANCE "fr_FR"
229 
230 #define ULOC_GERMANY "de_DE"
231 
232 #define ULOC_ITALY "it_IT"
233 
234 #define ULOC_JAPAN "ja_JP"
235 
236 #define ULOC_KOREA "ko_KR"
237 
238 #define ULOC_TAIWAN "zh_TW"
239 
240 #define ULOC_UK "en_GB"
241 
242 #define ULOC_US "en_US"
243 
249 #define ULOC_LANG_CAPACITY 12
250 
256 #define ULOC_COUNTRY_CAPACITY 4
257 
262 #define ULOC_FULLNAME_CAPACITY 157
263 
269 #define ULOC_SCRIPT_CAPACITY 6
270 
275 #define ULOC_KEYWORDS_CAPACITY 50
276 
281 #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100
282 
288 #define ULOC_KEYWORD_SEPARATOR '@'
289 
293 #define ULOC_KEYWORD_ASSIGN '='
294 
298 #define ULOC_KEYWORD_ITEM_SEPARATOR ';'
299 
314 typedef enum {
323 
324 #ifndef U_HIDE_DEPRECATED_API
325 
329 #endif /* U_HIDE_DEPRECATED_API */
330 
331  ULOC_DATA_LOCALE_TYPE_LIMIT = 3
333 
334 
346 U_STABLE const char* U_EXPORT2
347 uloc_getDefault(void);
348 
366 U_STABLE void U_EXPORT2
367 uloc_setDefault(const char* localeID,
368  UErrorCode* status);
369 
383 uloc_getLanguage(const char* localeID,
384  char* language,
385  int32_t languageCapacity,
386  UErrorCode* err);
387 
401 uloc_getScript(const char* localeID,
402  char* script,
403  int32_t scriptCapacity,
404  UErrorCode* err);
405 
419 uloc_getCountry(const char* localeID,
420  char* country,
421  int32_t countryCapacity,
422  UErrorCode* err);
423 
437 uloc_getVariant(const char* localeID,
438  char* variant,
439  int32_t variantCapacity,
440  UErrorCode* err);
441 
442 
460 uloc_getName(const char* localeID,
461  char* name,
462  int32_t nameCapacity,
463  UErrorCode* err);
464 
483 uloc_canonicalize(const char* localeID,
484  char* name,
485  int32_t nameCapacity,
486  UErrorCode* err);
487 
495 U_STABLE const char* U_EXPORT2
496 uloc_getISO3Language(const char* localeID);
497 
498 
506 U_STABLE const char* U_EXPORT2
507 uloc_getISO3Country(const char* localeID);
508 
518 uloc_getLCID(const char* localeID);
519 
537 uloc_getDisplayLanguage(const char* locale,
538  const char* displayLocale,
539  UChar* language,
540  int32_t languageCapacity,
541  UErrorCode* status);
542 
560 uloc_getDisplayScript(const char* locale,
561  const char* displayLocale,
562  UChar* script,
563  int32_t scriptCapacity,
564  UErrorCode* status);
565 
583 uloc_getDisplayCountry(const char* locale,
584  const char* displayLocale,
585  UChar* country,
586  int32_t countryCapacity,
587  UErrorCode* status);
588 
589 
607 uloc_getDisplayVariant(const char* locale,
608  const char* displayLocale,
609  UChar* variant,
610  int32_t variantCapacity,
611  UErrorCode* status);
612 
654 uloc_getDisplayKeyword(const char* keyword,
655  const char* displayLocale,
656  UChar* dest,
657  int32_t destCapacity,
658  UErrorCode* status);
680 uloc_getDisplayKeywordValue( const char* locale,
681  const char* keyword,
682  const char* displayLocale,
683  UChar* dest,
684  int32_t destCapacity,
685  UErrorCode* status);
703 uloc_getDisplayName(const char* localeID,
704  const char* inLocaleID,
705  UChar* result,
706  int32_t maxResultSize,
707  UErrorCode* err);
708 
709 
720 U_STABLE const char* U_EXPORT2
722 
730 
740 U_STABLE const char* const* U_EXPORT2
742 
752 U_STABLE const char* const* U_EXPORT2
754 
769 uloc_getParent(const char* localeID,
770  char* parent,
771  int32_t parentCapacity,
772  UErrorCode* err);
773 
774 
775 
776 
797 uloc_getBaseName(const char* localeID,
798  char* name,
799  int32_t nameCapacity,
800  UErrorCode* err);
801 
812 uloc_openKeywords(const char* localeID,
813  UErrorCode* status);
814 
827 uloc_getKeywordValue(const char* localeID,
828  const char* keywordName,
829  char* buffer, int32_t bufferCapacity,
830  UErrorCode* status);
831 
832 
853 uloc_setKeywordValue(const char* keywordName,
854  const char* keywordValue,
855  char* buffer, int32_t bufferCapacity,
856  UErrorCode* status);
857 
863 typedef enum {
864  ULOC_LAYOUT_LTR = 0, /* left-to-right. */
865  ULOC_LAYOUT_RTL = 1, /* right-to-left. */
866  ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */
867  ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */
868  ULOC_LAYOUT_UNKNOWN
869 } ULayoutType;
870 
880 uloc_getCharacterOrientation(const char* localeId,
881  UErrorCode *status);
882 
892 uloc_getLineOrientation(const char* localeId,
893  UErrorCode *status);
894 
901 typedef enum {
902  ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */
903  ULOC_ACCEPT_VALID = 1, /* An exact match was found. */
904  ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example,
905  Accept list contained 'ja_JP'
906  which matched available locale 'ja'. */
907 } UAcceptResult;
908 
909 
923 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
924  UAcceptResult *outResult,
925  const char *httpAcceptLanguage,
926  UEnumeration* availableLocales,
927  UErrorCode *status);
928 
943 uloc_acceptLanguage(char *result, int32_t resultAvailable,
944  UAcceptResult *outResult, const char **acceptList,
945  int32_t acceptListCount,
946  UEnumeration* availableLocales,
947  UErrorCode *status);
948 
949 
963 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
964  UErrorCode *status);
965 
966 
1001 uloc_addLikelySubtags(const char* localeID,
1002  char* maximizedLocaleID,
1003  int32_t maximizedLocaleIDCapacity,
1004  UErrorCode* err);
1005 
1006 
1041 uloc_minimizeSubtags(const char* localeID,
1042  char* minimizedLocaleID,
1043  int32_t minimizedLocaleIDCapacity,
1044  UErrorCode* err);
1045 
1070 uloc_forLanguageTag(const char* langtag,
1071  char* localeID,
1072  int32_t localeIDCapacity,
1073  int32_t* parsedLength,
1074  UErrorCode* err);
1075 
1098 uloc_toLanguageTag(const char* localeID,
1099  char* langtag,
1100  int32_t langtagCapacity,
1101  UBool strict,
1102  UErrorCode* err);
1103 
1104 #endif /*_ULOC*/
int32_t uloc_getScript(const char *localeID, char *script, int32_t scriptCapacity, UErrorCode *err)
Gets the script code for the specified locale.
int32_t uloc_getDisplayVariant(const char *locale, const char *displayLocale, UChar *variant, int32_t variantCapacity, UErrorCode *status)
Gets the variant name suitable for display for the specified locale.
uint32_t uloc_getLCID(const char *localeID)
Gets the Win32 LCID value for the specified locale.
int32_t uloc_getName(const char *localeID, char *name, int32_t nameCapacity, UErrorCode *err)
Gets the full name for the specified locale.
const char *const * uloc_getISOCountries(void)
Gets a list of all available 2-letter country codes defined in ISO 639.
This is the requested locale.
Definition: uloc.h:328
int32_t uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity, UErrorCode *status)
Gets the ICU locale ID for the specified Win32 LCID value.
const char * uloc_getISO3Country(const char *localeID)
Gets the ISO country code for the specified locale.
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:38
const char * uloc_getISO3Language(const char *localeID)
Gets the ISO language code for the specified locale.
const char * uloc_getAvailable(int32_t n)
Gets the specified locale from a list of all available locales.
int32_t uloc_getDisplayCountry(const char *locale, const char *displayLocale, UChar *country, int32_t countryCapacity, UErrorCode *status)
Gets the country name suitable for display for the specified locale.
int32_t uloc_getBaseName(const char *localeID, char *name, int32_t nameCapacity, UErrorCode *err)
Gets the full name for the specified locale.
unsigned int uint32_t
Define 64 bit limits.
Definition: pwin32.h:147
int32_t uloc_forLanguageTag(const char *langtag, char *localeID, int32_t localeIDCapacity, int32_t *parsedLength, UErrorCode *err)
Returns a locale ID for the specified BCP47 language tag string.
int32_t uloc_getDisplayScript(const char *locale, const char *displayLocale, UChar *script, int32_t scriptCapacity, UErrorCode *status)
Gets the script name suitable for display for the specified locale.
This is locale the data actually comes from.
Definition: uloc.h:318
int32_t uloc_acceptLanguage(char *result, int32_t resultAvailable, UAcceptResult *outResult, const char **acceptList, int32_t acceptListCount, UEnumeration *availableLocales, UErrorCode *status)
Based on a list of available locales, determine an acceptable locale for the user.
int32_t uloc_getLanguage(const char *localeID, char *language, int32_t languageCapacity, UErrorCode *err)
Gets the language code for the specified locale.
ULayoutType uloc_getCharacterOrientation(const char *localeId, UErrorCode *status)
Get the layout character orientation for the specified locale.
This is the most specific locale supported by ICU.
Definition: uloc.h:322
int32_t uloc_setKeywordValue(const char *keywordName, const char *keywordValue, char *buffer, int32_t bufferCapacity, UErrorCode *status)
Set the value of the specified keyword.
int32_t uloc_getVariant(const char *localeID, char *variant, int32_t variantCapacity, UErrorCode *err)
Gets the variant code for the specified locale.
int32_t uloc_minimizeSubtags(const char *localeID, char *minimizedLocaleID, int32_t minimizedLocaleIDCapacity, UErrorCode *err)
Minimize the subtags for a provided locale ID, per the algorithm described in the following CLDR tech...
ULayoutType uloc_getLineOrientation(const char *localeId, UErrorCode *status)
Get the layout line orientation for the specified locale.
#define U_EXPORT2
Definition: platform.h:338
int32_t uloc_getDisplayKeywordValue(const char *locale, const char *keyword, const char *displayLocale, UChar *dest, int32_t destCapacity, UErrorCode *status)
Gets the value of the keyword suitable for display for the specified locale.
int32_t uloc_getDisplayKeyword(const char *keyword, const char *displayLocale, UChar *dest, int32_t destCapacity, UErrorCode *status)
Gets the keyword name suitable for display for the specified locale.
int32_t uloc_canonicalize(const char *localeID, char *name, int32_t nameCapacity, UErrorCode *err)
Gets the full name for the specified locale.
const char * uloc_getDefault(void)
Gets ICU's default locale.
UAcceptResult
enums for the 'outResult' parameter return value
Definition: uloc.h:901
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:299
int32_t uloc_getKeywordValue(const char *localeID, const char *keywordName, char *buffer, int32_t bufferCapacity, UErrorCode *status)
Get the value for a keyword.
int32_t uloc_getCountry(const char *localeID, char *country, int32_t countryCapacity, UErrorCode *err)
Gets the country code for the specified locale.
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:593
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:314
int32_t uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable, UAcceptResult *outResult, const char *httpAcceptLanguage, UEnumeration *availableLocales, UErrorCode *status)
Based on a HTTP header from a web browser and a list of available locales, determine an acceptable lo...
int32_t uloc_toLanguageTag(const char *localeID, char *langtag, int32_t langtagCapacity, UBool strict, UErrorCode *err)
Returns a well-formed language tag for this locale ID.
int32_t uloc_getDisplayLanguage(const char *locale, const char *displayLocale, UChar *language, int32_t languageCapacity, UErrorCode *status)
Gets the language name suitable for display for the specified locale.
C API: String Enumeration.
Basic definitions for ICU, for both C and C++ APIs.
void uloc_setDefault(const char *localeID, UErrorCode *status)
Sets ICU's default locale.
int32_t uloc_getParent(const char *localeID, char *parent, int32_t parentCapacity, UErrorCode *err)
Truncate the locale ID string to get the parent locale ID.
UEnumeration * uloc_openKeywords(const char *localeID, UErrorCode *status)
Gets an enumeration of keywords for the specified locale.
const char *const * uloc_getISOLanguages(void)
Gets a list of all available language codes defined in ISO 639.
int32_t uloc_addLikelySubtags(const char *localeID, char *maximizedLocaleID, int32_t maximizedLocaleIDCapacity, UErrorCode *err)
Add the likely subtags for a provided locale ID, per the algorithm described in the following CLDR te...
int32_t uloc_getDisplayName(const char *localeID, const char *inLocaleID, UChar *result, int32_t maxResultSize, UErrorCode *err)
Gets the full name suitable for display for the specified locale.
#define U_DRAFT
This is used to declare a function as a draft public ICU C API.
Definition: umachine.h:119
ULayoutType
enums for the return value for the character and line orientation functions.
Definition: uloc.h:863
signed int int32_t
Define 64 bit limits.
Definition: pwin32.h:143
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:117
int32_t uloc_countAvailable(void)
Gets the size of the all available locale list.
int8_t UBool
The ICU boolean type.
Definition: umachine.h:208