• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Determine the current selected locale.
2    Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
3 
4    This program is free software; you can redistribute it and/or modify it
5    under the terms of the GNU Library General Public License as published
6    by the Free Software Foundation; either version 2, or (at your option)
7    any later version.
8 
9    This program is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Library General Public License for more details.
13 
14    You should have received a copy of the GNU Library General Public
15    License along with this program; if not, write to the Free Software
16    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
17    USA.  */
18 
19 /* Written by Ulrich Drepper <drepper@gnu.org>, 1995.  */
20 /* Win32 code written by Tor Lillqvist <tml@iki.fi>.  */
21 
22 #ifdef HAVE_CONFIG_H
23 # include <config.h>
24 #endif
25 
26 #include <stdlib.h>
27 #include <locale.h>
28 
29 #if defined _WIN32 || defined __WIN32__
30 # undef WIN32   /* avoid warning on mingw32 */
31 # define WIN32
32 #endif
33 
34 #ifdef WIN32
35 # define WIN32_LEAN_AND_MEAN
36 # include <windows.h>
37 /* List of language codes, sorted by value:
38    0x01 LANG_ARABIC
39    0x02 LANG_BULGARIAN
40    0x03 LANG_CATALAN
41    0x04 LANG_CHINESE
42    0x05 LANG_CZECH
43    0x06 LANG_DANISH
44    0x07 LANG_GERMAN
45    0x08 LANG_GREEK
46    0x09 LANG_ENGLISH
47    0x0a LANG_SPANISH
48    0x0b LANG_FINNISH
49    0x0c LANG_FRENCH
50    0x0d LANG_HEBREW
51    0x0e LANG_HUNGARIAN
52    0x0f LANG_ICELANDIC
53    0x10 LANG_ITALIAN
54    0x11 LANG_JAPANESE
55    0x12 LANG_KOREAN
56    0x13 LANG_DUTCH
57    0x14 LANG_NORWEGIAN
58    0x15 LANG_POLISH
59    0x16 LANG_PORTUGUESE
60    0x17 LANG_RHAETO_ROMANCE
61    0x18 LANG_ROMANIAN
62    0x19 LANG_RUSSIAN
63    0x1a LANG_CROATIAN == LANG_SERBIAN
64    0x1b LANG_SLOVAK
65    0x1c LANG_ALBANIAN
66    0x1d LANG_SWEDISH
67    0x1e LANG_THAI
68    0x1f LANG_TURKISH
69    0x20 LANG_URDU
70    0x21 LANG_INDONESIAN
71    0x22 LANG_UKRAINIAN
72    0x23 LANG_BELARUSIAN
73    0x24 LANG_SLOVENIAN
74    0x25 LANG_ESTONIAN
75    0x26 LANG_LATVIAN
76    0x27 LANG_LITHUANIAN
77    0x28 LANG_TAJIK
78    0x29 LANG_FARSI
79    0x2a LANG_VIETNAMESE
80    0x2b LANG_ARMENIAN
81    0x2c LANG_AZERI
82    0x2d LANG_BASQUE
83    0x2e LANG_SORBIAN
84    0x2f LANG_MACEDONIAN
85    0x30 LANG_SUTU
86    0x31 LANG_TSONGA
87    0x32 LANG_TSWANA
88    0x33 LANG_VENDA
89    0x34 LANG_XHOSA
90    0x35 LANG_ZULU
91    0x36 LANG_AFRIKAANS
92    0x37 LANG_GEORGIAN
93    0x38 LANG_FAEROESE
94    0x39 LANG_HINDI
95    0x3a LANG_MALTESE
96    0x3b LANG_SAAMI
97    0x3c LANG_GAELIC
98    0x3d LANG_YIDDISH
99    0x3e LANG_MALAY
100    0x3f LANG_KAZAK
101    0x40 LANG_KYRGYZ
102    0x41 LANG_SWAHILI
103    0x42 LANG_TURKMEN
104    0x43 LANG_UZBEK
105    0x44 LANG_TATAR
106    0x45 LANG_BENGALI
107    0x46 LANG_PUNJABI
108    0x47 LANG_GUJARATI
109    0x48 LANG_ORIYA
110    0x49 LANG_TAMIL
111    0x4a LANG_TELUGU
112    0x4b LANG_KANNADA
113    0x4c LANG_MALAYALAM
114    0x4d LANG_ASSAMESE
115    0x4e LANG_MARATHI
116    0x4f LANG_SANSKRIT
117    0x50 LANG_MONGOLIAN
118    0x51 LANG_TIBETAN
119    0x52 LANG_WELSH
120    0x53 LANG_CAMBODIAN
121    0x54 LANG_LAO
122    0x55 LANG_BURMESE
123    0x56 LANG_GALICIAN
124    0x57 LANG_KONKANI
125    0x58 LANG_MANIPURI
126    0x59 LANG_SINDHI
127    0x5a LANG_SYRIAC
128    0x5b LANG_SINHALESE
129    0x5c LANG_CHEROKEE
130    0x5d LANG_INUKTITUT
131    0x5e LANG_AMHARIC
132    0x5f LANG_TAMAZIGHT
133    0x60 LANG_KASHMIRI
134    0x61 LANG_NEPALI
135    0x62 LANG_FRISIAN
136    0x63 LANG_PASHTO
137    0x64 LANG_TAGALOG
138    0x65 LANG_DIVEHI
139    0x66 LANG_EDO
140    0x67 LANG_FULFULDE
141    0x68 LANG_HAUSA
142    0x69 LANG_IBIBIO
143    0x6a LANG_YORUBA
144    0x70 LANG_IGBO
145    0x71 LANG_KANURI
146    0x72 LANG_OROMO
147    0x73 LANG_TIGRINYA
148    0x74 LANG_GUARANI
149    0x75 LANG_HAWAIIAN
150    0x76 LANG_LATIN
151    0x77 LANG_SOMALI
152    0x78 LANG_YI
153    0x79 LANG_PAPIAMENTU
154 */
155 /* Mingw headers don't have latest language and sublanguage codes.  */
156 # ifndef LANG_AFRIKAANS
157 # define LANG_AFRIKAANS 0x36
158 # endif
159 # ifndef LANG_ALBANIAN
160 # define LANG_ALBANIAN 0x1c
161 # endif
162 # ifndef LANG_AMHARIC
163 # define LANG_AMHARIC 0x5e
164 # endif
165 # ifndef LANG_ARABIC
166 # define LANG_ARABIC 0x01
167 # endif
168 # ifndef LANG_ARMENIAN
169 # define LANG_ARMENIAN 0x2b
170 # endif
171 # ifndef LANG_ASSAMESE
172 # define LANG_ASSAMESE 0x4d
173 # endif
174 # ifndef LANG_AZERI
175 # define LANG_AZERI 0x2c
176 # endif
177 # ifndef LANG_BASQUE
178 # define LANG_BASQUE 0x2d
179 # endif
180 # ifndef LANG_BELARUSIAN
181 # define LANG_BELARUSIAN 0x23
182 # endif
183 # ifndef LANG_BENGALI
184 # define LANG_BENGALI 0x45
185 # endif
186 # ifndef LANG_BURMESE
187 # define LANG_BURMESE 0x55
188 # endif
189 # ifndef LANG_CAMBODIAN
190 # define LANG_CAMBODIAN 0x53
191 # endif
192 # ifndef LANG_CATALAN
193 # define LANG_CATALAN 0x03
194 # endif
195 # ifndef LANG_CHEROKEE
196 # define LANG_CHEROKEE 0x5c
197 # endif
198 # ifndef LANG_DIVEHI
199 # define LANG_DIVEHI 0x65
200 # endif
201 # ifndef LANG_EDO
202 # define LANG_EDO 0x66
203 # endif
204 # ifndef LANG_ESTONIAN
205 # define LANG_ESTONIAN 0x25
206 # endif
207 # ifndef LANG_FAEROESE
208 # define LANG_FAEROESE 0x38
209 # endif
210 # ifndef LANG_FARSI
211 # define LANG_FARSI 0x29
212 # endif
213 # ifndef LANG_FRISIAN
214 # define LANG_FRISIAN 0x62
215 # endif
216 # ifndef LANG_FULFULDE
217 # define LANG_FULFULDE 0x67
218 # endif
219 # ifndef LANG_GAELIC
220 # define LANG_GAELIC 0x3c
221 # endif
222 # ifndef LANG_GALICIAN
223 # define LANG_GALICIAN 0x56
224 # endif
225 # ifndef LANG_GEORGIAN
226 # define LANG_GEORGIAN 0x37
227 # endif
228 # ifndef LANG_GUARANI
229 # define LANG_GUARANI 0x74
230 # endif
231 # ifndef LANG_GUJARATI
232 # define LANG_GUJARATI 0x47
233 # endif
234 # ifndef LANG_HAUSA
235 # define LANG_HAUSA 0x68
236 # endif
237 # ifndef LANG_HAWAIIAN
238 # define LANG_HAWAIIAN 0x75
239 # endif
240 # ifndef LANG_HEBREW
241 # define LANG_HEBREW 0x0d
242 # endif
243 # ifndef LANG_HINDI
244 # define LANG_HINDI 0x39
245 # endif
246 # ifndef LANG_IBIBIO
247 # define LANG_IBIBIO 0x69
248 # endif
249 # ifndef LANG_IGBO
250 # define LANG_IGBO 0x70
251 # endif
252 # ifndef LANG_INDONESIAN
253 # define LANG_INDONESIAN 0x21
254 # endif
255 # ifndef LANG_INUKTITUT
256 # define LANG_INUKTITUT 0x5d
257 # endif
258 # ifndef LANG_KANNADA
259 # define LANG_KANNADA 0x4b
260 # endif
261 # ifndef LANG_KANURI
262 # define LANG_KANURI 0x71
263 # endif
264 # ifndef LANG_KASHMIRI
265 # define LANG_KASHMIRI 0x60
266 # endif
267 # ifndef LANG_KAZAK
268 # define LANG_KAZAK 0x3f
269 # endif
270 # ifndef LANG_KONKANI
271 # define LANG_KONKANI 0x57
272 # endif
273 # ifndef LANG_KYRGYZ
274 # define LANG_KYRGYZ 0x40
275 # endif
276 # ifndef LANG_LAO
277 # define LANG_LAO 0x54
278 # endif
279 # ifndef LANG_LATIN
280 # define LANG_LATIN 0x76
281 # endif
282 # ifndef LANG_LATVIAN
283 # define LANG_LATVIAN 0x26
284 # endif
285 # ifndef LANG_LITHUANIAN
286 # define LANG_LITHUANIAN 0x27
287 # endif
288 # ifndef LANG_MACEDONIAN
289 # define LANG_MACEDONIAN 0x2f
290 # endif
291 # ifndef LANG_MALAY
292 # define LANG_MALAY 0x3e
293 # endif
294 # ifndef LANG_MALAYALAM
295 # define LANG_MALAYALAM 0x4c
296 # endif
297 # ifndef LANG_MALTESE
298 # define LANG_MALTESE 0x3a
299 # endif
300 # ifndef LANG_MANIPURI
301 # define LANG_MANIPURI 0x58
302 # endif
303 # ifndef LANG_MARATHI
304 # define LANG_MARATHI 0x4e
305 # endif
306 # ifndef LANG_MONGOLIAN
307 # define LANG_MONGOLIAN 0x50
308 # endif
309 # ifndef LANG_NEPALI
310 # define LANG_NEPALI 0x61
311 # endif
312 # ifndef LANG_ORIYA
313 # define LANG_ORIYA 0x48
314 # endif
315 # ifndef LANG_OROMO
316 # define LANG_OROMO 0x72
317 # endif
318 # ifndef LANG_PAPIAMENTU
319 # define LANG_PAPIAMENTU 0x79
320 # endif
321 # ifndef LANG_PASHTO
322 # define LANG_PASHTO 0x63
323 # endif
324 # ifndef LANG_PUNJABI
325 # define LANG_PUNJABI 0x46
326 # endif
327 # ifndef LANG_RHAETO_ROMANCE
328 # define LANG_RHAETO_ROMANCE 0x17
329 # endif
330 # ifndef LANG_SAAMI
331 # define LANG_SAAMI 0x3b
332 # endif
333 # ifndef LANG_SANSKRIT
334 # define LANG_SANSKRIT 0x4f
335 # endif
336 # ifndef LANG_SERBIAN
337 # define LANG_SERBIAN 0x1a
338 # endif
339 # ifndef LANG_SINDHI
340 # define LANG_SINDHI 0x59
341 # endif
342 # ifndef LANG_SINHALESE
343 # define LANG_SINHALESE 0x5b
344 # endif
345 # ifndef LANG_SLOVAK
346 # define LANG_SLOVAK 0x1b
347 # endif
348 # ifndef LANG_SOMALI
349 # define LANG_SOMALI 0x77
350 # endif
351 # ifndef LANG_SORBIAN
352 # define LANG_SORBIAN 0x2e
353 # endif
354 # ifndef LANG_SUTU
355 # define LANG_SUTU 0x30
356 # endif
357 # ifndef LANG_SWAHILI
358 # define LANG_SWAHILI 0x41
359 # endif
360 # ifndef LANG_SYRIAC
361 # define LANG_SYRIAC 0x5a
362 # endif
363 # ifndef LANG_TAGALOG
364 # define LANG_TAGALOG 0x64
365 # endif
366 # ifndef LANG_TAJIK
367 # define LANG_TAJIK 0x28
368 # endif
369 # ifndef LANG_TAMAZIGHT
370 # define LANG_TAMAZIGHT 0x5f
371 # endif
372 # ifndef LANG_TAMIL
373 # define LANG_TAMIL 0x49
374 # endif
375 # ifndef LANG_TATAR
376 # define LANG_TATAR 0x44
377 # endif
378 # ifndef LANG_TELUGU
379 # define LANG_TELUGU 0x4a
380 # endif
381 # ifndef LANG_THAI
382 # define LANG_THAI 0x1e
383 # endif
384 # ifndef LANG_TIBETAN
385 # define LANG_TIBETAN 0x51
386 # endif
387 # ifndef LANG_TIGRINYA
388 # define LANG_TIGRINYA 0x73
389 # endif
390 # ifndef LANG_TSONGA
391 # define LANG_TSONGA 0x31
392 # endif
393 # ifndef LANG_TSWANA
394 # define LANG_TSWANA 0x32
395 # endif
396 # ifndef LANG_TURKMEN
397 # define LANG_TURKMEN 0x42
398 # endif
399 # ifndef LANG_UKRAINIAN
400 # define LANG_UKRAINIAN 0x22
401 # endif
402 # ifndef LANG_URDU
403 # define LANG_URDU 0x20
404 # endif
405 # ifndef LANG_UZBEK
406 # define LANG_UZBEK 0x43
407 # endif
408 # ifndef LANG_VENDA
409 # define LANG_VENDA 0x33
410 # endif
411 # ifndef LANG_VIETNAMESE
412 # define LANG_VIETNAMESE 0x2a
413 # endif
414 # ifndef LANG_WELSH
415 # define LANG_WELSH 0x52
416 # endif
417 # ifndef LANG_XHOSA
418 # define LANG_XHOSA 0x34
419 # endif
420 # ifndef LANG_YI
421 # define LANG_YI 0x78
422 # endif
423 # ifndef LANG_YIDDISH
424 # define LANG_YIDDISH 0x3d
425 # endif
426 # ifndef LANG_YORUBA
427 # define LANG_YORUBA 0x6a
428 # endif
429 # ifndef LANG_ZULU
430 # define LANG_ZULU 0x35
431 # endif
432 # ifndef SUBLANG_ARABIC_SAUDI_ARABIA
433 # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
434 # endif
435 # ifndef SUBLANG_ARABIC_IRAQ
436 # define SUBLANG_ARABIC_IRAQ 0x02
437 # endif
438 # ifndef SUBLANG_ARABIC_EGYPT
439 # define SUBLANG_ARABIC_EGYPT 0x03
440 # endif
441 # ifndef SUBLANG_ARABIC_LIBYA
442 # define SUBLANG_ARABIC_LIBYA 0x04
443 # endif
444 # ifndef SUBLANG_ARABIC_ALGERIA
445 # define SUBLANG_ARABIC_ALGERIA 0x05
446 # endif
447 # ifndef SUBLANG_ARABIC_MOROCCO
448 # define SUBLANG_ARABIC_MOROCCO 0x06
449 # endif
450 # ifndef SUBLANG_ARABIC_TUNISIA
451 # define SUBLANG_ARABIC_TUNISIA 0x07
452 # endif
453 # ifndef SUBLANG_ARABIC_OMAN
454 # define SUBLANG_ARABIC_OMAN 0x08
455 # endif
456 # ifndef SUBLANG_ARABIC_YEMEN
457 # define SUBLANG_ARABIC_YEMEN 0x09
458 # endif
459 # ifndef SUBLANG_ARABIC_SYRIA
460 # define SUBLANG_ARABIC_SYRIA 0x0a
461 # endif
462 # ifndef SUBLANG_ARABIC_JORDAN
463 # define SUBLANG_ARABIC_JORDAN 0x0b
464 # endif
465 # ifndef SUBLANG_ARABIC_LEBANON
466 # define SUBLANG_ARABIC_LEBANON 0x0c
467 # endif
468 # ifndef SUBLANG_ARABIC_KUWAIT
469 # define SUBLANG_ARABIC_KUWAIT 0x0d
470 # endif
471 # ifndef SUBLANG_ARABIC_UAE
472 # define SUBLANG_ARABIC_UAE 0x0e
473 # endif
474 # ifndef SUBLANG_ARABIC_BAHRAIN
475 # define SUBLANG_ARABIC_BAHRAIN 0x0f
476 # endif
477 # ifndef SUBLANG_ARABIC_QATAR
478 # define SUBLANG_ARABIC_QATAR 0x10
479 # endif
480 # ifndef SUBLANG_AZERI_LATIN
481 # define SUBLANG_AZERI_LATIN 0x01
482 # endif
483 # ifndef SUBLANG_AZERI_CYRILLIC
484 # define SUBLANG_AZERI_CYRILLIC 0x02
485 # endif
486 # ifndef SUBLANG_BENGALI_INDIA
487 # define SUBLANG_BENGALI_INDIA 0x00
488 # endif
489 # ifndef SUBLANG_BENGALI_BANGLADESH
490 # define SUBLANG_BENGALI_BANGLADESH 0x01
491 # endif
492 # ifndef SUBLANG_CHINESE_MACAU
493 # define SUBLANG_CHINESE_MACAU 0x05
494 # endif
495 # ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
496 # define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
497 # endif
498 # ifndef SUBLANG_ENGLISH_JAMAICA
499 # define SUBLANG_ENGLISH_JAMAICA 0x08
500 # endif
501 # ifndef SUBLANG_ENGLISH_CARIBBEAN
502 # define SUBLANG_ENGLISH_CARIBBEAN 0x09
503 # endif
504 # ifndef SUBLANG_ENGLISH_BELIZE
505 # define SUBLANG_ENGLISH_BELIZE 0x0a
506 # endif
507 # ifndef SUBLANG_ENGLISH_TRINIDAD
508 # define SUBLANG_ENGLISH_TRINIDAD 0x0b
509 # endif
510 # ifndef SUBLANG_ENGLISH_ZIMBABWE
511 # define SUBLANG_ENGLISH_ZIMBABWE 0x0c
512 # endif
513 # ifndef SUBLANG_ENGLISH_PHILIPPINES
514 # define SUBLANG_ENGLISH_PHILIPPINES 0x0d
515 # endif
516 # ifndef SUBLANG_ENGLISH_INDONESIA
517 # define SUBLANG_ENGLISH_INDONESIA 0x0e
518 # endif
519 # ifndef SUBLANG_ENGLISH_HONGKONG
520 # define SUBLANG_ENGLISH_HONGKONG 0x0f
521 # endif
522 # ifndef SUBLANG_ENGLISH_INDIA
523 # define SUBLANG_ENGLISH_INDIA 0x10
524 # endif
525 # ifndef SUBLANG_ENGLISH_MALAYSIA
526 # define SUBLANG_ENGLISH_MALAYSIA 0x11
527 # endif
528 # ifndef SUBLANG_ENGLISH_SINGAPORE
529 # define SUBLANG_ENGLISH_SINGAPORE 0x12
530 # endif
531 # ifndef SUBLANG_FRENCH_LUXEMBOURG
532 # define SUBLANG_FRENCH_LUXEMBOURG 0x05
533 # endif
534 # ifndef SUBLANG_FRENCH_MONACO
535 # define SUBLANG_FRENCH_MONACO 0x06
536 # endif
537 # ifndef SUBLANG_FRENCH_WESTINDIES
538 # define SUBLANG_FRENCH_WESTINDIES 0x07
539 # endif
540 # ifndef SUBLANG_FRENCH_REUNION
541 # define SUBLANG_FRENCH_REUNION 0x08
542 # endif
543 # ifndef SUBLANG_FRENCH_CONGO
544 # define SUBLANG_FRENCH_CONGO 0x09
545 # endif
546 # ifndef SUBLANG_FRENCH_SENEGAL
547 # define SUBLANG_FRENCH_SENEGAL 0x0a
548 # endif
549 # ifndef SUBLANG_FRENCH_CAMEROON
550 # define SUBLANG_FRENCH_CAMEROON 0x0b
551 # endif
552 # ifndef SUBLANG_FRENCH_COTEDIVOIRE
553 # define SUBLANG_FRENCH_COTEDIVOIRE 0x0c
554 # endif
555 # ifndef SUBLANG_FRENCH_MALI
556 # define SUBLANG_FRENCH_MALI 0x0d
557 # endif
558 # ifndef SUBLANG_FRENCH_MOROCCO
559 # define SUBLANG_FRENCH_MOROCCO 0x0e
560 # endif
561 # ifndef SUBLANG_FRENCH_HAITI
562 # define SUBLANG_FRENCH_HAITI 0x0f
563 # endif
564 # ifndef SUBLANG_GERMAN_LUXEMBOURG
565 # define SUBLANG_GERMAN_LUXEMBOURG 0x04
566 # endif
567 # ifndef SUBLANG_GERMAN_LIECHTENSTEIN
568 # define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
569 # endif
570 # ifndef SUBLANG_KASHMIRI_INDIA
571 # define SUBLANG_KASHMIRI_INDIA 0x02
572 # endif
573 # ifndef SUBLANG_MALAY_MALAYSIA
574 # define SUBLANG_MALAY_MALAYSIA 0x01
575 # endif
576 # ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
577 # define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
578 # endif
579 # ifndef SUBLANG_NEPALI_INDIA
580 # define SUBLANG_NEPALI_INDIA 0x02
581 # endif
582 # ifndef SUBLANG_PUNJABI_INDIA
583 # define SUBLANG_PUNJABI_INDIA 0x00
584 # endif
585 # ifndef SUBLANG_PUNJABI_PAKISTAN
586 # define SUBLANG_PUNJABI_PAKISTAN 0x01
587 # endif
588 # ifndef SUBLANG_ROMANIAN_ROMANIA
589 # define SUBLANG_ROMANIAN_ROMANIA 0x00
590 # endif
591 # ifndef SUBLANG_ROMANIAN_MOLDOVA
592 # define SUBLANG_ROMANIAN_MOLDOVA 0x01
593 # endif
594 # ifndef SUBLANG_SERBIAN_LATIN
595 # define SUBLANG_SERBIAN_LATIN 0x02
596 # endif
597 # ifndef SUBLANG_SERBIAN_CYRILLIC
598 # define SUBLANG_SERBIAN_CYRILLIC 0x03
599 # endif
600 # ifndef SUBLANG_SINDHI_INDIA
601 # define SUBLANG_SINDHI_INDIA 0x00
602 # endif
603 # ifndef SUBLANG_SINDHI_PAKISTAN
604 # define SUBLANG_SINDHI_PAKISTAN 0x01
605 # endif
606 # ifndef SUBLANG_SPANISH_GUATEMALA
607 # define SUBLANG_SPANISH_GUATEMALA 0x04
608 # endif
609 # ifndef SUBLANG_SPANISH_COSTA_RICA
610 # define SUBLANG_SPANISH_COSTA_RICA 0x05
611 # endif
612 # ifndef SUBLANG_SPANISH_PANAMA
613 # define SUBLANG_SPANISH_PANAMA 0x06
614 # endif
615 # ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
616 # define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
617 # endif
618 # ifndef SUBLANG_SPANISH_VENEZUELA
619 # define SUBLANG_SPANISH_VENEZUELA 0x08
620 # endif
621 # ifndef SUBLANG_SPANISH_COLOMBIA
622 # define SUBLANG_SPANISH_COLOMBIA 0x09
623 # endif
624 # ifndef SUBLANG_SPANISH_PERU
625 # define SUBLANG_SPANISH_PERU 0x0a
626 # endif
627 # ifndef SUBLANG_SPANISH_ARGENTINA
628 # define SUBLANG_SPANISH_ARGENTINA 0x0b
629 # endif
630 # ifndef SUBLANG_SPANISH_ECUADOR
631 # define SUBLANG_SPANISH_ECUADOR 0x0c
632 # endif
633 # ifndef SUBLANG_SPANISH_CHILE
634 # define SUBLANG_SPANISH_CHILE 0x0d
635 # endif
636 # ifndef SUBLANG_SPANISH_URUGUAY
637 # define SUBLANG_SPANISH_URUGUAY 0x0e
638 # endif
639 # ifndef SUBLANG_SPANISH_PARAGUAY
640 # define SUBLANG_SPANISH_PARAGUAY 0x0f
641 # endif
642 # ifndef SUBLANG_SPANISH_BOLIVIA
643 # define SUBLANG_SPANISH_BOLIVIA 0x10
644 # endif
645 # ifndef SUBLANG_SPANISH_EL_SALVADOR
646 # define SUBLANG_SPANISH_EL_SALVADOR 0x11
647 # endif
648 # ifndef SUBLANG_SPANISH_HONDURAS
649 # define SUBLANG_SPANISH_HONDURAS 0x12
650 # endif
651 # ifndef SUBLANG_SPANISH_NICARAGUA
652 # define SUBLANG_SPANISH_NICARAGUA 0x13
653 # endif
654 # ifndef SUBLANG_SPANISH_PUERTO_RICO
655 # define SUBLANG_SPANISH_PUERTO_RICO 0x14
656 # endif
657 # ifndef SUBLANG_SWEDISH_FINLAND
658 # define SUBLANG_SWEDISH_FINLAND 0x02
659 # endif
660 # ifndef SUBLANG_TAMAZIGHT_ARABIC
661 # define SUBLANG_TAMAZIGHT_ARABIC 0x01
662 # endif
663 # ifndef SUBLANG_TAMAZIGHT_LATIN
664 # define SUBLANG_TAMAZIGHT_LATIN 0x02
665 # endif
666 # ifndef SUBLANG_TIGRINYA_ETHIOPIA
667 # define SUBLANG_TIGRINYA_ETHIOPIA 0x00
668 # endif
669 # ifndef SUBLANG_TIGRINYA_ERITREA
670 # define SUBLANG_TIGRINYA_ERITREA 0x01
671 # endif
672 # ifndef SUBLANG_URDU_PAKISTAN
673 # define SUBLANG_URDU_PAKISTAN 0x01
674 # endif
675 # ifndef SUBLANG_URDU_INDIA
676 # define SUBLANG_URDU_INDIA 0x02
677 # endif
678 # ifndef SUBLANG_UZBEK_LATIN
679 # define SUBLANG_UZBEK_LATIN 0x01
680 # endif
681 # ifndef SUBLANG_UZBEK_CYRILLIC
682 # define SUBLANG_UZBEK_CYRILLIC 0x02
683 # endif
684 #endif
685 
686 /* XPG3 defines the result of 'setlocale (category, NULL)' as:
687    "Directs 'setlocale()' to query 'category' and return the current
688     setting of 'local'."
689    However it does not specify the exact format.  Neither do SUSV2 and
690    ISO C 99.  So we can use this feature only on selected systems (e.g.
691    those using GNU C Library).  */
692 #if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
693 # define HAVE_LOCALE_NULL
694 #endif
695 
696 /* Determine the current locale's name, and canonicalize it into XPG syntax
697      language[_territory[.codeset]][@modifier]
698    The codeset part in the result is not reliable; the locale_charset()
699    should be used for codeset information instead.
700    The result must not be freed; it is statically allocated.  */
701 
702 const char *
_nl_locale_name(int category,const char * categoryname)703 _nl_locale_name (int category, const char *categoryname)
704 {
705   const char *retval;
706 
707 #ifndef WIN32
708 
709   /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
710      On some systems this can be done by the 'setlocale' function itself.  */
711 # if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
712   retval = setlocale (category, NULL);
713 # else
714   /* Setting of LC_ALL overwrites all other.  */
715   retval = getenv ("LC_ALL");
716   if (retval == NULL || retval[0] == '\0')
717     {
718       /* Next comes the name of the desired category.  */
719       retval = getenv (categoryname);
720       if (retval == NULL || retval[0] == '\0')
721 	{
722 	  /* Last possibility is the LANG environment variable.  */
723 	  retval = getenv ("LANG");
724 	  if (retval == NULL || retval[0] == '\0')
725 	    /* We use C as the default domain.  POSIX says this is
726 	       implementation defined.  */
727 	    retval = "C";
728 	}
729     }
730 # endif
731 
732   return retval;
733 
734 #else /* WIN32 */
735 
736   /* Return an XPG style locale name language[_territory][@modifier].
737      Don't even bother determining the codeset; it's not useful in this
738      context, because message catalogs are not specific to a single
739      codeset.  */
740 
741   LCID lcid;
742   LANGID langid;
743   int primary, sub;
744 
745   /* Let the user override the system settings through environment
746      variables, as on POSIX systems.  */
747   retval = getenv ("LC_ALL");
748   if (retval != NULL && retval[0] != '\0')
749     return retval;
750   retval = getenv (categoryname);
751   if (retval != NULL && retval[0] != '\0')
752     return retval;
753   retval = getenv ("LANG");
754   if (retval != NULL && retval[0] != '\0')
755     return retval;
756 
757   /* Use native Win32 API locale ID.  */
758   lcid = GetThreadLocale ();
759 
760   /* Strip off the sorting rules, keep only the language part.  */
761   langid = LANGIDFROMLCID (lcid);
762 
763   /* Split into language and territory part.  */
764   primary = PRIMARYLANGID (langid);
765   sub = SUBLANGID (langid);
766 
767   /* Dispatch on language.
768      See also http://www.unicode.org/unicode/onlinedat/languages.html .
769      For details about languages, see http://www.ethnologue.com/ .  */
770   switch (primary)
771     {
772     case LANG_AFRIKAANS: return "af_ZA";
773     case LANG_ALBANIAN: return "sq_AL";
774     case LANG_AMHARIC: return "am_ET";
775     case LANG_ARABIC:
776       switch (sub)
777 	{
778 	case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA";
779 	case SUBLANG_ARABIC_IRAQ: return "ar_IQ";
780 	case SUBLANG_ARABIC_EGYPT: return "ar_EG";
781 	case SUBLANG_ARABIC_LIBYA: return "ar_LY";
782 	case SUBLANG_ARABIC_ALGERIA: return "ar_DZ";
783 	case SUBLANG_ARABIC_MOROCCO: return "ar_MA";
784 	case SUBLANG_ARABIC_TUNISIA: return "ar_TN";
785 	case SUBLANG_ARABIC_OMAN: return "ar_OM";
786 	case SUBLANG_ARABIC_YEMEN: return "ar_YE";
787 	case SUBLANG_ARABIC_SYRIA: return "ar_SY";
788 	case SUBLANG_ARABIC_JORDAN: return "ar_JO";
789 	case SUBLANG_ARABIC_LEBANON: return "ar_LB";
790 	case SUBLANG_ARABIC_KUWAIT: return "ar_KW";
791 	case SUBLANG_ARABIC_UAE: return "ar_AE";
792 	case SUBLANG_ARABIC_BAHRAIN: return "ar_BH";
793 	case SUBLANG_ARABIC_QATAR: return "ar_QA";
794 	}
795       return "ar";
796     case LANG_ARMENIAN: return "hy_AM";
797     case LANG_ASSAMESE: return "as_IN";
798     case LANG_AZERI:
799       switch (sub)
800 	{
801 	/* FIXME: Adjust this when Azerbaijani locales appear on Unix.  */
802 	case SUBLANG_AZERI_LATIN: return "az_AZ@latin";
803 	case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic";
804 	}
805       return "az";
806     case LANG_BASQUE:
807       return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR".  */
808     case LANG_BELARUSIAN: return "be_BY";
809     case LANG_BENGALI:
810       switch (sub)
811 	{
812 	case SUBLANG_BENGALI_INDIA: return "bn_IN";
813 	case SUBLANG_BENGALI_BANGLADESH: return "bn_BD";
814 	}
815       return "bn";
816     case LANG_BULGARIAN: return "bg_BG";
817     case LANG_BURMESE: return "my_MM";
818     case LANG_CAMBODIAN: return "km_KH";
819     case LANG_CATALAN: return "ca_ES";
820     case LANG_CHEROKEE: return "chr_US";
821     case LANG_CHINESE:
822       switch (sub)
823 	{
824 	case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW";
825 	case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN";
826 	case SUBLANG_CHINESE_HONGKONG: return "zh_HK";
827 	case SUBLANG_CHINESE_SINGAPORE: return "zh_SG";
828 	case SUBLANG_CHINESE_MACAU: return "zh_MO";
829 	}
830       return "zh";
831     case LANG_CROATIAN:		/* LANG_CROATIAN == LANG_SERBIAN
832 				 * What used to be called Serbo-Croatian
833 				 * should really now be two separate
834 				 * languages because of political reasons.
835 				 * (Says tml, who knows nothing about Serbian
836 				 * or Croatian.)
837 				 * (I can feel those flames coming already.)
838 				 */
839       switch (sub)
840 	{
841 	case SUBLANG_DEFAULT: return "hr_HR";
842 	case SUBLANG_SERBIAN_LATIN: return "sr_CS";
843 	case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic";
844 	}
845       return "hr";
846     case LANG_CZECH: return "cs_CZ";
847     case LANG_DANISH: return "da_DK";
848     case LANG_DIVEHI: return "dv_MV";
849     case LANG_DUTCH:
850       switch (sub)
851 	{
852 	case SUBLANG_DUTCH: return "nl_NL";
853 	case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE";
854 	}
855       return "nl";
856     case LANG_EDO: return "bin_NG";
857     case LANG_ENGLISH:
858       switch (sub)
859 	{
860 	/* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
861 	 * English was the language spoken in England.
862 	 * Oh well.
863 	 */
864 	case SUBLANG_ENGLISH_US: return "en_US";
865 	case SUBLANG_ENGLISH_UK: return "en_GB";
866 	case SUBLANG_ENGLISH_AUS: return "en_AU";
867 	case SUBLANG_ENGLISH_CAN: return "en_CA";
868 	case SUBLANG_ENGLISH_NZ: return "en_NZ";
869 	case SUBLANG_ENGLISH_EIRE: return "en_IE";
870 	case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA";
871 	case SUBLANG_ENGLISH_JAMAICA: return "en_JM";
872 	case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */
873 	case SUBLANG_ENGLISH_BELIZE: return "en_BZ";
874 	case SUBLANG_ENGLISH_TRINIDAD: return "en_TT";
875 	case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW";
876 	case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH";
877 	case SUBLANG_ENGLISH_INDONESIA: return "en_ID";
878 	case SUBLANG_ENGLISH_HONGKONG: return "en_HK";
879 	case SUBLANG_ENGLISH_INDIA: return "en_IN";
880 	case SUBLANG_ENGLISH_MALAYSIA: return "en_MY";
881 	case SUBLANG_ENGLISH_SINGAPORE: return "en_SG";
882 	}
883       return "en";
884     case LANG_ESTONIAN: return "et_EE";
885     case LANG_FAEROESE: return "fo_FO";
886     case LANG_FARSI: return "fa_IR";
887     case LANG_FINNISH: return "fi_FI";
888     case LANG_FRENCH:
889       switch (sub)
890 	{
891 	case SUBLANG_FRENCH: return "fr_FR";
892 	case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE";
893 	case SUBLANG_FRENCH_CANADIAN: return "fr_CA";
894 	case SUBLANG_FRENCH_SWISS: return "fr_CH";
895 	case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU";
896 	case SUBLANG_FRENCH_MONACO: return "fr_MC";
897 	case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */
898 	case SUBLANG_FRENCH_REUNION: return "fr_RE";
899 	case SUBLANG_FRENCH_CONGO: return "fr_CG";
900 	case SUBLANG_FRENCH_SENEGAL: return "fr_SN";
901 	case SUBLANG_FRENCH_CAMEROON: return "fr_CM";
902 	case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI";
903 	case SUBLANG_FRENCH_MALI: return "fr_ML";
904 	case SUBLANG_FRENCH_MOROCCO: return "fr_MA";
905 	case SUBLANG_FRENCH_HAITI: return "fr_HT";
906 	}
907       return "fr";
908     case LANG_FRISIAN: return "fy_NL";
909     case LANG_FULFULDE:
910       /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */
911       return "ff_NG";
912     case LANG_GAELIC:
913       switch (sub)
914 	{
915 	case 0x01: /* SCOTTISH */ return "gd_GB";
916 	case 0x02: /* IRISH */ return "ga_IE";
917 	}
918       return "C";
919     case LANG_GALICIAN: return "gl_ES";
920     case LANG_GEORGIAN: return "ka_GE";
921     case LANG_GERMAN:
922       switch (sub)
923 	{
924 	case SUBLANG_GERMAN: return "de_DE";
925 	case SUBLANG_GERMAN_SWISS: return "de_CH";
926 	case SUBLANG_GERMAN_AUSTRIAN: return "de_AT";
927 	case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU";
928 	case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI";
929 	}
930       return "de";
931     case LANG_GREEK: return "el_GR";
932     case LANG_GUARANI: return "gn_PY";
933     case LANG_GUJARATI: return "gu_IN";
934     case LANG_HAUSA: return "ha_NG";
935     case LANG_HAWAIIAN:
936       /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers)
937 	 or Hawaii Creole English ("cpe_US", 600000 speakers)?  */
938       return "cpe_US";
939     case LANG_HEBREW: return "he_IL";
940     case LANG_HINDI: return "hi_IN";
941     case LANG_HUNGARIAN: return "hu_HU";
942     case LANG_IBIBIO: return "nic_NG";
943     case LANG_ICELANDIC: return "is_IS";
944     case LANG_IGBO: return "ig_NG";
945     case LANG_INDONESIAN: return "id_ID";
946     case LANG_INUKTITUT: return "iu_CA";
947     case LANG_ITALIAN:
948       switch (sub)
949 	{
950 	case SUBLANG_ITALIAN: return "it_IT";
951 	case SUBLANG_ITALIAN_SWISS: return "it_CH";
952 	}
953       return "it";
954     case LANG_JAPANESE: return "ja_JP";
955     case LANG_KANNADA: return "kn_IN";
956     case LANG_KANURI: return "kr_NG";
957     case LANG_KASHMIRI:
958       switch (sub)
959 	{
960 	case SUBLANG_DEFAULT: return "ks_PK";
961 	case SUBLANG_KASHMIRI_INDIA: return "ks_IN";
962 	}
963       return "ks";
964     case LANG_KAZAK: return "kk_KZ";
965     case LANG_KONKANI:
966       /* FIXME: Adjust this when such locales appear on Unix.  */
967       return "kok_IN";
968     case LANG_KOREAN: return "ko_KR";
969     case LANG_KYRGYZ: return "ky_KG";
970     case LANG_LAO: return "lo_LA";
971     case LANG_LATIN: return "la_VA";
972     case LANG_LATVIAN: return "lv_LV";
973     case LANG_LITHUANIAN: return "lt_LT";
974     case LANG_MACEDONIAN: return "mk_MK";
975     case LANG_MALAY:
976       switch (sub)
977 	{
978 	case SUBLANG_MALAY_MALAYSIA: return "ms_MY";
979 	case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN";
980 	}
981       return "ms";
982     case LANG_MALAYALAM: return "ml_IN";
983     case LANG_MALTESE: return "mt_MT";
984     case LANG_MANIPURI:
985       /* FIXME: Adjust this when such locales appear on Unix.  */
986       return "mni_IN";
987     case LANG_MARATHI: return "mr_IN";
988     case LANG_MONGOLIAN:
989       return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN".  */
990     case LANG_NEPALI:
991       switch (sub)
992 	{
993 	case SUBLANG_DEFAULT: return "ne_NP";
994 	case SUBLANG_NEPALI_INDIA: return "ne_IN";
995 	}
996       return "ne";
997     case LANG_NORWEGIAN:
998       switch (sub)
999 	{
1000 	case SUBLANG_NORWEGIAN_BOKMAL: return "no_NO";
1001 	case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO";
1002 	}
1003       return "no";
1004     case LANG_ORIYA: return "or_IN";
1005     case LANG_OROMO: return "om_ET";
1006     case LANG_PAPIAMENTU: return "pap_AN";
1007     case LANG_PASHTO:
1008       return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF".  */
1009     case LANG_POLISH: return "pl_PL";
1010     case LANG_PORTUGUESE:
1011       switch (sub)
1012 	{
1013 	case SUBLANG_PORTUGUESE: return "pt_PT";
1014 	/* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
1015 	   Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
1016 	case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR";
1017 	}
1018       return "pt";
1019     case LANG_PUNJABI:
1020       switch (sub)
1021 	{
1022 	case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */
1023 	case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */
1024 	}
1025       return "pa";
1026     case LANG_RHAETO_ROMANCE: return "rm_CH";
1027     case LANG_ROMANIAN:
1028       switch (sub)
1029 	{
1030 	case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO";
1031 	case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD";
1032 	}
1033       return "ro";
1034     case LANG_RUSSIAN:
1035       return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD".  */
1036     case LANG_SAAMI: /* actually Northern Sami */ return "se_NO";
1037     case LANG_SANSKRIT: return "sa_IN";
1038     case LANG_SINDHI:
1039       switch (sub)
1040 	{
1041 	case SUBLANG_SINDHI_INDIA: return "sd_IN";
1042 	case SUBLANG_SINDHI_PAKISTAN: return "sd_PK";
1043 	}
1044       return "sd";
1045     case LANG_SINHALESE: return "si_LK";
1046     case LANG_SLOVAK: return "sk_SK";
1047     case LANG_SLOVENIAN: return "sl_SI";
1048     case LANG_SOMALI: return "so_SO";
1049     case LANG_SORBIAN:
1050       /* FIXME: Adjust this when such locales appear on Unix.  */
1051       return "wen_DE";
1052     case LANG_SPANISH:
1053       switch (sub)
1054 	{
1055 	case SUBLANG_SPANISH: return "es_ES";
1056 	case SUBLANG_SPANISH_MEXICAN: return "es_MX";
1057 	case SUBLANG_SPANISH_MODERN:
1058 	  return "es_ES@modern";	/* not seen on Unix */
1059 	case SUBLANG_SPANISH_GUATEMALA: return "es_GT";
1060 	case SUBLANG_SPANISH_COSTA_RICA: return "es_CR";
1061 	case SUBLANG_SPANISH_PANAMA: return "es_PA";
1062 	case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO";
1063 	case SUBLANG_SPANISH_VENEZUELA: return "es_VE";
1064 	case SUBLANG_SPANISH_COLOMBIA: return "es_CO";
1065 	case SUBLANG_SPANISH_PERU: return "es_PE";
1066 	case SUBLANG_SPANISH_ARGENTINA: return "es_AR";
1067 	case SUBLANG_SPANISH_ECUADOR: return "es_EC";
1068 	case SUBLANG_SPANISH_CHILE: return "es_CL";
1069 	case SUBLANG_SPANISH_URUGUAY: return "es_UY";
1070 	case SUBLANG_SPANISH_PARAGUAY: return "es_PY";
1071 	case SUBLANG_SPANISH_BOLIVIA: return "es_BO";
1072 	case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV";
1073 	case SUBLANG_SPANISH_HONDURAS: return "es_HN";
1074 	case SUBLANG_SPANISH_NICARAGUA: return "es_NI";
1075 	case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR";
1076 	}
1077       return "es";
1078     case LANG_SUTU: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */
1079     case LANG_SWAHILI: return "sw_KE";
1080     case LANG_SWEDISH:
1081       switch (sub)
1082 	{
1083 	case SUBLANG_DEFAULT: return "sv_SE";
1084 	case SUBLANG_SWEDISH_FINLAND: return "sv_FI";
1085 	}
1086       return "sv";
1087     case LANG_SYRIAC: return "syr_TR"; /* An extinct language.  */
1088     case LANG_TAGALOG: return "tl_PH";
1089     case LANG_TAJIK: return "tg_TJ";
1090     case LANG_TAMAZIGHT:
1091       switch (sub)
1092 	{
1093 	/* FIXME: Adjust this when Tamazight locales appear on Unix.  */
1094 	case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic";
1095 	case SUBLANG_TAMAZIGHT_LATIN: return "ber_MA@latin";
1096 	}
1097       return "ber_MA";
1098     case LANG_TAMIL:
1099       return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG".  */
1100     case LANG_TATAR: return "tt_RU";
1101     case LANG_TELUGU: return "te_IN";
1102     case LANG_THAI: return "th_TH";
1103     case LANG_TIBETAN: return "bo_CN";
1104     case LANG_TIGRINYA:
1105       switch (sub)
1106 	{
1107 	case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET";
1108 	case SUBLANG_TIGRINYA_ERITREA: return "ti_ER";
1109 	}
1110       return "ti";
1111     case LANG_TSONGA: return "ts_ZA";
1112     case LANG_TSWANA: return "tn_BW";
1113     case LANG_TURKISH: return "tr_TR";
1114     case LANG_TURKMEN: return "tk_TM";
1115     case LANG_UKRAINIAN: return "uk_UA";
1116     case LANG_URDU:
1117       switch (sub)
1118 	{
1119 	case SUBLANG_URDU_PAKISTAN: return "ur_PK";
1120 	case SUBLANG_URDU_INDIA: return "ur_IN";
1121 	}
1122       return "ur";
1123     case LANG_UZBEK:
1124       switch (sub)
1125 	{
1126 	case SUBLANG_UZBEK_LATIN: return "uz_UZ";
1127 	case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic";
1128 	}
1129       return "uz";
1130     case LANG_VENDA: return "ve_ZA";
1131     case LANG_VIETNAMESE: return "vi_VN";
1132     case LANG_WELSH: return "cy_GB";
1133     case LANG_XHOSA: return "xh_ZA";
1134     case LANG_YI: return "sit_CN";
1135     case LANG_YIDDISH: return "yi_IL";
1136     case LANG_YORUBA: return "yo_NG";
1137     case LANG_ZULU: return "zu_ZA";
1138     default: return "C";
1139     }
1140 
1141 #endif
1142 }
1143