ICU 51.2  51.2
uloc.h
Go to the documentation of this file.
1 /*
2 **********************************************************************
3 * Copyright (C) 1997-2013, 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 #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
767 
777 U_STABLE const char* const* U_EXPORT2
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 
821 U_STABLE int32_t U_EXPORT2
822 uloc_getBaseName(const char* localeID,
823  char* name,
824  int32_t nameCapacity,
825  UErrorCode* err);
826 
836 U_STABLE UEnumeration* U_EXPORT2
837 uloc_openKeywords(const char* localeID,
838  UErrorCode* status);
839 
851 U_STABLE int32_t U_EXPORT2
852 uloc_getKeywordValue(const char* localeID,
853  const char* keywordName,
854  char* buffer, int32_t bufferCapacity,
855  UErrorCode* status);
856 
857 
877 U_STABLE int32_t U_EXPORT2
878 uloc_setKeywordValue(const char* keywordName,
879  const char* keywordValue,
880  char* buffer, int32_t bufferCapacity,
881  UErrorCode* status);
882 
888 typedef enum {
889  ULOC_LAYOUT_LTR = 0, /* left-to-right. */
890  ULOC_LAYOUT_RTL = 1, /* right-to-left. */
891  ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */
892  ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */
893  ULOC_LAYOUT_UNKNOWN
894 } ULayoutType;
895 
904 U_STABLE ULayoutType U_EXPORT2
905 uloc_getCharacterOrientation(const char* localeId,
906  UErrorCode *status);
907 
916 U_STABLE ULayoutType U_EXPORT2
917 uloc_getLineOrientation(const char* localeId,
918  UErrorCode *status);
919 
926 typedef enum {
927  ULOC_ACCEPT_FAILED = 0, /* No exact match was found. */
928  ULOC_ACCEPT_VALID = 1, /* An exact match was found. */
929  ULOC_ACCEPT_FALLBACK = 2 /* A fallback was found, for example,
930  Accept list contained 'ja_JP'
931  which matched available locale 'ja'. */
932 } UAcceptResult;
933 
934 
947 U_STABLE int32_t U_EXPORT2
948 uloc_acceptLanguageFromHTTP(char *result, int32_t resultAvailable,
949  UAcceptResult *outResult,
950  const char *httpAcceptLanguage,
951  UEnumeration* availableLocales,
952  UErrorCode *status);
953 
967 U_STABLE int32_t U_EXPORT2
968 uloc_acceptLanguage(char *result, int32_t resultAvailable,
969  UAcceptResult *outResult, const char **acceptList,
970  int32_t acceptListCount,
971  UEnumeration* availableLocales,
972  UErrorCode *status);
973 
974 
987 U_STABLE int32_t U_EXPORT2
988 uloc_getLocaleForLCID(uint32_t hostID, char *locale, int32_t localeCapacity,
989  UErrorCode *status);
990 
991 
1025 U_STABLE int32_t U_EXPORT2
1026 uloc_addLikelySubtags(const char* localeID,
1027  char* maximizedLocaleID,
1028  int32_t maximizedLocaleIDCapacity,
1029  UErrorCode* err);
1030 
1031 
1065 U_STABLE int32_t U_EXPORT2
1066 uloc_minimizeSubtags(const char* localeID,
1067  char* minimizedLocaleID,
1068  int32_t minimizedLocaleIDCapacity,
1069  UErrorCode* err);
1070 
1094 U_STABLE int32_t U_EXPORT2
1095 uloc_forLanguageTag(const char* langtag,
1096  char* localeID,
1097  int32_t localeIDCapacity,
1098  int32_t* parsedLength,
1099  UErrorCode* err);
1100 
1122 U_STABLE int32_t U_EXPORT2
1123 uloc_toLanguageTag(const char* localeID,
1124  char* langtag,
1125  int32_t langtagCapacity,
1126  UBool strict,
1127  UErrorCode* err);
1128 
1129 #endif /*_ULOC*/