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