OLD | NEW |
1 /* | 1 /* |
2 ********************************************************************** | 2 ********************************************************************** |
3 * Copyright (C) 1997-2013, International Business Machines | 3 * Copyright (C) 1997-2014, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ********************************************************************** | 5 ********************************************************************** |
6 * | 6 * |
7 * File ULOC.H | 7 * File ULOC.H |
8 * | 8 * |
9 * Modification History: | 9 * Modification History: |
10 * | 10 * |
11 * Date Name Description | 11 * Date Name Description |
12 * 04/01/97 aliu Creation. | 12 * 04/01/97 aliu Creation. |
13 * 08/22/98 stephen JDK 1.2 sync. | 13 * 08/22/98 stephen JDK 1.2 sync. |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 * Useful constant for the maximum size of the script part of a locale ID | 265 * Useful constant for the maximum size of the script part of a locale ID |
266 * (including the terminating NULL). | 266 * (including the terminating NULL). |
267 * @stable ICU 2.8 | 267 * @stable ICU 2.8 |
268 */ | 268 */ |
269 #define ULOC_SCRIPT_CAPACITY 6 | 269 #define ULOC_SCRIPT_CAPACITY 6 |
270 | 270 |
271 /** | 271 /** |
272 * Useful constant for the maximum size of keywords in a locale | 272 * Useful constant for the maximum size of keywords in a locale |
273 * @stable ICU 2.8 | 273 * @stable ICU 2.8 |
274 */ | 274 */ |
275 #define ULOC_KEYWORDS_CAPACITY 50 | 275 #define ULOC_KEYWORDS_CAPACITY 96 |
276 | 276 |
277 /** | 277 /** |
278 * Useful constant for the maximum total size of keywords and their values in a
locale | 278 * Useful constant for the maximum total size of keywords and their values in a
locale |
279 * @stable ICU 2.8 | 279 * @stable ICU 2.8 |
280 */ | 280 */ |
281 #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100 | 281 #define ULOC_KEYWORD_AND_VALUES_CAPACITY 100 |
282 | 282 |
283 /** | 283 /** |
284 * Invariant character separating keywords from the locale string | 284 * Invariant character separating keywords from the locale string |
285 * @stable ICU 2.8 | 285 * @stable ICU 2.8 |
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 * @return the length needed for the buffer | 879 * @return the length needed for the buffer |
880 * @see uloc_getKeywordValue | 880 * @see uloc_getKeywordValue |
881 * @stable ICU 3.2 | 881 * @stable ICU 3.2 |
882 */ | 882 */ |
883 U_STABLE int32_t U_EXPORT2 | 883 U_STABLE int32_t U_EXPORT2 |
884 uloc_setKeywordValue(const char* keywordName, | 884 uloc_setKeywordValue(const char* keywordName, |
885 const char* keywordValue, | 885 const char* keywordValue, |
886 char* buffer, int32_t bufferCapacity, | 886 char* buffer, int32_t bufferCapacity, |
887 UErrorCode* status); | 887 UErrorCode* status); |
888 | 888 |
| 889 #ifndef U_HIDE_DRAFT_API |
| 890 /** |
| 891 * Returns whether the locale's script is written right-to-left. |
| 892 * If there is no script subtag, then the likely script is used, see uloc_addLik
elySubtags(). |
| 893 * If no likely script is known, then FALSE is returned. |
| 894 * |
| 895 * A script is right-to-left according to the CLDR script metadata |
| 896 * which corresponds to whether the script's letters have Bidi_Class=R or AL. |
| 897 * |
| 898 * Returns TRUE for "ar" and "en-Hebr", FALSE for "zh" and "fa-Cyrl". |
| 899 * |
| 900 * @param locale input locale ID |
| 901 * @return TRUE if the locale's script is written right-to-left |
| 902 * @draft ICU 54 |
| 903 */ |
| 904 U_DRAFT UBool U_EXPORT2 |
| 905 uloc_isRightToLeft(const char *locale); |
| 906 #endif /* U_HIDE_DRAFT_API */ |
| 907 |
889 /** | 908 /** |
890 * enums for the return value for the character and line orientation | 909 * enums for the return value for the character and line orientation |
891 * functions. | 910 * functions. |
892 * @stable ICU 4.0 | 911 * @stable ICU 4.0 |
893 */ | 912 */ |
894 typedef enum { | 913 typedef enum { |
895 ULOC_LAYOUT_LTR = 0, /* left-to-right. */ | 914 ULOC_LAYOUT_LTR = 0, /* left-to-right. */ |
896 ULOC_LAYOUT_RTL = 1, /* right-to-left. */ | 915 ULOC_LAYOUT_RTL = 1, /* right-to-left. */ |
897 ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */ | 916 ULOC_LAYOUT_TTB = 2, /* top-to-bottom. */ |
898 ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */ | 917 ULOC_LAYOUT_BTT = 3, /* bottom-to-top. */ |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 * @return The length of the BCP47 language tag. | 1144 * @return The length of the BCP47 language tag. |
1126 * @stable ICU 4.2 | 1145 * @stable ICU 4.2 |
1127 */ | 1146 */ |
1128 U_STABLE int32_t U_EXPORT2 | 1147 U_STABLE int32_t U_EXPORT2 |
1129 uloc_toLanguageTag(const char* localeID, | 1148 uloc_toLanguageTag(const char* localeID, |
1130 char* langtag, | 1149 char* langtag, |
1131 int32_t langtagCapacity, | 1150 int32_t langtagCapacity, |
1132 UBool strict, | 1151 UBool strict, |
1133 UErrorCode* err); | 1152 UErrorCode* err); |
1134 | 1153 |
| 1154 #ifndef U_HIDE_DRAFT_API |
| 1155 /** |
| 1156 * Converts the specified keyword (legacy key, or BCP 47 Unicode locale |
| 1157 * extension key) to the equivalent BCP 47 Unicode locale extension key. |
| 1158 * For example, BCP 47 Unicode locale extension key "co" is returned for |
| 1159 * the input keyword "collation". |
| 1160 * <p> |
| 1161 * When the specified keyword is unknown, but satisfies the BCP syntax, |
| 1162 * then the pointer to the input keyword itself will be returned. |
| 1163 * For example, |
| 1164 * <code>uloc_toUnicodeLocaleKey("ZZ")</code> returns "ZZ". |
| 1165 * |
| 1166 * @param keyword the input locale keyword (either legacy key |
| 1167 * such as "collation" or BCP 47 Unicode locale extension |
| 1168 * key such as "co"). |
| 1169 * @return the well-formed BCP 47 Unicode locale extension key, |
| 1170 * or NULL if the specified locale keyword cannot be |
| 1171 * mapped to a well-formed BCP 47 Unicode locale extension |
| 1172 * key. |
| 1173 * @see uloc_toLegacyKey |
| 1174 * @draft ICU 54 |
| 1175 */ |
| 1176 U_DRAFT const char* U_EXPORT2 |
| 1177 uloc_toUnicodeLocaleKey(const char* keyword); |
| 1178 |
| 1179 /** |
| 1180 * Converts the specified keyword value (legacy type, or BCP 47 |
| 1181 * Unicode locale extension type) to the well-formed BCP 47 Unicode locale |
| 1182 * extension type for the specified keyword (category). For example, BCP 47 |
| 1183 * Unicode locale extension type "phonebk" is returned for the input |
| 1184 * keyword value "phonebook", with the keyword "collation" (or "co"). |
| 1185 * <p> |
| 1186 * When the specified keyword is not recognized, but the specified value |
| 1187 * satisfies the syntax of the BCP 47 Unicode locale extension type, |
| 1188 * or when the specified keyword allows 'variable' type and the specified |
| 1189 * value satisfies the syntax, then the pointer to the input type value itself |
| 1190 * will be returned. |
| 1191 * For example, |
| 1192 * <code>uloc_toUnicodeLocaleType("Foo", "Bar")</code> returns "Bar", |
| 1193 * <code>uloc_toUnicodeLocaleType("variableTop", "00A4")</code> returns "00A4". |
| 1194 * |
| 1195 * @param keyword the locale keyword (either legacy key such as |
| 1196 * "collation" or BCP 47 Unicode locale extension |
| 1197 * key such as "co"). |
| 1198 * @param value the locale keyword value (either legacy type |
| 1199 * such as "phonebook" or BCP 47 Unicode locale extension |
| 1200 * type such as "phonebk"). |
| 1201 * @return the well-formed BCP47 Unicode locale extension type, |
| 1202 * or NULL if the locale keyword value cannot be mapped to |
| 1203 * a well-formed BCP 47 Unicode locale extension type. |
| 1204 * @see uloc_toLegacyType |
| 1205 * @draft ICU 54 |
| 1206 */ |
| 1207 U_DRAFT const char* U_EXPORT2 |
| 1208 uloc_toUnicodeLocaleType(const char* keyword, const char* value); |
| 1209 |
| 1210 /** |
| 1211 * Converts the specified keyword (BCP 47 Unicode locale extension key, or |
| 1212 * legacy key) to the legacy key. For example, legacy key "collation" is |
| 1213 * returned for the input BCP 47 Unicode locale extension key "co". |
| 1214 * |
| 1215 * @param keyword the input locale keyword (either BCP 47 Unicode locale |
| 1216 * extension key or legacy key). |
| 1217 * @return the well-formed legacy key, or NULL if the specified |
| 1218 * keyword cannot be mapped to a well-formed legacy key. |
| 1219 * @see toUnicodeLocaleKey |
| 1220 * @draft ICU 54 |
| 1221 */ |
| 1222 U_DRAFT const char* U_EXPORT2 |
| 1223 uloc_toLegacyKey(const char* keyword); |
| 1224 |
| 1225 /** |
| 1226 * Converts the specified keyword value (BCP 47 Unicode locale extension type, |
| 1227 * or legacy type or type alias) to the canonical legacy type. For example, |
| 1228 * the legacy type "phonebook" is returned for the input BCP 47 Unicode |
| 1229 * locale extension type "phonebk" with the keyword "collation" (or "co"). |
| 1230 * <p> |
| 1231 * When the specified keyword is not recognized, but the specified value |
| 1232 * satisfies the syntax of legacy key, or when the specified keyword |
| 1233 * allows 'variable' type and the specified value satisfies the syntax, |
| 1234 * then the pointer to the input type value itself will be returned. |
| 1235 * For example, |
| 1236 * <code>uloc_toLegacyType("Foo", "Bar")</code> returns "Bar", |
| 1237 * <code>uloc_toLegacyType("vt", "00A4")</code> returns "00A4". |
| 1238 * |
| 1239 * @param keyword the locale keyword (either legacy keyword such as |
| 1240 * "collation" or BCP 47 Unicode locale extension |
| 1241 * key such as "co"). |
| 1242 * @param value the locale keyword value (either BCP 47 Unicode locale |
| 1243 * extension type such as "phonebk" or legacy keyword value |
| 1244 * such as "phonebook"). |
| 1245 * @return the well-formed legacy type, or NULL if the specified |
| 1246 * keyword value cannot be mapped to a well-formed legacy |
| 1247 * type. |
| 1248 * @see toUnicodeLocaleType |
| 1249 * @draft ICU 54 |
| 1250 */ |
| 1251 U_DRAFT const char* U_EXPORT2 |
| 1252 uloc_toLegacyType(const char* keyword, const char* value); |
| 1253 |
| 1254 #endif /* U_HIDE_DRAFT_API */ |
| 1255 |
1135 #endif /*_ULOC*/ | 1256 #endif /*_ULOC*/ |
OLD | NEW |