ICU 4.8.1.1  4.8.1.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-2010, 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 
287 #define ULOC_KEYWORD_SEPARATOR '@'
288 
294 #define ULOC_KEYWORD_SEPARATOR_UNICODE 0x40
295 
300 #define ULOC_KEYWORD_ASSIGN '='
301 
307 #define ULOC_KEYWORD_ASSIGN_UNICODE 0x3D
308 
313 #define ULOC_KEYWORD_ITEM_SEPARATOR ';'
314 
320 #define ULOC_KEYWORD_ITEM_SEPARATOR_UNICODE 0x3B
321 
336 typedef enum {
345 
346 #ifndef U_HIDE_DEPRECATED_API
347 
351 #endif /* U_HIDE_DEPRECATED_API */
352 
353  ULOC_DATA_LOCALE_TYPE_LIMIT = 3
355 
356 
368 U_STABLE const char* U_EXPORT2
369 uloc_getDefault(void);
370 
388 U_STABLE void U_EXPORT2
389 uloc_setDefault(const char* localeID,
390  UErrorCode* status);
391 
404 U_STABLE int32_t U_EXPORT2
405 uloc_getLanguage(const char* localeID,
406  char* language,
407  int32_t languageCapacity,
408  UErrorCode* err);
409 
422 U_STABLE int32_t U_EXPORT2
423 uloc_getScript(const char* localeID,
424  char* script,
425  int32_t scriptCapacity,
426  UErrorCode* err);
427 
440 U_STABLE int32_t U_EXPORT2
441 uloc_getCountry(const char* localeID,
442  char* country,
443  int32_t countryCapacity,
444  UErrorCode* err);
445 
458 U_STABLE int32_t U_EXPORT2
459 uloc_getVariant(const char* localeID,
460  char* variant,
461  int32_t variantCapacity,
462  UErrorCode* err);
463 
464 
481 U_STABLE int32_t U_EXPORT2
482 uloc_getName(const char* localeID,
483  char* name,
484  int32_t nameCapacity,
485  UErrorCode* err);
486 
504 U_STABLE int32_t U_EXPORT2
505 uloc_canonicalize(const char* localeID,
506  char* name,
507  int32_t nameCapacity,
508  UErrorCode* err);
509 
517 U_STABLE const char* U_EXPORT2
518 uloc_getISO3Language(const char* localeID);
519 
520 
528 U_STABLE const char* U_EXPORT2
529 uloc_getISO3Country(const char* localeID);
530 
539 U_STABLE uint32_t U_EXPORT2
540 uloc_getLCID(const char* localeID);
541 
558 U_STABLE int32_t U_EXPORT2
559 uloc_getDisplayLanguage(const char* locale,
560  const char* displayLocale,
561  UChar* language,
562  int32_t languageCapacity,
563  UErrorCode* status);
564 
581 U_STABLE int32_t U_EXPORT2
582 uloc_getDisplayScript(const char* locale,
583  const char* displayLocale,
584  UChar* script,
585  int32_t scriptCapacity,
586  UErrorCode* status);
587 
604 U_STABLE int32_t U_EXPORT2
605 uloc_getDisplayCountry(const char* locale,
606  const char* displayLocale,
607  UChar* country,
608  int32_t countryCapacity,
609  UErrorCode* status);
610 
611 
628 U_STABLE int32_t U_EXPORT2
629 uloc_getDisplayVariant(const char* locale,
630  const char* displayLocale,
631  UChar* variant,
632  int32_t variantCapacity,
633  UErrorCode* status);
634 
675 U_STABLE int32_t U_EXPORT2
676 uloc_getDisplayKeyword(const char* keyword,
677  const char* displayLocale,
678  UChar* dest,
679  int32_t destCapacity,
680  UErrorCode* status);
701 U_STABLE int32_t U_EXPORT2
702 uloc_getDisplayKeywordValue( const char* locale,
703  const char* keyword,
704  const char* displayLocale,
705  UChar* dest,
706  int32_t destCapacity,
707  UErrorCode* status);
724 U_STABLE int32_t U_EXPORT2
725 uloc_getDisplayName(const char* localeID,
726  const char* inLocaleID,
727  UChar* result,
728  int32_t maxResultSize,
729  UErrorCode* err);
730 
731 
742 U_STABLE const char* U_EXPORT2
743 uloc_getAvailable(int32_t n);
744 
752 
762 U_STABLE const char* const* U_EXPORT2
764 
774 U_STABLE const char* const* U_EXPORT2
776 
790 U_STABLE int32_t U_EXPORT2
791 uloc_getParent(const char* localeID,
792  char* parent,
793  int32_t parentCapacity,
794  UErrorCode* err);
795 
796 
797 
798 
818 U_STABLE int32_t U_EXPORT2
819 uloc_getBaseName(const char* localeID,
820  char* name,
821  int32_t nameCapacity,
822  UErrorCode* err);
823 
834 uloc_openKeywords(const char* localeID,
835  UErrorCode* status);
836 
848 U_STABLE int32_t U_EXPORT2
849 uloc_getKeywordValue(const char* localeID,
850  const char* keywordName,
851  char* buffer, int32_t bufferCapacity,
852  UErrorCode* status);
853 
854 
874 U_STABLE int32_t U_EXPORT2
875 uloc_setKeywordValue(const char* keywordName,
876  const char* keywordValue,
877  char* buffer, int32_t bufferCapacity,
878  UErrorCode* status);
879 
885 typedef enum {
886  ULOC_LAYOUT_LTR = 0, /* left-to-right. */
887  ULOC_LAYOUT_RTL = 1, /* right-to-left. */
888  ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */
889  ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */
890  ULOC_LAYOUT_UNKNOWN
891 } ULayoutType;
892 
902 uloc_getCharacterOrientation(const char* localeId,
903  UErrorCode *status);
904 
914 uloc_getLineOrientation(const char* localeId,
915  UErrorCode *status);
916 
923 typedef enum {
924  ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */
925  ULOC_ACCEPT_VALID = 1, /* An exact match was found. */
926  ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example,
927  Accept list contained 'ja_JP'
928  which matched available locale 'ja'. */
929 } UAcceptResult;
930 
931 
944 U_STABLE int32_t U_EXPORT2
945 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
946  UAcceptResult *outResult,
947  const char *httpAcceptLanguage,
948  UEnumeration* availableLocales,
949  UErrorCode *status);
950 
964 U_STABLE int32_t U_EXPORT2
965 uloc_acceptLanguage(char *result, int32_t resultAvailable,
966  UAcceptResult *outResult, const char **acceptList,
967  int32_t acceptListCount,
968  UEnumeration* availableLocales,
969  UErrorCode *status);
970 
971 
984 U_STABLE int32_t U_EXPORT2
985 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
986  UErrorCode *status);
987 
988 
1022 U_STABLE int32_t U_EXPORT2
1023 uloc_addLikelySubtags(const char* localeID,
1024  char* maximizedLocaleID,
1025  int32_t maximizedLocaleIDCapacity,
1026  UErrorCode* err);
1027 
1028 
1062 U_STABLE int32_t U_EXPORT2
1063 uloc_minimizeSubtags(const char* localeID,
1064  char* minimizedLocaleID,
1065  int32_t minimizedLocaleIDCapacity,
1066  UErrorCode* err);
1067 
1091 U_DRAFT int32_t U_EXPORT2
1092 uloc_forLanguageTag(const char* langtag,
1093  char* localeID,
1094  int32_t localeIDCapacity,
1095  int32_t* parsedLength,
1096  UErrorCode* err);
1097 
1119 U_DRAFT int32_t U_EXPORT2
1120 uloc_toLanguageTag(const char* localeID,
1121  char* langtag,
1122  int32_t langtagCapacity,
1123  UBool strict,
1124  UErrorCode* err);
1125 
1126 #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:350
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:39
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.
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:340
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:344
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:314
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:923
uint16_t UChar
Define UChar to be wchar_t if that is 16 bits wide; always assumed to be unsigned.
Definition: umachine.h:325
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:639
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:336
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:139
ULayoutType
enums for the return value for the character and line orientation functions.
Definition: uloc.h:885
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:137
int32_t uloc_countAvailable(void)
Gets the size of the all available locale list.
int8_t UBool
The ICU boolean type.
Definition: umachine.h:228