ICU 56.1: uloc.h Source File

ICU 56.1 56.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Data Structures
- Files

- File List
- Globals

uloc.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 1997-2015, 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 96
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 {
340 ULOC_ACTUAL_LOCALE = 0,
344 ULOC_VALID_LOCALE = 1,
345
346 #ifndef U_HIDE_DEPRECATED_API
347
350 ULOC_REQUESTED_LOCALE = 2,
351 #endif /* U_HIDE_DEPRECATED_API */
352
353 ULOC_DATA_LOCALE_TYPE_LIMIT = 3
354 } ULocDataLocaleType ;
355
356 #ifndef U_HIDE_SYSTEM_API
357
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 #endif /* U_HIDE_SYSTEM_API */
392
405 U_STABLE int32_t U_EXPORT2
406 uloc_getLanguage(const char* localeID,
407 char* language,
408 int32_t languageCapacity,
409 UErrorCode* err);
410
423 U_STABLE int32_t U_EXPORT2
424 uloc_getScript(const char* localeID,
425 char* script,
426 int32_t scriptCapacity,
427 UErrorCode* err);
428
441 U_STABLE int32_t U_EXPORT2
442 uloc_getCountry(const char* localeID,
443 char* country,
444 int32_t countryCapacity,
445 UErrorCode* err);
446
459 U_STABLE int32_t U_EXPORT2
460 uloc_getVariant(const char* localeID,
461 char* variant,
462 int32_t variantCapacity,
463 UErrorCode* err);
464
465
482 U_STABLE int32_t U_EXPORT2
483 uloc_getName(const char* localeID,
484 char* name,
485 int32_t nameCapacity,
486 UErrorCode* err);
487
505 U_STABLE int32_t U_EXPORT2
506 uloc_canonicalize(const char* localeID,
507 char* name,
508 int32_t nameCapacity,
509 UErrorCode* err);
510
518 U_STABLE const char* U_EXPORT2
519 uloc_getISO3Language(const char* localeID);
520
521
529 U_STABLE const char* U_EXPORT2
530 uloc_getISO3Country(const char* localeID);
531
540 U_STABLE uint32_t U_EXPORT2
541 uloc_getLCID(const char* localeID);
542
559 U_STABLE int32_t U_EXPORT2
560 uloc_getDisplayLanguage(const char* locale,
561 const char* displayLocale,
562 UChar* language,
563 int32_t languageCapacity,
564 UErrorCode* status);
565
582 U_STABLE int32_t U_EXPORT2
583 uloc_getDisplayScript(const char* locale,
584 const char* displayLocale,
585 UChar* script,
586 int32_t scriptCapacity,
587 UErrorCode* status);
588
605 U_STABLE int32_t U_EXPORT2
606 uloc_getDisplayCountry(const char* locale,
607 const char* displayLocale,
608 UChar* country,
609 int32_t countryCapacity,
610 UErrorCode* status);
611
612
629 U_STABLE int32_t U_EXPORT2
630 uloc_getDisplayVariant(const char* locale,
631 const char* displayLocale,
632 UChar* variant,
633 int32_t variantCapacity,
634 UErrorCode* status);
635
676 U_STABLE int32_t U_EXPORT2
677 uloc_getDisplayKeyword(const char* keyword,
678 const char* displayLocale,
679 UChar* dest,
680 int32_t destCapacity,
681 UErrorCode* status);
702 U_STABLE int32_t U_EXPORT2
703 uloc_getDisplayKeywordValue( const char* locale,
704 const char* keyword,
705 const char* displayLocale,
706 UChar* dest,
707 int32_t destCapacity,
708 UErrorCode* status);
725 U_STABLE int32_t U_EXPORT2
726 uloc_getDisplayName(const char* localeID,
727 const char* inLocaleID,
728 UChar* result,
729 int32_t maxResultSize,
730 UErrorCode* err);
731
732
743 U_STABLE const char* U_EXPORT2
744 uloc_getAvailable(int32_t n);
745
752 U_STABLE int32_t U_EXPORT2 uloc_countAvailable(void);
753
765 U_STABLE const char* const* U_EXPORT2
766 uloc_getISOLanguages(void);
767
777 U_STABLE const char* const* U_EXPORT2
778 uloc_getISOCountries(void);
779
793 U_STABLE int32_t U_EXPORT2
794 uloc_getParent(const char* localeID,
795 char* parent,
796 int32_t parentCapacity,
797 UErrorCode* err);
798
799
800
801
824 U_STABLE int32_t U_EXPORT2
825 uloc_getBaseName(const char* localeID,
826 char* name,
827 int32_t nameCapacity,
828 UErrorCode* err);
829
839 U_STABLE UEnumeration* U_EXPORT2
840 uloc_openKeywords(const char* localeID,
841 UErrorCode* status);
842
854 U_STABLE int32_t U_EXPORT2
855 uloc_getKeywordValue(const char* localeID,
856 const char* keywordName,
857 char* buffer, int32_t bufferCapacity,
858 UErrorCode* status);
859
860
883 U_STABLE int32_t U_EXPORT2
884 uloc_setKeywordValue(const char* keywordName,
885 const char* keywordValue,
886 char* buffer, int32_t bufferCapacity,
887 UErrorCode* status);
888
903 U_STABLE UBool U_EXPORT2
904 uloc_isRightToLeft(const char *locale);
905
911 typedef enum {
912 ULOC_LAYOUT_LTR = 0, /* left-to-right. */
913 ULOC_LAYOUT_RTL = 1, /* right-to-left. */
914 ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */
915 ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */
916 ULOC_LAYOUT_UNKNOWN
917 } ULayoutType;
918
927 U_STABLE ULayoutType U_EXPORT2
928 uloc_getCharacterOrientation(const char* localeId,
929 UErrorCode *status);
930
939 U_STABLE ULayoutType U_EXPORT2
940 uloc_getLineOrientation(const char* localeId,
941 UErrorCode *status);
942
949 typedef enum {
950 ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */
951 ULOC_ACCEPT_VALID = 1, /* An exact match was found. */
952 ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example,
953 Accept list contained 'ja_JP'
954 which matched available locale 'ja'. */
955 } UAcceptResult;
956
957
970 U_STABLE int32_t U_EXPORT2
971 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
972 UAcceptResult *outResult,
973 const char *httpAcceptLanguage,
974 UEnumeration* availableLocales,
975 UErrorCode *status);
976
990 U_STABLE int32_t U_EXPORT2
991 uloc_acceptLanguage(char *result, int32_t resultAvailable,
992 UAcceptResult *outResult, const char **acceptList,
993 int32_t acceptListCount,
994 UEnumeration* availableLocales,
995 UErrorCode *status);
996
997
1010 U_STABLE int32_t U_EXPORT2
1011 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
1012 UErrorCode *status);
1013
1014
1048 U_STABLE int32_t U_EXPORT2
1049 uloc_addLikelySubtags(const char* localeID,
1050 char* maximizedLocaleID,
1051 int32_t maximizedLocaleIDCapacity,
1052 UErrorCode* err);
1053
1054
1088 U_STABLE int32_t U_EXPORT2
1089 uloc_minimizeSubtags(const char* localeID,
1090 char* minimizedLocaleID,
1091 int32_t minimizedLocaleIDCapacity,
1092 UErrorCode* err);
1093
1117 U_STABLE int32_t U_EXPORT2
1118 uloc_forLanguageTag(const char* langtag,
1119 char* localeID,
1120 int32_t localeIDCapacity,
1121 int32_t* parsedLength,
1122 UErrorCode* err);
1123
1145 U_STABLE int32_t U_EXPORT2
1146 uloc_toLanguageTag(const char* localeID,
1147 char* langtag,
1148 int32_t langtagCapacity,
1149 UBool strict,
1150 UErrorCode* err);
1151
1173 U_STABLE const char* U_EXPORT2
1174 uloc_toUnicodeLocaleKey(const char* keyword);
1175
1204 U_STABLE const char* U_EXPORT2
1205 uloc_toUnicodeLocaleType(const char* keyword, const char* value);
1206
1219 U_STABLE const char* U_EXPORT2
1220 uloc_toLegacyKey(const char* keyword);
1221
1248 U_STABLE const char* U_EXPORT2
1249 uloc_toLegacyType(const char* keyword, const char* value);
1250
1251 #endif /*_ULOC*/
uloc_getScript
int32_t uloc_getScript(const char *localeID, char *script, int32_t scriptCapacity, UErrorCode *err)
Gets the script code for the specified locale.
uloc_getDisplayVariant
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.
uloc_getLCID
uint32_t uloc_getLCID(const char *localeID)
Gets the Win32 LCID value for the specified locale.
uloc_getName
int32_t uloc_getName(const char *localeID, char *name, int32_t nameCapacity, UErrorCode *err)
Gets the full name for the specified locale.
uloc_getISOCountries
const char *const * uloc_getISOCountries(void)
Gets a list of all available 2-letter country codes defined in ISO 639.
ULOC_REQUESTED_LOCALE
This is the requested locale.
Definition: uloc.h:350
uloc_toLegacyKey
const char * uloc_toLegacyKey(const char *keyword)
Converts the specified keyword (BCP 47 Unicode locale extension key, or legacy key) to the legacy key...
uloc_getLocaleForLCID
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.
uloc_getISO3Country
const char * uloc_getISO3Country(const char *localeID)
Gets the ISO country code for the specified locale.
UEnumeration
struct UEnumeration UEnumeration
structure representing an enumeration object instance
Definition: uenum.h:39
uloc_getISO3Language
const char * uloc_getISO3Language(const char *localeID)
Gets the ISO language code for the specified locale.
uloc_getAvailable
const char * uloc_getAvailable(int32_t n)
Gets the specified locale from a list of all available locales.
uloc_getDisplayCountry
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.
uloc_getBaseName
int32_t uloc_getBaseName(const char *localeID, char *name, int32_t nameCapacity, UErrorCode *err)
Gets the full name for the specified locale, like uloc_getName(), but without keywords.
uloc_forLanguageTag
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.
uloc_getDisplayScript
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.
ULOC_ACTUAL_LOCALE
This is locale the data actually comes from.
Definition: uloc.h:340
uloc_acceptLanguage
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.
uloc_getLanguage
int32_t uloc_getLanguage(const char *localeID, char *language, int32_t languageCapacity, UErrorCode *err)
Gets the language code for the specified locale.
uloc_getCharacterOrientation
ULayoutType uloc_getCharacterOrientation(const char *localeId, UErrorCode *status)
Get the layout character orientation for the specified locale.
ULOC_VALID_LOCALE
This is the most specific locale supported by ICU.
Definition: uloc.h:344
uloc_setKeywordValue
int32_t uloc_setKeywordValue(const char *keywordName, const char *keywordValue, char *buffer, int32_t bufferCapacity, UErrorCode *status)
Sets or removes the value of the specified keyword.
uloc_getVariant
int32_t uloc_getVariant(const char *localeID, char *variant, int32_t variantCapacity, UErrorCode *err)
Gets the variant code for the specified locale.
uloc_toLegacyType
const char * uloc_toLegacyType(const char *keyword, const char *value)
Converts the specified keyword value (BCP 47 Unicode locale extension type, or legacy type or type al...
uloc_minimizeSubtags
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...
uloc_getLineOrientation
ULayoutType uloc_getLineOrientation(const char *localeId, UErrorCode *status)
Get the layout line orientation for the specified locale.
uloc_getDisplayKeywordValue
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.
uloc_getDisplayKeyword
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.
uloc_canonicalize
int32_t uloc_canonicalize(const char *localeID, char *name, int32_t nameCapacity, UErrorCode *err)
Gets the full name for the specified locale.
uloc_getDefault
const char * uloc_getDefault(void)
Gets ICU's default locale.
UAcceptResult
UAcceptResult
enums for the 'outResult' parameter return value
Definition: uloc.h:949
UChar
uint16_t UChar
Define UChar to be UCHAR_TYPE, if that is #defined (for example, to char16_t), or wchar_t if that is ...
Definition: umachine.h:312
uloc_toUnicodeLocaleType
const char * uloc_toUnicodeLocaleType(const char *keyword, const char *value)
Converts the specified keyword value (legacy type, or BCP 47 Unicode locale extension type) to the we...
uloc_getKeywordValue
int32_t uloc_getKeywordValue(const char *localeID, const char *keywordName, char *buffer, int32_t bufferCapacity, UErrorCode *status)
Get the value for a keyword.
uloc_getCountry
int32_t uloc_getCountry(const char *localeID, char *country, int32_t countryCapacity, UErrorCode *err)
Gets the country code for the specified locale.
uloc_isRightToLeft
UBool uloc_isRightToLeft(const char *locale)
Returns whether the locale's script is written right-to-left.
UErrorCode
UErrorCode
Error code to replace exception handling, so that the code is compatible with all C++ compilers...
Definition: utypes.h:476
ULocDataLocaleType
ULocDataLocaleType
Constants for *_getLocale() Allow user to select whether she wants information on requested...
Definition: uloc.h:336
uloc_acceptLanguageFromHTTP
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...
uloc_toLanguageTag
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.
uloc_getDisplayLanguage
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.
uenum.h
C API: String Enumeration.
utypes.h
Basic definitions for ICU, for both C and C++ APIs.
uloc_setDefault
void uloc_setDefault(const char *localeID, UErrorCode *status)
Sets ICU's default locale.
uloc_getParent
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.
uloc_openKeywords
UEnumeration * uloc_openKeywords(const char *localeID, UErrorCode *status)
Gets an enumeration of keywords for the specified locale.
uloc_getISOLanguages
const char *const * uloc_getISOLanguages(void)
Gets a list of all available 2-letter language codes defined in ISO 639, plus additional 3-letter cod...
uloc_addLikelySubtags
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...
uloc_getDisplayName
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.
ULayoutType
ULayoutType
enums for the return value for the character and line orientation functions.
Definition: uloc.h:911
uloc_toUnicodeLocaleKey
const char * uloc_toUnicodeLocaleKey(const char *keyword)
Converts the specified keyword (legacy key, or BCP 47 Unicode locale extension key) to the equivalent...
U_STABLE
#define U_STABLE
This is used to declare a function as a stable public ICU C API.
Definition: umachine.h:109
uloc_countAvailable
int32_t uloc_countAvailable(void)
Gets the size of the all available locale list.
UBool
int8_t UBool
The ICU boolean type.
Definition: umachine.h:234