e30457311924021a12a4c73f5885cdcbb2797dca
[mono.git] / mcs / class / corlib / System.Globalization / CultureInfo.cs
1 //
2 // System.Globalization.CultureInfo
3 //
4 // Miguel de Icaza (miguel@ximian.com)
5 // Dick Porter (dick@ximian.com)
6 //
7 // (C) 2001, 2002, 2003 Ximian, Inc. (http://www.ximian.com)
8 //
9
10 using System.Collections;
11 using System.Threading;
12 using System.Runtime.CompilerServices;
13
14 namespace System.Globalization
15 {
16         [Serializable]
17         public class CultureInfo : ICloneable, IFormatProvider
18         {
19                 static CultureInfo invariant_culture_info;
20                 bool is_read_only;
21                 int  lcid;
22                 bool use_user_override;
23                 NumberFormatInfo number_format;
24                 DateTimeFormatInfo datetime_format;
25                 TextInfo textinfo;
26
27                 private string name;
28                 private string displayname;
29                 private string englishname;
30                 private string nativename;
31                 private string iso3lang;
32                 private string iso2lang;
33                 private string icu_name;
34                 private string win3lang;
35                 private CompareInfo compareinfo;
36                 
37                 private static readonly string MSG_READONLY = "This instance is read only";
38                 
39                 internal sealed class CultureMap : IEnumerable
40                 {
41                         private static Hashtable CultureID;
42                         private static Hashtable CultureNames;
43
44                         /* This is used so that foreach can enumerate
45                          * the ID map hash without having to
46                          * instantiate an instance itself
47                          */
48                         public static CultureMap lcids;
49                         
50                         private string name;
51                         private string icu_name;
52                         private string win3lang;
53                         private int lcid;
54                         private int specific_lcid;
55                         private int parent_lcid;
56
57                         static CultureMap ()
58                         {
59                                 CultureID=new Hashtable (CaseInsensitiveHashCodeProvider.Default, new CaseInsensitiveComparer (CultureInfo.InvariantCulture));
60                                 CultureNames=new Hashtable (CaseInsensitiveHashCodeProvider.Default, new CaseInsensitiveComparer (CultureInfo.InvariantCulture));
61
62                                 CultureMap map;
63                                 
64                                 /* Invariant */
65                                 map=new CultureMap ("", "en_US_POSIX", "IVL", 0x007f, 0x007f, 0x007f);
66                                 CultureID.Add (0x007f, map);
67                                 CultureNames.Add ("", map);
68
69                                 map=new CultureMap ("af", "af", "AFK", 0x0036, 0x0436, 0x007f);
70                                 CultureID.Add (0x0036, map);
71                                 CultureNames.Add ("af", map);
72
73                                 map=new CultureMap ("af-ZA", "af_ZA", "AFK", 0x0436, 0x0436, 0x0036);
74                                 CultureID.Add (0x0436, map);
75                                 CultureNames.Add ("af-ZA", map);
76
77                                 map=new CultureMap("sq", "sq", "SQI", 0x001c, 0x041c, 0x007f);
78                                 CultureID.Add (0x001c, map);
79                                 CultureNames.Add ("sq", map);
80                                 
81                                 map=new CultureMap("sq-AL", "sq_AL", "SQI", 0x041c, 0x041c, 0x001c);
82                                 CultureID.Add (0x041c, map);
83                                 CultureNames.Add ("sq-AL", map);
84                                 
85                                 map=new CultureMap("ar", "ar", "ARA", 0x0001, 0x0401, 0x007f);
86                                 CultureID.Add (0x0001, map);
87                                 CultureNames.Add ("ar", map);
88
89                                 map=new CultureMap("ar-DZ", "ar_DZ", "ARG", 0x1401, 0x1401, 0x0001);
90                                 CultureID.Add (0x1401, map);
91                                 CultureNames.Add ("ar-DZ", map);
92
93                                 map=new CultureMap("ar-BH", "ar_BH", "ARH", 0x3c01, 0x3c01, 0x0001);
94                                 CultureID.Add (0x3c01, map);
95                                 CultureNames.Add ("ar-BH", map);
96
97                                 map=new CultureMap("ar-EG", "ar_EG", "ARE", 0x0c01, 0x0c01, 0x0001);
98                                 CultureID.Add (0x0c01, map);
99                                 CultureNames.Add ("ar-EG", map);
100
101                                 map=new CultureMap("ar-IQ", "ar_IQ", "ARI", 0x0801, 0x0801, 0x0001);
102                                 CultureID.Add (0x0801, map);
103                                 CultureNames.Add ("ar-IQ", map);
104
105                                 map=new CultureMap("ar-JO", "ar_JO", "ARJ", 0x2c01, 0x2c01, 0x0001);
106                                 CultureID.Add (0x2c01, map);
107                                 CultureNames.Add ("ar-JO", map);
108
109                                 map=new CultureMap("ar-KW", "ar_KW", "ARK", 0x3401, 0x3401, 0x0001);
110                                 CultureID.Add (0x3401, map);
111                                 CultureNames.Add ("ar-KW", map);
112
113                                 map=new CultureMap("ar-LB", "ar_LB", "ARB", 0x3001, 0x3001, 0x0001);
114                                 CultureID.Add (0x3001, map);
115                                 CultureNames.Add ("ar-LB", map);
116
117                                 map=new CultureMap("ar-LY", "ar_LY", "ARL", 0x1001, 0x1001, 0x0001);
118                                 CultureID.Add (0x1001, map);
119                                 CultureNames.Add ("ar-LY", map);
120
121                                 map=new CultureMap("ar-MA", "ar_MA", "ARM", 0x1801, 0x1801, 0x0001);
122                                 CultureID.Add (0x1801, map);
123                                 CultureNames.Add ("ar-MA", map);
124
125                                 map=new CultureMap("ar-OM", "ar_OM", "ARO", 0x2001, 0x2001, 0x0001);
126                                 CultureID.Add (0x2001, map);
127                                 CultureNames.Add ("ar-OM", map);
128
129                                 map=new CultureMap("ar-QA", "ar_QA", "ARQ", 0x4001, 0x4001, 0x0001);
130                                 CultureID.Add (0x4001, map);
131                                 CultureNames.Add ("ar-QA", map);
132
133                                 map=new CultureMap("ar-SA", "ar_SA", "ARA", 0x0401, 0x0401, 0x0001);
134                                 CultureID.Add (0x0401, map);
135                                 CultureNames.Add ("ar-SA", map);
136
137                                 map=new CultureMap("ar-SY", "ar_SY", "ARS", 0x2801, 0x2801, 0x0001);
138                                 CultureID.Add (0x2801, map);
139                                 CultureNames.Add ("ar-SY", map);
140
141                                 map=new CultureMap("ar-TN", "ar_TN", "ART", 0x1c01, 0x1c01, 0x0001);
142                                 CultureID.Add (0x1c01, map);
143                                 CultureNames.Add ("ar-TN", map);
144
145                                 map=new CultureMap("ar-AE", "ar_AE", "ARU", 0x3801, 0x3801, 0x0001);
146                                 CultureID.Add (0x3801, map);
147                                 CultureNames.Add ("ar-AE", map);
148
149                                 map=new CultureMap("ar-YE", "ar_YE", "ARY", 0x2401, 0x2401, 0x0001);
150                                 CultureID.Add (0x2401, map);
151                                 CultureNames.Add ("ar-YE", map);
152
153                                 map=new CultureMap("hy", "hy", "HYE", 0x002b, 0x042b, 0x007f);
154                                 CultureID.Add (0x002b, map);
155                                 CultureNames.Add ("hy", map);
156
157                                 /* theres a _REVISED version of this one too */
158                                 map=new CultureMap("hy-AM", "hy_AM", "HYE", 0x042b, 0x042b, 0x002b);
159                                 CultureID.Add (0x042b, map);
160                                 CultureNames.Add ("hy-AM", map);
161
162                                 /* Azeri not supported
163                                    map=new CultureMap("az", "", "AZE", 0x002c, 0x042c, 0x007f);
164                                    CultureID.Add (0x002c, map);
165                                    CultureNames.Add ("az", map);
166
167                                    map=new CultureMap("Cy-az-AZ", "", "AZE", 0x082c, 0x082c, 0x002c);
168                                    CultureID.Add (0x082c, map);
169                                    CultureNames.Add ("Cy-az-AZ", map);
170
171                                    map=new CultureMap("Lt-az-AZ", "", "AZE", 0x042c, 0x042c);
172                                    CultureID.Add (0x042c, map);
173                                    CultureNames.Add ("Lt-az-AZ", map);*/
174
175                                 map=new CultureMap("eu", "eu", "EUQ", 0x002d, 0x042d, 0x007f);
176                                 CultureID.Add (0x002d, map);
177                                 CultureNames.Add ("eu", map);
178
179                                 map=new CultureMap("eu-ES", "eu_ES", "EUQ", 0x042d, 0x042d, 0x002d);
180                                 CultureID.Add (0x042d, map);
181                                 CultureNames.Add ("eu-ES", map);
182
183                                 map=new CultureMap("be", "be", "BEL", 0x0023, 0x0423, 0x007f);
184                                 CultureID.Add (0x0023, map);
185                                 CultureNames.Add ("be", map);
186
187                                 map=new CultureMap("be-BY", "be_BY", "BEL", 0x0423, 0x0423, 0x0023);
188                                 CultureID.Add (0x0423, map);
189                                 CultureNames.Add ("be-BY", map);
190
191                                 map=new CultureMap("bg", "bg", "BGR", 0x0002, 0x0402, 0x007f);
192                                 CultureID.Add (0x0002, map);
193                                 CultureNames.Add ("bg", map);
194
195                                 map=new CultureMap("bg-BG", "bg_BG", "BGR", 0x0402, 0x0402, 0x0002);
196                                 CultureID.Add (0x0402, map);
197                                 CultureNames.Add ("bg-BG", map);
198
199                                 map=new CultureMap("ca", "ca", "CAT", 0x0003, 0x0403, 0x007f);
200                                 CultureID.Add (0x0003, map);
201                                 CultureNames.Add ("ca", map);
202
203                                 map=new CultureMap("ca-ES", "ca_ES", "CAT", 0x0403, 0x0403, 0x0003);
204                                 CultureID.Add (0x0403, map);
205                                 CultureNames.Add ("ca-ES", map);
206
207                                 map=new CultureMap("zh-HK", "zh_HK", "ZHH", 0x0c04, 0x0c04, 0x7c04);
208                                 CultureID.Add (0x0c04, map);
209                                 CultureNames.Add ("zh-HK", map);
210
211                                 map=new CultureMap("zh-MO", "zh_MO", "ZHM", 0x1404, 0x1404, 0x0004);
212                                 CultureID.Add (0x1404, map);
213                                 CultureNames.Add ("zh-MO", map);
214
215                                 map=new CultureMap("zh-CN", "zh_CN", "CHS", 0x0804, 0x0804, 0x0004);
216                                 CultureID.Add (0x0804, map);
217                                 CultureNames.Add ("zh-CN", map);
218
219                                 /* zh-CHS (Chinese simplified). 'zh' is LCID 0x0004 in ICU */
220                                 map=new CultureMap("zh-CHS", "zh", "CHS", 0x0004, 0x0000, 0x007f);
221                                 CultureID.Add (0x0004, map);
222                                 CultureNames.Add ("zh-CHS", map);
223
224                                 map=new CultureMap("zh-SG", "zh_SG", "ZHI", 0x1004, 0x1004, 0x0004);
225                                 CultureID.Add (0x1004, map);
226                                 CultureNames.Add ("zh-SG", map);
227                                 
228                                 map=new CultureMap("zh-TW", "zh_TW", "CHT", 0x0404, 0x0404, 0x7c04);
229                                 CultureID.Add (0x0404, map);
230                                 CultureNames.Add ("zh-TW", map);
231
232                                 /* zh-CHT (Chinese traditional).  Maybe set this to zh_TW? (politics, politics...) */
233                                 map=new CultureMap("zh-CHT", "zh_TW", "CHT", 0x7c04, 0x0000, 0x007f);
234                                 CultureID.Add (0x7c04, map);
235                                 CultureNames.Add ("zh-CHT", map);
236
237                                 map=new CultureMap("hr", "hr", "HRV", 0x001a, 0x041a, 0x007f);
238                                 CultureID.Add (0x001a, map);
239                                 CultureNames.Add ("hr", map);
240
241                                 map=new CultureMap("hr-HR", "hr_HR", "HRV", 0x041a, 0x041a, 0x001a);
242                                 CultureID.Add (0x041a, map);
243                                 CultureNames.Add ("hr-HR", map);
244
245                                 map=new CultureMap("cs", "cs", "CSY", 0x0005, 0x0405, 0x007f);
246                                 CultureID.Add (0x0005, map);
247                                 CultureNames.Add ("cs", map);
248
249                                 map=new CultureMap("cs-CZ", "cs_CZ", "CSY", 0x0405, 0x0405, 0x0005);
250                                 CultureID.Add (0x0405, map);
251                                 CultureNames.Add ("cs-CZ", map);
252
253                                 map=new CultureMap("da", "da", "DAN", 0x0006, 0x0406, 0x007f);
254                                 CultureID.Add (0x0006, map);
255                                 CultureNames.Add ("da", map);
256
257                                 map=new CultureMap("da-DK", "da_DK", "DAN", 0x0406, 0x0406, 0x0006);
258                                 CultureID.Add (0x0406, map);
259                                 CultureNames.Add ("da-DK", map);
260
261                                 /* Dhivehi not supported
262                                    map=new CultureMap("div", "", "DIV", 0x0065, 0x0465, 0x007f);
263                                    CultureID.Add (0x0065, map);
264                                    CultureNames.Add ("div", map);
265
266                                    map=new CultureMap("div-MV", "", "DIV", 0x0465, 0x0465, 0x0065);
267                                    CultureID.Add (0x0465, map);
268                                    CultureNames.Add ("div-MV", map);*/
269
270                                 map=new CultureMap("nl", "nl", "NLD", 0x0013, 0x0413, 0x007f);
271                                 CultureID.Add (0x0013, map);
272                                 CultureNames.Add ("nl", map);
273
274                                 map=new CultureMap("nl-BE", "nl_BE", "NLB", 0x0813, 0x0813, 0x0013);
275                                 CultureID.Add (0x0813, map);
276                                 CultureNames.Add ("nl-BE", map);
277
278                                 map=new CultureMap("nl-NL", "nl_NL", "NLD", 0x0413, 0x0413, 0x0013);
279                                 CultureID.Add (0x0413, map);
280                                 CultureNames.Add ("nl-NL", map);
281
282                                 map=new CultureMap("en", "en", "ENU", 0x0009, 0x0409, 0x007f);
283                                 CultureID.Add (0x0009, map);
284                                 CultureNames.Add ("en", map);
285
286                                 map=new CultureMap("en-AU", "en_AU", "ENA", 0x0c09, 0x0c09, 0x0009);
287                                 CultureID.Add (0x0c09, map);
288                                 CultureNames.Add ("en-AU", map);
289
290                                 /* Falls back to 'en' currently */
291                                 map=new CultureMap("en-BZ", "en_BZ", "ENL", 0x2809, 0x2809, 0x0009);
292                                 CultureID.Add (0x2809, map);
293                                 CultureNames.Add ("en-BZ", map);
294
295                                 map=new CultureMap("en-CA", "en_CA", "ENC", 0x1009, 0x1009, 0x0009);
296                                 CultureID.Add (0x1009, map);
297                                 CultureNames.Add ("en-CA", map);
298
299                                 /* ms calls this en-CB but ICU has this ID as Virgin Islands */
300                                 map=new CultureMap("en-CB", "en_VI", "ENB", 0x2409, 0x2409, 0x0009);
301                                 CultureID.Add (0x2409, map);
302                                 CultureNames.Add ("en-CB", map);
303
304                                 map=new CultureMap("en-IE", "en_IE", "ENI", 0x1809, 0x1809, 0x0009);
305                                 CultureID.Add (0x1809, map);
306                                 CultureNames.Add ("en-IE", map);
307
308                                 /* Falls back to 'en' currently */
309                                 map=new CultureMap("en-JM", "en_JM", "ENJ", 0x2009, 0x2009, 0x0009);
310                                 CultureID.Add (0x2009, map);
311                                 CultureNames.Add ("en-JM", map);
312
313                                 map=new CultureMap("en-NZ", "en_NZ", "ENZ", 0x1409, 0x1409, 0x0009);
314                                 CultureID.Add (0x1409, map);
315                                 CultureNames.Add ("en-NZ", map);
316
317                                 map=new CultureMap("en-PH", "en_PH", "ENP", 0x3409, 0x3409, 0x0009);
318                                 CultureID.Add (0x3409, map);
319                                 CultureNames.Add ("en-PH", map);
320
321                                 map=new CultureMap("en-ZA", "en_ZA", "ENS", 0x1c09, 0x1c09, 0x0009);
322                                 CultureID.Add (0x1c09, map);
323                                 CultureNames.Add ("en-ZA", map);
324
325                                 /* Falls back to 'en' currently */
326                                 map=new CultureMap("en-TT", "en_TT", "ENT", 0x2c09, 0x2c09, 0x0009);
327                                 CultureID.Add (0x2c09, map);
328                                 CultureNames.Add ("en-TT", map);
329
330                                 map=new CultureMap("en-GB", "en_GB", "ENG", 0x0809, 0x0809, 0x0009);
331                                 CultureID.Add (0x0809, map);
332                                 CultureNames.Add ("en-GB", map);
333
334                                 map=new CultureMap("en-US", "en_US", "ENU", 0x0409, 0x0409, 0x0009);
335                                 CultureID.Add (0x0409, map);
336                                 CultureNames.Add ("en-US", map);
337
338                                 map=new CultureMap("en-ZW", "en_ZW", "ENW", 0x3009, 0x3009, 0x0009);
339                                 CultureID.Add (0x3009, map);
340                                 CultureNames.Add ("en-ZW", map);
341
342                                 map=new CultureMap("et", "et", "ETI", 0x0025, 0x0425, 0x007f);
343                                 CultureID.Add (0x0025, map);
344                                 CultureNames.Add ("et", map);
345
346                                 map=new CultureMap("et-EE", "et_EE", "ETI", 0x0425, 0x0425, 0x0025);
347                                 CultureID.Add (0x0425, map);
348                                 CultureNames.Add ("et-EE", map);
349
350                                 map=new CultureMap("fo", "fo", "FOS", 0x0038, 0x0438, 0x007f);
351                                 CultureID.Add (0x0038, map);
352                                 CultureNames.Add ("fo", map);
353
354                                 map=new CultureMap("fo-FO", "fo_FO", "FOS", 0x0438, 0x0438, 0x0038);
355                                 CultureID.Add (0x0438, map);
356                                 CultureNames.Add ("fo-FO", map);
357
358                                 map=new CultureMap("fa", "fa", "FAR", 0x0029, 0x0429, 0x007f);
359                                 CultureID.Add (0x0029, map);
360                                 CultureNames.Add ("fa", map);
361
362                                 map=new CultureMap("fa-IR", "fa_IR", "FAR", 0x0429, 0x0429, 0x0029);
363                                 CultureID.Add (0x0429, map);
364                                 CultureNames.Add ("fa-IR", map);
365
366                                 map=new CultureMap("fi", "fi", "FIN", 0x000b, 0x040b, 0x007f);
367                                 CultureID.Add (0x000b, map);
368                                 CultureNames.Add ("fi", map);
369
370                                 map=new CultureMap("fi-FI", "fi_FI", "FIN", 0x040b, 0x040b, 0x000b);
371                                 CultureID.Add (0x040b, map);
372                                 CultureNames.Add ("fi-FI", map);
373
374                                 map=new CultureMap("fr", "fr", "FRA", 0x000c, 0x040c, 0x007f);
375                                 CultureID.Add (0x000c, map);
376                                 CultureNames.Add ("fr", map);
377
378                                 map=new CultureMap("fr-BE", "fr_BE", "FRB", 0x080c, 0x080c, 0x000c);
379                                 CultureID.Add (0x080c, map);
380                                 CultureNames.Add ("fr-BE", map);
381
382                                 map=new CultureMap("fr-CA", "fr_CA", "FRC", 0x0c0c, 0x0c0c, 0x000c);
383                                 CultureID.Add (0x0c0c, map);
384                                 CultureNames.Add ("fr-CA", map);
385
386                                 map=new CultureMap("fr-FR", "fr_FR", "FRA", 0x040c, 0x040c, 0x000c);
387                                 CultureID.Add (0x040c, map);
388                                 CultureNames.Add ("fr-FR", map);
389
390                                 map=new CultureMap("fr-LU", "fr_LU", "FRL", 0x140c, 0x140c, 0x000c);
391                                 CultureID.Add (0x140c, map);
392                                 CultureNames.Add ("fr-LU", map);
393
394                                 /* Falls back to 'fr' currently */
395                                 map=new CultureMap("fr-MC", "fr_MC", "FRM", 0x180c, 0x180c, 0x000c);
396                                 CultureID.Add (0x180c, map);
397                                 CultureNames.Add ("fr-MC", map);
398
399                                 map=new CultureMap("fr-CH", "fr_CH", "FRS", 0x100c, 0x100c, 0x000c);
400                                 CultureID.Add (0x100c, map);
401                                 CultureNames.Add ("fr-CH", map);
402
403                                 map=new CultureMap("gl", "gl", "GLC", 0x0056, 0x0456, 0x007f);
404                                 CultureID.Add (0x0056, map);
405                                 CultureNames.Add ("gl", map);
406
407                                 map=new CultureMap("gl-ES", "gl_ES", "GLC", 0x0456, 0x0456, 0x0056);
408                                 CultureID.Add (0x0456, map);
409                                 CultureNames.Add ("gl-ES", map);
410
411                                 /* Georgian not supported
412                                    map=new CultureMap("ka", "", "KAT", 0x0037, 0x0437, 0x007f);
413                                    CultureID.Add (0x0037, map);
414                                    CultureNames.Add ("ka", map);
415
416                                    map=new CultureMap("ka-GE", "", "KAT", 0x0437, 0x0437, 0x0037);
417                                    CultureID.Add (0x0437, map);
418                                    CultureNames.Add ("ka-GE", map);*/
419
420                                 map=new CultureMap("de", "de", "DEU", 0x0007, 0x0407, 0x007f);
421                                 CultureID.Add (0x0007, map);
422                                 CultureNames.Add ("de", map);
423
424                                 map=new CultureMap("de-AT", "de_AT", "DEA", 0x0c07, 0x0c07, 0x0007);
425                                 CultureID.Add (0x0c07, map);
426                                 CultureNames.Add ("de-AT", map);
427
428                                 map=new CultureMap("de-DE", "de_DE", "DEU", 0x0407, 0x0407, 0x0007);
429                                 CultureID.Add (0x0407, map);
430                                 CultureNames.Add ("de-DE", map);
431
432                                 /* Falls back to 'de' currently */
433                                 map=new CultureMap("de-LI", "de_LI", "DEC", 0x1407, 0x1407, 0x0007);
434                                 CultureID.Add (0x1407, map);
435                                 CultureNames.Add ("de-LI", map);
436
437                                 map=new CultureMap("de-LU", "de_LU", "DEL", 0x1007, 0x1007, 0x0007);
438                                 CultureID.Add (0x1007, map);
439                                 CultureNames.Add ("de-LU", map);
440
441                                 map=new CultureMap("de-CH", "de_CH", "DES", 0x0807, 0x0807, 0x0007);
442                                 CultureID.Add (0x0807, map);
443                                 CultureNames.Add ("de-CH", map);
444
445                                 map=new CultureMap("el", "el", "ELL", 0x0008, 0x0408, 0x007f);
446                                 CultureID.Add (0x0008, map);
447                                 CultureNames.Add ("el", map);
448
449                                 map=new CultureMap("el-GR", "el_GR", "ELL", 0x0408, 0x0408, 0x0008);
450                                 CultureID.Add (0x0408, map);
451                                 CultureNames.Add ("el-GR", map);
452
453                                 map=new CultureMap("gu", "gu", "GUJ", 0x0047, 0x0447, 0x007f);
454                                 CultureID.Add (0x0047, map);
455                                 CultureNames.Add ("gu", map);
456
457                                 map=new CultureMap("gu-IN", "gu_IN", "GUJ", 0x0447, 0x0447, 0x0047);
458                                 CultureID.Add (0x0447, map);
459                                 CultureNames.Add ("gu-IN", map);
460
461                                 map=new CultureMap("he", "he", "HEB", 0x000d, 0x040d, 0x007f);
462                                 CultureID.Add (0x000d, map);
463                                 CultureNames.Add ("he", map);
464
465                                 map=new CultureMap("he-IL", "he_IL", "HEB", 0x040d, 0x040d, 0x000d);
466                                 CultureID.Add (0x040d, map);
467                                 CultureNames.Add ("he-IL", map);
468
469                                 map=new CultureMap("hi", "hi", "HIN", 0x0039, 0x0439, 0x007f);
470                                 CultureID.Add (0x0039, map);
471                                 CultureNames.Add ("hi", map);
472
473                                 map=new CultureMap("hi-IN", "hi_IN", "HIN", 0x0439, 0x0439, 0x0039);
474                                 CultureID.Add (0x0439, map);
475                                 CultureNames.Add ("hi-IN", map);
476
477                                 map=new CultureMap("hu", "hu", "HUN", 0x000e, 0x040e, 0x007f);
478                                 CultureID.Add (0x000e, map);
479                                 CultureNames.Add ("hu", map);
480
481                                 map=new CultureMap("hu-HU", "hu_HU", "HUN", 0x040e, 0x040e, 0x000e);
482                                 CultureID.Add (0x040e, map);
483                                 CultureNames.Add ("hu-HU", map);
484
485                                 map=new CultureMap("is", "is", "ISL", 0x000f, 0x040f, 0x007f);
486                                 CultureID.Add (0x000f, map);
487                                 CultureNames.Add ("is", map);
488
489                                 map=new CultureMap("is-IS", "is_IS", "ISL", 0x040f, 0x040f, 0x000f);
490                                 CultureID.Add (0x040f, map);
491                                 CultureNames.Add ("is-IS", map);
492
493                                 map=new CultureMap("id", "id", "IND", 0x0021, 0x0421, 0x007f);
494                                 CultureID.Add (0x0021, map);
495                                 CultureNames.Add ("id", map);
496
497                                 map=new CultureMap("id-ID", "id_ID", "IND", 0x0421, 0x0421, 0x0021);
498                                 CultureID.Add (0x0421, map);
499                                 CultureNames.Add ("id-ID", map);
500
501                                 map=new CultureMap("it", "it", "ITA", 0x0010, 0x0410, 0x007f);
502                                 CultureID.Add (0x0010, map);
503                                 CultureNames.Add ("it", map);
504
505                                 map=new CultureMap("it-IT", "it_IT", "ITA", 0x0410, 0x0410, 0x0010);
506                                 CultureID.Add (0x0410, map);
507                                 CultureNames.Add ("it-IT", map);
508
509                                 map=new CultureMap("it-CH", "it_CH", "ITS", 0x0810, 0x0810, 0x0010);
510                                 CultureID.Add (0x0810, map);
511                                 CultureNames.Add ("it-CH", map);
512
513                                 map=new CultureMap("ja", "ja", "JPN", 0x0011, 0x0411, 0x007f);
514                                 CultureID.Add (0x0011, map);
515                                 CultureNames.Add ("ja", map);
516
517                                 map=new CultureMap("ja-JP", "ja_JP", "JPN", 0x0411, 0x0411, 0x0011);
518                                 CultureID.Add (0x0411, map);
519                                 CultureNames.Add ("ja-JP", map);
520
521                                 map=new CultureMap("kn", "kn", "KAN", 0x004b, 0x044b, 0x007f);
522                                 CultureID.Add (0x004b, map);
523                                 CultureNames.Add ("kn", map);
524
525                                 map=new CultureMap("kn-IN", "kn_IN", "KAN", 0x044b, 0x044b, 0x004b);
526                                 CultureID.Add (0x044b, map);
527                                 CultureNames.Add ("kn-IN", map);
528
529                                 /* Kazakh not supported
530                                    map=new CultureMap("kk", "kk", "KKZ", 0x003f, 0x043f, 0x007f);
531                                    CultureID.Add (0x003f, map);
532                                    CultureNames.Add ("kk", map);
533
534                                    map=new CultureMap("kk-KZ", "kk-KZ", "KKZ", 0x043f, 0x043f, 0x003f);
535                                    CultureID.Add (0x043f, map);
536                                    CultureNames.Add ("kk-KZ", map);*/
537
538                                 map=new CultureMap("kok", "kok", "KNK", 0x0057, 0x0457, 0x007f);
539                                 CultureID.Add (0x0057, map);
540                                 CultureNames.Add ("kok", map);
541
542                                 map=new CultureMap("kok-IN", "kok_IN", "KNK", 0x0457, 0x0457, 0x0057);
543                                 CultureID.Add (0x0457, map);
544                                 CultureNames.Add ("kok-IN", map);
545
546                                 map=new CultureMap("ko", "ko", "KOR", 0x0012, 0x0412, 0x007f);
547                                 CultureID.Add (0x0012, map);
548                                 CultureNames.Add ("ko", map);
549
550                                 map=new CultureMap("ko-KR", "ko_KR", "KOR", 0x0412, 0x0412, 0x0012);
551                                 CultureID.Add (0x0412, map);
552                                 CultureNames.Add ("ko-KR", map);
553
554                                 /* Kyrgyz not supported
555                                    map=new CultureMap("ky", "ky", "KYR", 0x0040, 0x0440, 0x007f);
556                                    CultureID.Add (0x0040, map);
557                                    CultureNames.Add ("ky", map);
558
559                                    map=new CultureMap("ky-KZ", "ky-KZ", "KYR", 0x0440, 0x0440, 0x0040);
560                                    CultureID.Add (0x0440, map);
561                                    CultureNames.Add ("ky-KZ", map);*/
562
563                                 map=new CultureMap("lv", "lv", "LVI", 0x0026, 0x0426, 0x007f);
564                                 CultureID.Add (0x0026, map);
565                                 CultureNames.Add ("lv", map);
566
567                                 map=new CultureMap("lv-LV", "lv_LV", "LVI", 0x0426, 0x0426, 0x0026);
568                                 CultureID.Add (0x0426, map);
569                                 CultureNames.Add ("lv-LV", map);
570
571                                 map=new CultureMap("lt", "lt", "LTH", 0x0027, 0x0427, 0x007f);
572                                 CultureID.Add (0x0027, map);
573                                 CultureNames.Add ("lt", map);
574
575                                 map=new CultureMap("lt-LT", "lt_LT", "LTH", 0x0427, 0x0427, 0x0027);
576                                 CultureID.Add (0x0427, map);
577                                 CultureNames.Add ("lt-LT", map);
578
579                                 map=new CultureMap("mk", "mk", "MKI", 0x002f, 0x042f, 0x007f);
580                                 CultureID.Add (0x002f, map);
581                                 CultureNames.Add ("mk", map);
582
583                                 map=new CultureMap("mk-MK", "mk_MK", "MKI", 0x042f, 0x042f, 0x002f);
584                                 CultureID.Add (0x042f, map);
585                                 CultureNames.Add ("mk-MK", map);
586
587                                 /* Malay not supported
588                                    map=new CultureMap("ms", "ms", "MSL", 0x003e, 0x043e, 0x007f);
589                                    CultureID.Add (0x003e, map);
590                                    CultureNames.Add ("ms", map);
591
592                                    map=new CultureMap("ms-BN", "ms-BN", "MSB", 0x083e, 0x083e, 0x003e);
593                                    CultureID.Add (0x083e, map);
594                                    CultureNames.Add ("ms-BN", map);
595
596                                    map=new CultureMap("ms-MY", "ms-MY", "MSL", 0x043e, 0x043e, 0x003e);
597                                    CultureID.Add (0x043e, map);
598                                    CultureNames.Add ("ms-MY", map);*/
599
600                                 map=new CultureMap("mr", "mr", "MAR", 0x004e, 0x044e, 0x007f);
601                                 CultureID.Add (0x004e, map);
602                                 CultureNames.Add ("mr", map);
603
604                                 map=new CultureMap("mr-IN", "mr_IN", "MAR", 0x044e, 0x044e, 0x004e);
605                                 CultureID.Add (0x044e, map);
606                                 CultureNames.Add ("mr-IN", map);
607
608                                 /* Mongolian not supported
609                                    map=new CultureMap("mn", "mn", "MON", 0x0050, 0x0450, 0x007f);
610                                    CultureID.Add (0x0050, map);
611                                    CultureNames.Add ("mn", map);
612
613                                    map=new CultureMap("mn-MN", "mn-MN", "MON", 0x0450, 0x0450, 0x0050);
614                                    CultureID.Add (0x0450, map);
615                                    CultureNames.Add ("mn-MN", map);*/
616
617                                 map=new CultureMap("no", "no", "NOR", 0x0014, 0x0414, 0x007f);
618                                 CultureID.Add (0x0014, map);
619                                 CultureNames.Add ("no", map);
620
621                                 map=new CultureMap("nb-NO", "nb_NO", "NOR", 0x0414, 0x0414, 0x0014);
622                                 CultureID.Add (0x0414, map);
623                                 CultureNames.Add ("nb-NO", map);
624
625                                 map=new CultureMap("nn-NO", "nn_NO", "NON", 0x0814, 0x0814, 0x0014);
626                                 CultureID.Add (0x0814, map);
627                                 CultureNames.Add ("nn-NO", map);
628
629                                 map=new CultureMap("pl", "pl", "PLK", 0x0015, 0x0415, 0x007f);
630                                 CultureID.Add (0x0015, map);
631                                 CultureNames.Add ("pl", map);
632
633                                 map=new CultureMap("pl-PL", "pl_PL", "PLK", 0x0415, 0x0415, 0x0015);
634                                 CultureID.Add (0x0415, map);
635                                 CultureNames.Add ("pl-PL", map);
636
637                                 map=new CultureMap("pt", "pt", "PTB", 0x0016, 0x0416, 0x007f);
638                                 CultureID.Add (0x0016, map);
639                                 CultureNames.Add ("pt", map);
640
641                                 map=new CultureMap("pt-BR", "pt_BR", "PTB", 0x0416, 0x0416, 0x0016);
642                                 CultureID.Add (0x0416, map);
643                                 CultureNames.Add ("pt-BR", map);
644                                 
645                                 map=new CultureMap("pt-PT", "pt_PT", "PTG", 0x0816, 0x0816, 0x0016);
646                                 CultureID.Add (0x0816, map);
647                                 CultureNames.Add ("pt-PT", map);
648
649                                 /* Punjabi not supported
650                                    map=new CultureMap("pa", "pa", "PAN", 0x0046, 0x0446, 0x007f);
651                                    CultureID.Add (0x0046, map);
652                                    CultureNames.Add ("pa", map);
653
654                                    map=new CultureMap("pa-IN", "pa-IN", "PAN", 0x0446, 0x0446, 0x0046);
655                                    CultureID.Add (0x0446, map);
656                                    CultureNames.Add ("pa-IN", map);*/
657
658                                 map=new CultureMap("ro", "ro", "ROM", 0x0018, 0x0418, 0x007f);
659                                 CultureID.Add (0x0018, map);
660                                 CultureNames.Add ("ro", map);
661
662                                 map=new CultureMap("ro-RO", "ro_RO", "ROM", 0x0418, 0x0418, 0x0018);
663                                 CultureID.Add (0x0418, map);
664                                 CultureNames.Add ("ro-RO", map);
665
666                                 map=new CultureMap("ru", "ru", "RUS", 0x0019, 0x0419, 0x007f);
667                                 CultureID.Add (0x0019, map);
668                                 CultureNames.Add ("ru", map);
669
670                                 map=new CultureMap("ru-RU", "ru_RU", "RUS", 0x0419, 0x0419, 0x0019);
671                                 CultureID.Add (0x0419, map);
672                                 CultureNames.Add ("ru-RU", map);
673
674                                 /* Sanskrit not supported
675                                    map=new CultureMap("sa", "sa", "SAN", 0x004f, 0x044f, 0x007f);
676                                    CultureID.Add (0x004f, map);
677                                    CultureNames.Add ("sa", map);
678
679                                    map=new CultureMap("sa-IN", "sa-IN", "SAN", 0x044f, 0x044f, 0x004f);
680                                    CultureID.Add (0x044f, map);
681                                    CultureNames.Add ("sa-IN", map);*/
682
683                                 map=new CultureMap("Cy-sr-SP", "sr", "SRB", 0x0c1a, 0x0c1a, 0x001a);
684                                 CultureID.Add (0x0c1a, map);
685                                 CultureNames.Add ("Cy-sr-SP", map);
686
687                                 map=new CultureMap("Lt-sr-SP", "sh", "SRL", 0x081a, 0x081a, 0x001a);
688                                 CultureID.Add (0x081a, map);
689                                 CultureNames.Add ("Lt-sr-SP", map);
690
691                                 map=new CultureMap("sk", "sk", "SKY", 0x001b, 0x041b, 0x007f);
692                                 CultureID.Add (0x001b, map);
693                                 CultureNames.Add ("sk", map);
694
695                                 map=new CultureMap("sk-SK", "sk_SK", "SKY", 0x041b, 0x041b, 0x001b);
696                                 CultureID.Add (0x041b, map);
697                                 CultureNames.Add ("sk-SK", map);
698
699                                 map=new CultureMap("sl", "sl", "SLV", 0x0024, 0x0424, 0x007f);
700                                 CultureID.Add (0x0024, map);
701                                 CultureNames.Add ("sl", map);
702
703                                 map=new CultureMap("sl-SI", "sl_SI", "SLV", 0x0424, 0x0424, 0x0024);
704                                 CultureID.Add (0x0424, map);
705                                 CultureNames.Add ("sl-SI", map);
706
707                                 map=new CultureMap("es", "es", "ESP", 0x000a, 0x0c0a, 0x007f);
708                                 CultureID.Add (0x000a, map);
709                                 CultureNames.Add ("es", map);
710
711                                 map=new CultureMap("es-AR", "es_AR", "ESS", 0x2c0a, 0x2c0a, 0x000a);
712                                 CultureID.Add (0x2c0a, map);
713                                 CultureNames.Add ("es-AR", map);
714
715                                 map=new CultureMap("es-BO", "es_BO", "ESB", 0x400a, 0x400a, 0x000a);
716                                 CultureID.Add (0x400a, map);
717                                 CultureNames.Add ("es-BO", map);
718
719                                 map=new CultureMap("es-CL", "es_CL", "ESL", 0x340a, 0x340a, 0x000a);
720                                 CultureID.Add (0x340a, map);
721                                 CultureNames.Add ("es-CL", map);
722
723                                 map=new CultureMap("es-CO", "es_CO", "ESO", 0x240a, 0x240a, 0x000a);
724                                 CultureID.Add (0x240a, map);
725                                 CultureNames.Add ("es-CO", map);
726
727                                 map=new CultureMap("es-CR", "es_CR", "ESC", 0x140a, 0x140a, 0x000a);
728                                 CultureID.Add (0x140a, map);
729                                 CultureNames.Add ("es-CR", map);
730
731                                 map=new CultureMap("es-DO", "es_DO", "ESD", 0x1c0a, 0x1c0a, 0x000a);
732                                 CultureID.Add (0x1c0a, map);
733                                 CultureNames.Add ("es-DO", map);
734
735                                 map=new CultureMap("es-EC", "es_EC", "ESF", 0x300a, 0x300a, 0x000a);
736                                 CultureID.Add (0x300a, map);
737                                 CultureNames.Add ("es-EC", map);
738
739                                 map=new CultureMap("es-SV", "es_SV", "ESE", 0x440a, 0x440a, 0x000a);
740                                 CultureID.Add (0x440a, map);
741                                 CultureNames.Add ("es-SV", map);
742
743                                 map=new CultureMap("es-GT", "es_GT", "ESG", 0x100a, 0x100a, 0x000a);
744                                 CultureID.Add (0x100a, map);
745                                 CultureNames.Add ("es-GT", map);
746
747                                 map=new CultureMap("es-HN", "es_HN", "ESH", 0x480a, 0x480a, 0x000a);
748                                 CultureID.Add (0x480a, map);
749                                 CultureNames.Add ("es-HN", map);
750                                 
751                                 map=new CultureMap("es-MX", "es_MX", "ESM", 0x080a, 0x080a, 0x000a);
752                                 CultureID.Add (0x080a, map);
753                                 CultureNames.Add ("es-MX", map);
754
755                                 map=new CultureMap("es-NI", "es_NI", "ESI", 0x4c0a, 0x4c0a, 0x000a);
756                                 CultureID.Add (0x4c0a, map);
757                                 CultureNames.Add ("es-NI", map);
758
759                                 map=new CultureMap("es-PA", "es_PA", "ESA", 0x180a, 0x180a, 0x000a);
760                                 CultureID.Add (0x180a, map);
761                                 CultureNames.Add ("es-PA", map);
762
763                                 map=new CultureMap("es-PY", "es_PY", "ESZ", 0x3c0a, 0x3c0a, 0x000a);
764                                 CultureID.Add (0x3c0a, map);
765                                 CultureNames.Add ("es-PY", map);
766
767                                 map=new CultureMap("es-PE", "es_PE", "ESR", 0x280a, 0x280a, 0x000a);
768                                 CultureID.Add (0x280a, map);
769                                 CultureNames.Add ("es-PE", map);
770
771                                 map=new CultureMap("es-PR", "es_PR", "ESU", 0x500a, 0x500a, 0x000a);
772                                 CultureID.Add (0x500a, map);
773                                 CultureNames.Add ("es-PR", map);
774
775                                 map=new CultureMap("es-ES", "es_ES", "ESN", 0x0c0a, 0x0c0a, 0x000a);
776                                 CultureID.Add (0x0c0a, map);
777                                 CultureNames.Add ("es-ES", map);
778
779                                 map=new CultureMap("es-UY", "es_UY", "ESY", 0x380a, 0x380a, 0x000a);
780                                 CultureID.Add (0x380a, map);
781                                 CultureNames.Add ("es-UY", map);
782
783                                 map=new CultureMap("es-VE", "es_VE", "ESV", 0x200a, 0x200a, 0x000a);
784                                 CultureID.Add (0x200a, map);
785                                 CultureNames.Add ("es-VE", map);
786
787                                 map=new CultureMap("sw", "sw", "SWK", 0x0041, 0x0441, 0x007f);
788                                 CultureID.Add (0x0041, map);
789                                 CultureNames.Add ("sw", map);
790
791                                 map=new CultureMap("sw-KE", "sw_KE", "SWK", 0x0441, 0x0441, 0x0041);
792                                 CultureID.Add (0x0441, map);
793                                 CultureNames.Add ("sw-KE", map);
794
795                                 map=new CultureMap("sv", "sv", "SVE", 0x001d, 0x041d, 0x007f);
796                                 CultureID.Add (0x001d, map);
797                                 CultureNames.Add ("sv", map);
798
799                                 map=new CultureMap("sv-FI", "sv_FI", "SVF", 0x081d, 0x081d, 0x001d);
800                                 CultureID.Add (0x081d, map);
801                                 CultureNames.Add ("sv-FI", map);
802
803                                 map=new CultureMap("sv-SE", "sv_SE", "SVE", 0x041d, 0x041d, 0x001d);
804                                 CultureID.Add (0x041d, map);
805                                 CultureNames.Add ("sv-SE", map);
806
807                                 /* Syriac not supported
808                                    map=new CultureMap("syr", "syr", "SYR", 0x005a, 0x045a, 0x007f);
809                                    CultureID.Add (0x005a, map);
810                                    CultureNames.Add ("syr", map);
811
812                                    map=new CultureMap("syr-SY", "syr-SY", "SYR", 0x045a, 0x045a, 0x005a);
813                                    CultureID.Add (0x045a, map);
814                                    CultureNames.Add ("syr-SY", map);*/
815
816                                 map=new CultureMap("ta", "ta", "TAM", 0x0049, 0x0449, 0x007f);
817                                 CultureID.Add (0x0049, map);
818                                 CultureNames.Add ("ta", map);
819
820                                 map=new CultureMap("ta-IN", "ta_IN", "TAM", 0x0449, 0x0449, 0x0049);
821                                 CultureID.Add (0x0449, map);
822                                 CultureNames.Add ("ta-IN", map);
823
824                                 /* Tatar not supported
825                                    map=new CultureMap("tt", "tt", "TTT", 0x0044, 0x0444, 0x007f);
826                                    CultureID.Add (0x0044, map);
827                                    CultureNames.Add ("tt", map);
828
829                                    map=new CultureMap("tt-RU", "tt-RU", "TTT", 0x0444, 0x0444, 0x0044);
830                                    CultureID.Add (0x0444, map);
831                                    CultureNames.Add ("tt-RU", map);*/
832
833                                 map=new CultureMap("te", "te", "TEL", 0x004a, 0x044a, 0x007f);
834                                 CultureID.Add (0x004a, map);
835                                 CultureNames.Add ("te", map);
836
837                                 map=new CultureMap("te-IN", "te_IN", "TEL", 0x044a, 0x044a, 0x004a);
838                                 CultureID.Add (0x044a, map);
839                                 CultureNames.Add ("te-IN", map);
840
841                                 map=new CultureMap("th", "th", "THA", 0x001e, 0x041e, 0x007f);
842                                 CultureID.Add (0x001e, map);
843                                 CultureNames.Add ("th", map);
844
845                                 /* _TRADITIONAL variant too */
846                                 map=new CultureMap("th-TH", "th_TH", "THA", 0x041e, 0x041e, 0x001e);
847                                 CultureID.Add (0x041e, map);
848                                 CultureNames.Add ("th-TH", map);
849
850                                 map=new CultureMap("tr", "tr", "TRK", 0x001f, 0x041f, 0x007f);
851                                 CultureID.Add (0x001f, map);
852                                 CultureNames.Add ("tr", map);
853
854                                 map=new CultureMap("tr-TR", "tr_TR", "TRK", 0x041f, 0x041f, 0x001f);
855                                 CultureID.Add (0x041f, map);
856                                 CultureNames.Add ("tr-TR", map);
857
858                                 map=new CultureMap("uk", "uk", "UKR", 0x0022, 0x0422, 0x007f);
859                                 CultureID.Add (0x0022, map);
860                                 CultureNames.Add ("uk", map);
861
862                                 map=new CultureMap("uk-UA", "uk_UA", "UKR", 0x0422, 0x0422, 0x0022);
863                                 CultureID.Add (0x0422, map);
864                                 CultureNames.Add ("uk-UA", map);
865
866                                 /* Urdu not supported
867                                    map=new CultureMap("ur", "ur", "URD", 0x0020, 0x0420, 0x007f);
868                                    CultureID.Add (0x0020, map);
869                                    CultureNames.Add ("ur", map);
870
871                                    map=new CultureMap("ur-PK", "ur-PK", "URD", 0x0420, 0x0420, 0x0020);
872                                    CultureID.Add (0x0420, map);
873                                    CultureNames.Add ("ur-PK", map);*/
874
875                                 /* Uzbek not supported
876                                    map=new CultureMap("uz", "uz", "UZB", 0x0043, 0x0443, 0x007f);
877                                    CultureID.Add (0x0043, map);
878                                    CultureNames.Add ("uz", map);
879
880                                    map=new CultureMap("Cy-uz-UZ", "Cy-uz-UZ", "UZB", 0x0843, 0x0843, 0x0043);
881                                    CultureID.Add (0x0843, map);
882                                    CultureNames.Add ("Cy-uz-UZ", map);
883
884                                    map=new CultureMap("Lt-uz-UZ", "Lt-uz-UZ", "UZB", 0x0443, 0x0443, 0x0043);
885                                    CultureID.Add (0x0443, map);
886                                    CultureNames.Add ("Lt-uz-UZ", map);*/
887
888                                 map=new CultureMap("vi", "vi", "VIT", 0x002a, 0x042a, 0x007f);
889                                 CultureID.Add (0x002a, map);
890                                 CultureNames.Add ("vi", map);
891
892                                 map=new CultureMap("vi-VN", "vi_VN", "VIT", 0x042a, 0x042a, 0x002a);
893                                 CultureID.Add (0x042a, map);
894                                 CultureNames.Add ("vi-VN", map);
895
896                                 /* Extras not listed in the docs... */
897                                 map=new CultureMap ("de-DE-PHONEBOOK", "de__PHONEBOOK", "DEU", 0x10407, 0x0407, 0x0007);
898                                 CultureID.Add (0x10407, map);
899                                 CultureNames.Add ("de-DE-PHONEBOOK",map);
900
901                                 map=new CultureMap ("es-ES-Ts", "es__TRADITIONAL", "ESN", 0x040a, 0x0c0a, 0x000a);
902                                 CultureID.Add (0x040a, map);
903                                 CultureNames.Add ("es-ES-Ts", map);
904
905                                 /* Others not supported by ms */
906
907                                 map=new CultureMap ("bn", "dn", "", 0x0045, 0x0445, 0x007f);
908                                 CultureID.Add (0x0045, map);
909                                 CultureNames.Add ("bn", map);
910
911                                 map=new CultureMap ("bn-IN", "bn_IN", "", 0x0445, 0x0445, 0x0045);
912                                 CultureID.Add (0x0445,map);
913                                 CultureNames.Add ("bn-IN", map);
914
915                                 map=new CultureMap ("mt", "mt", "", 0x003a, 0x043a, 0x007f);
916                                 CultureID.Add (0x003a, map);
917                                 CultureNames.Add ("mt", map);
918
919                                 map=new CultureMap ("mt-MT", "mt_MT", "", 0x043a, 0x043a, 0x003a);
920                                 CultureID.Add (0x043a, map);
921                                 CultureNames.Add ("mt-MT", map);
922
923                                 map=new CultureMap ("zh-TW-STROKE", "zh_TW_STROKE", "", 0x20404, 0x20404, 0x7c04);
924                                 CultureID.Add (0x20404, map);
925                                 CultureNames.Add ("zh-TW-STROKE", map);
926
927                                 /* Just need an instance to call
928                                  * GetEnumerator() on
929                                  */
930                                 lcids=map;
931                         }
932                         
933                         public CultureMap (string name, string icu_name,
934                                            string win3lang, int lcid,
935                                            int specific_lcid, int parent_lcid)
936                         {
937                                 this.name=name;
938                                 this.icu_name=icu_name;
939                                 this.win3lang=win3lang;
940                                 this.lcid=lcid;
941                                 this.specific_lcid=specific_lcid;
942                                 this.parent_lcid=parent_lcid;
943                         }
944
945                         public IEnumerator GetEnumerator ()
946                         {
947                                 return(new CultureEnumerator (CultureID));
948                         }
949                 
950                         public static int name_to_lcid (string name)
951                         {
952                                 CultureMap map=CultureNames[name] as CultureMap;
953                                 
954                                 if(map==null) {
955                                         throw new ArgumentException ("Culture name "+name+" is not supported.");
956                                 }
957                                 
958                                 return(map.lcid);
959                         }
960                 
961                         public static int name_to_specific_lcid (string name)
962                         {
963                                 CultureMap map=CultureNames[name] as CultureMap;
964                                 
965                                 if(map==null) {
966                                         throw new ArgumentException ("Culture name "+name+" is not supported.");
967                                 }
968                                 
969                                 return(map.specific_lcid);
970                         }
971
972                         public static string lcid_to_name (int lcid)
973                         {
974                                 CultureMap map=CultureID[lcid] as CultureMap;
975                                 
976                                 if(map==null) {
977                                         throw new ArgumentException ("Culture ID "+lcid+" (0x"+lcid.ToString ("x4")+") is not supported.");
978                                 }
979                                 
980                                 return(map.name);
981                         }
982                                         
983                         public static string lcid_to_icuname (int lcid)
984                         {
985                                 CultureMap map=CultureID[lcid] as CultureMap;
986                                 
987                                 if(map==null) {
988                                         throw new ArgumentException ("Culture ID "+lcid+" (0x"+lcid.ToString ("x4")+") is not supported.");
989                                 }
990                                 
991                                 return(map.icu_name);
992                         }
993
994                         public static string lcid_to_win3lang (int lcid)
995                         {
996                                 CultureMap map=CultureID[lcid] as CultureMap;
997                                 
998                                 if(map==null) {
999                                         throw new ArgumentException ("Culture ID "+lcid+" (0x"+lcid.ToString ("x4")+") is not supported.");
1000                                 }
1001                                 
1002                                 return(map.win3lang);
1003                         }
1004
1005                         public static int lcid_to_specific_lcid (int lcid)
1006                         {
1007                                 CultureMap map=CultureID[lcid] as CultureMap;
1008                                 
1009                                 if(map==null) {
1010                                         throw new ArgumentException ("Culture ID "+lcid+" (0x"+lcid.ToString ("x4")+") is not supported.");
1011                                 }
1012                                 
1013                                 return(map.specific_lcid);
1014                         }
1015
1016                         public static int lcid_to_parent_lcid (int lcid)
1017                         {
1018                                 CultureMap map=CultureID[lcid] as CultureMap;
1019                                 
1020                                 if(map==null) {
1021                                         throw new ArgumentException ("Culture ID "+lcid+" (0x"+lcid.ToString ("x4")+") is not supported.");
1022                                 }
1023                                 
1024                                 return(map.parent_lcid);
1025                         }
1026
1027                         private sealed class CultureEnumerator : IEnumerator 
1028                         {
1029                                 IEnumerator hash_enum;
1030                                 
1031                                 public CultureEnumerator (Hashtable hash)
1032                                 {
1033                                         hash_enum=hash.GetEnumerator ();
1034                                 }
1035
1036                                 public int Current
1037                                 {
1038                                         get {
1039                                                 DictionaryEntry ent=(DictionaryEntry)hash_enum.Current;
1040                                                 CultureMap map=ent.Value as CultureMap;
1041                                                 return(map.lcid);
1042                                         }
1043                                 }
1044                                 
1045                                 object IEnumerator.Current 
1046                                 {
1047                                         get {
1048                                                 return Current;
1049                                         }
1050                                 }
1051
1052                                 public bool MoveNext () 
1053                                 {
1054                                         return(hash_enum.MoveNext ());
1055                                 }
1056
1057                                 public void Reset ()
1058                                 {
1059                                         hash_enum.Reset ();
1060                                 }
1061                         }
1062                 }
1063                 
1064                 static public CultureInfo InvariantCulture {
1065                         get {
1066                                 if (invariant_culture_info == null) {
1067                                         lock (typeof (CultureInfo)) {
1068                                                 if (invariant_culture_info == null) {
1069                                                         invariant_culture_info = new CultureInfo (0x7f, false);
1070                                                         invariant_culture_info.is_read_only = true;
1071                                                 }
1072                                         }
1073                                 }
1074                                 
1075                                 return(invariant_culture_info);
1076                         }
1077                 }
1078
1079                 public static CultureInfo CreateSpecificCulture (string name)
1080                 {
1081                         if (name == null) {
1082                                 throw new ArgumentNullException ("name");
1083                         }
1084                         
1085                         CultureInfo culture=new CultureInfo (name);
1086                         if(culture.IsNeutralCulture==false) {
1087                                 return(culture);
1088                         }
1089
1090                         return(new CultureInfo (CultureMap.name_to_specific_lcid (name)));
1091                 }
1092
1093                 public static CultureInfo CurrentCulture 
1094                 {
1095                         get {
1096                                 return Thread.CurrentThread.CurrentCulture;
1097                         }
1098                 }
1099
1100                 public static CultureInfo CurrentUICulture 
1101                 {
1102                         get {
1103                                 return Thread.CurrentThread.CurrentUICulture;
1104                         }
1105                 }
1106
1107
1108                 public virtual int LCID {
1109                         get {
1110                                 return lcid;
1111                         }
1112                 }
1113
1114                 public virtual string Name {
1115                         get {
1116                                 return(name);
1117                         }
1118                 }
1119
1120                 public virtual string NativeName
1121                 {
1122                         get {
1123                                 return(nativename);
1124                         }
1125                 }
1126                 
1127
1128                 [MonoTODO]
1129                 public virtual Calendar Calendar
1130                 {
1131                         get { return null; }
1132                 }
1133
1134                 [MonoTODO]
1135                 public virtual Calendar[] OptionalCalendars
1136                 {
1137                         get {
1138                                 return(null);
1139                         }
1140                 }
1141
1142                 public virtual CultureInfo Parent
1143                 {
1144                         get {
1145                                 return(new CultureInfo (CultureMap.lcid_to_parent_lcid (lcid)));
1146                         }
1147                 }
1148
1149                 public virtual TextInfo TextInfo
1150                 {
1151                         get {
1152                                 if (textinfo == null) {
1153                                         lock (this) {
1154                                                 if(textinfo == null) {
1155                                                         textinfo = new TextInfo (lcid);
1156                                                 }
1157                                         }
1158                                 }
1159                                 
1160                                 return(textinfo);
1161                         }
1162                 }
1163
1164                 public virtual string ThreeLetterISOLanguageName
1165                 {
1166                         get {
1167                                 return(iso3lang);
1168                         }
1169                 }
1170
1171                 public virtual string ThreeLetterWindowsLanguageName
1172                 {
1173                         get {
1174                                 return(win3lang);
1175                         }
1176                 }
1177
1178                 public virtual string TwoLetterISOLanguageName
1179                 {
1180                         get {
1181                                 return(iso2lang);
1182                         }
1183                 }
1184
1185                 public bool UseUserOverride
1186                 {
1187                         get {
1188                                 return use_user_override;
1189                         }
1190                 }
1191
1192                 [MonoTODO]
1193                 public void ClearCachedData()
1194                 {
1195                 }
1196
1197                 public virtual object Clone()
1198                 {
1199                         CultureInfo ci=(CultureInfo)MemberwiseClone ();
1200                         ci.is_read_only=false;
1201                         return(ci);
1202                 }
1203
1204                 public override bool Equals (object value)
1205                 {
1206                         CultureInfo b = value as CultureInfo;
1207                         if (b != null)
1208                                 return b.lcid == lcid;
1209                         return false;
1210                 }
1211
1212                 public static CultureInfo[] GetCultures(CultureTypes types)
1213                 {
1214                         bool neutral=((types & CultureTypes.NeutralCultures)!=0);
1215                         bool specific=((types & CultureTypes.SpecificCultures)!=0);
1216                         bool installed=((types & CultureTypes.InstalledWin32Cultures)!=0);  // TODO
1217
1218                         ArrayList arr=new ArrayList ();
1219                         
1220                         foreach (int id in CultureMap.lcids) {
1221                                 bool is_neutral=IsIDNeutralCulture (id);
1222
1223                                 if((neutral && is_neutral) ||
1224                                    (specific && !is_neutral)) {
1225                                         arr.Add (new CultureInfo (id));
1226                                 }
1227                         }
1228
1229                         CultureInfo[] cultures=new CultureInfo[arr.Count];
1230                         arr.CopyTo (cultures, 0);
1231
1232                         return(cultures);
1233                 }
1234
1235                 public override int GetHashCode()
1236                 {
1237                         return lcid;
1238                 }
1239
1240                 public static CultureInfo ReadOnly(CultureInfo ci)
1241                 {
1242                         if(ci==null) {
1243                                 throw new ArgumentNullException("ci");
1244                         }
1245
1246                         if(ci.is_read_only) {
1247                                 return(ci);
1248                         } else {
1249                                 CultureInfo new_ci=(CultureInfo)ci.Clone ();
1250                                 new_ci.is_read_only=true;
1251                                 return(new_ci);
1252                         }
1253                 }
1254
1255                 public override string ToString()
1256                 {
1257                         return(name);
1258                 }
1259                 
1260                 public virtual CompareInfo CompareInfo
1261                 {
1262                         get {
1263                                 if(compareinfo==null) {
1264                                         lock (this) {
1265                                                 if(compareinfo==null) {
1266                                                         compareinfo=new CompareInfo (lcid);
1267                                                 }
1268                                         }
1269                                 }
1270                                 
1271                                 return(compareinfo);
1272                         }
1273                 }
1274
1275                 /* RegionInfo wants to call this method */
1276                 internal static bool IsIDNeutralCulture (int lcid) 
1277                 {
1278                         return((lcid & 0xff00)==0 ||
1279                                /* Chinese zh-CHS and zh-CHT are
1280                                 * treated as neutral too
1281                                 */
1282                                CultureMap.lcid_to_specific_lcid (lcid)==0);
1283                 }
1284                 
1285                 public virtual bool IsNeutralCulture {
1286                         get {
1287                                 return(IsIDNeutralCulture (lcid));
1288                         }
1289                 }
1290
1291                 public virtual NumberFormatInfo NumberFormat {
1292                         get {
1293                                 if (number_format == null){
1294                                         lock (this){
1295                                                 if (number_format == null)
1296                                                         number_format = new NumberFormatInfo (lcid);
1297                                         }
1298                                 }
1299
1300                                 return number_format;
1301                         }
1302
1303                         set {
1304                                 if (is_read_only) throw new InvalidOperationException(MSG_READONLY);
1305
1306                                 if (value == null)
1307                                         throw new ArgumentNullException ("NumberFormat");
1308                                 
1309                                 number_format = value;
1310                         }
1311                 }
1312
1313                 public virtual DateTimeFormatInfo DateTimeFormat
1314                 {
1315                         get 
1316                         {
1317                                 if (datetime_format == null)
1318                                 {
1319                                         lock (this)
1320                                         {
1321                                                 if (datetime_format == null)
1322                                                         datetime_format = new DateTimeFormatInfo(); 
1323                                         }
1324                                 }
1325
1326                                 return datetime_format;
1327                         }
1328
1329                         set 
1330                         {
1331                                 if (is_read_only) throw new InvalidOperationException(MSG_READONLY);
1332
1333                                 if (value == null)
1334                                         throw new ArgumentNullException ("DateTimeFormat");
1335                                 
1336                                 datetime_format = value;
1337                         }
1338                 }
1339
1340                 public virtual string DisplayName
1341                 {
1342                         get {
1343                                 return(displayname);
1344                         }
1345                 }
1346
1347                 public virtual string EnglishName
1348                 {
1349                         get {
1350                                 return(englishname);
1351                         }
1352                 }
1353
1354                 [MonoTODO]
1355                 public static CultureInfo InstalledUICulture
1356                 {
1357                         get {
1358                                 return(null);
1359                         }
1360                 }
1361
1362                 public bool IsReadOnly 
1363                 {
1364                         get {
1365                                 return(is_read_only);
1366                         }
1367                 }
1368                 
1369
1370                 // 
1371                 // IFormatProvider implementation
1372                 //
1373                 public virtual object GetFormat( Type formatType )
1374                 {
1375                         object format = null;
1376
1377                         if ( formatType == typeof(NumberFormatInfo) )
1378                                 format = NumberFormat;
1379                         else if ( formatType == typeof(DateTimeFormatInfo) )
1380                                 format = DateTimeFormat;
1381                         
1382                         return format;
1383                 }
1384
1385                 //
1386                 // Constructors
1387                 //
1388                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
1389                 private extern void construct_internal_locale (string locale);
1390                 
1391                 private void Construct (int lcid, string name,
1392                                         bool use_user_override)
1393                 {
1394                         /* This will throw ArgumentException if the
1395                          * locale isnt known.
1396                          *
1397                          * Asking CultureMap for the name gets the
1398                          * capitalisation correct, as in practise
1399                          * (rather than by documentation) the name is
1400                          * case-insensitive.
1401                          */
1402                         this.name=CultureMap.lcid_to_name (lcid);
1403                         this.icu_name=CultureMap.lcid_to_icuname (lcid);
1404                         this.use_user_override=use_user_override;
1405                         this.is_read_only=false;
1406                         this.lcid=lcid;
1407
1408                         /* This will throw ArgumentException if
1409                          * CultureMap doesn't know the culture
1410                          */
1411                         this.win3lang=CultureMap.lcid_to_win3lang (lcid);
1412                         
1413                         /* This will throw ArgumentException if ICU
1414                          * doesn't know the culture
1415                          */
1416                         construct_internal_locale (CultureMap.lcid_to_icuname (lcid));
1417                 }
1418
1419                 /* Do _NOT_ use CultureMap in this method, we don't
1420                  * want to initialise the hashtables unless someone
1421                  * asks for a real CultureInfo.
1422                  */
1423                 private void ConstructInvariant (bool use_user_override)
1424                 {
1425                         is_read_only=false;
1426                         lcid=0x7f;
1427                         this.use_user_override=use_user_override;
1428
1429                         /* NumberFormatInfo defaults to the invariant data */
1430                         number_format=new NumberFormatInfo ();
1431                         
1432                         /* DateTimeFormatInfo defaults to the invariant data */
1433                         datetime_format=new DateTimeFormatInfo ();
1434
1435                         textinfo=new TextInfo ();
1436
1437                         name="";
1438                         displayname="Invariant Language (Invariant Country)";
1439                         englishname="Invariant Language (Invariant Country)";
1440                         nativename="Invariant Language (Invariant Country)";
1441                         iso3lang="IVL";
1442                         iso2lang="iv";
1443                         icu_name="en_US_POSIX";
1444                         win3lang="IVL";
1445                 }
1446                 
1447                 public CultureInfo (int culture, bool use_user_override)
1448                 {
1449                         if (culture < 0)
1450                                 throw new ArgumentOutOfRangeException ("culture");
1451
1452                         if(culture==0x007f) {
1453                                 /* Short circuit the invariant culture */
1454                                 ConstructInvariant (use_user_override);
1455                         } else {
1456                                 Construct (culture,
1457                                            CultureMap.lcid_to_name (culture),
1458                                            use_user_override);
1459                         }
1460                 }
1461
1462                 public CultureInfo (int culture) : this (culture, false) {}
1463                 
1464                 public CultureInfo (string name, bool use_user_override)
1465                 {
1466                         if (name == null)
1467                                 throw new ArgumentNullException ();
1468
1469                         if(name=="") {
1470                                 /* Short circuit the invariant culture */
1471                                 ConstructInvariant (use_user_override);
1472                         } else {
1473                                 Construct (CultureMap.name_to_lcid (name),
1474                                            name,
1475                                            use_user_override);
1476                         }
1477                 }
1478
1479                 public CultureInfo (string name) : this (name, false) {} 
1480         }
1481 }