OLD | NEW |
1 /* | 1 /* |
2 ********************************************************************** | 2 ********************************************************************** |
3 * Copyright (C) 1996-2013, International Business Machines | 3 * Copyright (C) 1996-2013, International Business Machines |
4 * Corporation and others. All Rights Reserved. | 4 * Corporation and others. All Rights Reserved. |
5 ********************************************************************** | 5 ********************************************************************** |
6 * | 6 * |
7 * Provides functionality for mapping between | 7 * Provides functionality for mapping between |
8 * LCID and Posix IDs or ICU locale to codepage | 8 * LCID and Posix IDs or ICU locale to codepage |
9 * | 9 * |
10 * Note: All classes and code in this file are | 10 * Note: All classes and code in this file are |
(...skipping 11 matching lines...) Expand all Loading... |
22 * MAX_ID_LENGTH. | 22 * MAX_ID_LENGTH. |
23 * 04/23/99 stephen Added C wrapper for convertToPosix. | 23 * 04/23/99 stephen Added C wrapper for convertToPosix. |
24 * 09/18/00 george Removed the memory leaks. | 24 * 09/18/00 george Removed the memory leaks. |
25 * 08/23/01 george Convert to C | 25 * 08/23/01 george Convert to C |
26 */ | 26 */ |
27 | 27 |
28 #include "locmap.h" | 28 #include "locmap.h" |
29 #include "cstring.h" | 29 #include "cstring.h" |
30 #include "cmemory.h" | 30 #include "cmemory.h" |
31 | 31 |
32 /** | |
33 * Chromium has its own implementation to determine the default locale that uses | |
34 * Windows locale API where available and falls back to the old API at run-time. | |
35 */ | |
36 #if 0 | |
37 #if U_PLATFORM == U_PF_WINDOWS && defined(_MSC_VER) && (_MSC_VER >= 1500) | 32 #if U_PLATFORM == U_PF_WINDOWS && defined(_MSC_VER) && (_MSC_VER >= 1500) |
38 /* | 33 /* |
39 * TODO: It seems like we should widen this to | 34 * TODO: It seems like we should widen this to |
40 * either U_PLATFORM_USES_ONLY_WIN32_API (includes MinGW) | 35 * either U_PLATFORM_USES_ONLY_WIN32_API (includes MinGW) |
41 * or U_PLATFORM_HAS_WIN32_API (includes MinGW and Cygwin) | 36 * or U_PLATFORM_HAS_WIN32_API (includes MinGW and Cygwin) |
42 * but those use gcc and won't have defined(_MSC_VER). | 37 * but those use gcc and won't have defined(_MSC_VER). |
43 * We might need to #include some Windows header and test for some version macro
from there. | 38 * We might need to #include some Windows header and test for some version macro
from there. |
44 * Or call some Windows function and see what it returns. | 39 * Or call some Windows function and see what it returns. |
45 */ | 40 */ |
46 #define USE_WINDOWS_LOCALE_API | 41 #define USE_WINDOWS_LOCALE_API |
47 #endif | 42 #endif |
48 #endif | |
49 | 43 |
50 #ifdef USE_WINDOWS_LOCALE_API | 44 #ifdef USE_WINDOWS_LOCALE_API |
51 #include <windows.h> | 45 #include <windows.h> |
52 #include <winnls.h> | 46 #include <winnls.h> |
53 #endif | 47 #endif |
54 | 48 |
55 /* | 49 /* |
56 * Note: | 50 * Note: |
57 * The mapping from Win32 locale ID numbers to POSIX locale strings should | 51 * The mapping from Win32 locale ID numbers to POSIX locale strings should |
58 * be the faster one. | 52 * be the faster one. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 {0x080a, "es_MX"}, | 287 {0x080a, "es_MX"}, |
294 {0x4c0a, "es_NI"}, | 288 {0x4c0a, "es_NI"}, |
295 {0x180a, "es_PA"}, | 289 {0x180a, "es_PA"}, |
296 {0x280a, "es_PE"}, | 290 {0x280a, "es_PE"}, |
297 {0x500a, "es_PR"}, | 291 {0x500a, "es_PR"}, |
298 {0x3c0a, "es_PY"}, | 292 {0x3c0a, "es_PY"}, |
299 {0x440a, "es_SV"}, | 293 {0x440a, "es_SV"}, |
300 {0x540a, "es_US"}, | 294 {0x540a, "es_US"}, |
301 {0x380a, "es_UY"}, | 295 {0x380a, "es_UY"}, |
302 {0x200a, "es_VE"}, | 296 {0x200a, "es_VE"}, |
303 {0xe40a, "es_419"}, | 297 {0x580a, "es_419"}, |
304 {0x040a, "es_ES@collation=traditional"}, | 298 {0x040a, "es_ES@collation=traditional"}, |
305 {0x040a, "es@collation=traditional"} | 299 {0x040a, "es@collation=traditional"} |
306 }; | 300 }; |
307 | 301 |
308 ILCID_POSIX_ELEMENT_ARRAY(0x0425, et, et_EE) | 302 ILCID_POSIX_ELEMENT_ARRAY(0x0425, et, et_EE) |
309 ILCID_POSIX_ELEMENT_ARRAY(0x042d, eu, eu_ES) | 303 ILCID_POSIX_ELEMENT_ARRAY(0x042d, eu, eu_ES) |
310 | 304 |
311 /* ISO-639 doesn't distinguish between Persian and Dari.*/ | 305 /* ISO-639 doesn't distinguish between Persian and Dari.*/ |
312 ILCID_POSIX_SUBTABLE(fa) { | 306 ILCID_POSIX_SUBTABLE(fa) { |
313 {0x29, "fa"}, | 307 {0x29, "fa"}, |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 ILCID_POSIX_ELEMENT_ARRAY(0x0481, mi, mi_NZ) | 455 ILCID_POSIX_ELEMENT_ARRAY(0x0481, mi, mi_NZ) |
462 ILCID_POSIX_ELEMENT_ARRAY(0x042f, mk, mk_MK) | 456 ILCID_POSIX_ELEMENT_ARRAY(0x042f, mk, mk_MK) |
463 ILCID_POSIX_ELEMENT_ARRAY(0x044c, ml, ml_IN) | 457 ILCID_POSIX_ELEMENT_ARRAY(0x044c, ml, ml_IN) |
464 | 458 |
465 ILCID_POSIX_SUBTABLE(mn) { | 459 ILCID_POSIX_SUBTABLE(mn) { |
466 {0x50, "mn"}, | 460 {0x50, "mn"}, |
467 {0x0450, "mn_MN"}, | 461 {0x0450, "mn_MN"}, |
468 {0x7c50, "mn_Mong"}, | 462 {0x7c50, "mn_Mong"}, |
469 {0x0850, "mn_Mong_CN"}, | 463 {0x0850, "mn_Mong_CN"}, |
470 {0x0850, "mn_CN"}, | 464 {0x0850, "mn_CN"}, |
471 {0x7850, "mn_Cyrl"} | 465 {0x7850, "mn_Cyrl"}, |
| 466 {0x0c50, "mn_Mong_MN"} |
472 }; | 467 }; |
473 | 468 |
474 ILCID_POSIX_ELEMENT_ARRAY(0x0458, mni,mni_IN) | 469 ILCID_POSIX_ELEMENT_ARRAY(0x0458, mni,mni_IN) |
475 ILCID_POSIX_ELEMENT_ARRAY(0x047c, moh,moh_CA) | 470 ILCID_POSIX_ELEMENT_ARRAY(0x047c, moh,moh_CA) |
476 ILCID_POSIX_ELEMENT_ARRAY(0x044e, mr, mr_IN) | 471 ILCID_POSIX_ELEMENT_ARRAY(0x044e, mr, mr_IN) |
477 | 472 |
478 ILCID_POSIX_SUBTABLE(ms) { | 473 ILCID_POSIX_SUBTABLE(ms) { |
479 {0x3e, "ms"}, | 474 {0x3e, "ms"}, |
480 {0x083e, "ms_BN"}, /* Brunei Darussalam*/ | 475 {0x083e, "ms_BN"}, /* Brunei Darussalam*/ |
481 {0x043e, "ms_MY"} /* Malaysia*/ | 476 {0x043e, "ms_MY"} /* Malaysia*/ |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 if (fallbackValue != (uint32_t)-1) { | 1129 if (fallbackValue != (uint32_t)-1) { |
1135 *status = U_USING_FALLBACK_WARNING; | 1130 *status = U_USING_FALLBACK_WARNING; |
1136 return fallbackValue; | 1131 return fallbackValue; |
1137 } | 1132 } |
1138 | 1133 |
1139 /* no match found */ | 1134 /* no match found */ |
1140 *status = U_ILLEGAL_ARGUMENT_ERROR; | 1135 *status = U_ILLEGAL_ARGUMENT_ERROR; |
1141 return 0; /* return international (root) */ | 1136 return 0; /* return international (root) */ |
1142 } | 1137 } |
1143 | 1138 |
OLD | NEW |