1 /* Determine the current selected locale.
2 Copyright (C) 1995-1999, 2000-2002 Free Software Foundation, Inc.
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)
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.
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., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301,
19 /* Written by Ulrich Drepper <drepper@gnu.org>, 1995. */
20 /* Win32 code written by Tor Lillqvist <tml@iki.fi>. */
29 #if defined _WIN32 || defined __WIN32__
30 # undef WIN32 /* avoid warning on mingw32 */
35 # define WIN32_LEAN_AND_MEAN
37 /* Mingw headers don't have latest language and sublanguage codes. */
38 # ifndef LANG_AFRIKAANS
39 # define LANG_AFRIKAANS 0x36
41 # ifndef LANG_ALBANIAN
42 # define LANG_ALBANIAN 0x1c
45 # define LANG_ARABIC 0x01
47 # ifndef LANG_ARMENIAN
48 # define LANG_ARMENIAN 0x2b
50 # ifndef LANG_ASSAMESE
51 # define LANG_ASSAMESE 0x4d
54 # define LANG_AZERI 0x2c
57 # define LANG_BASQUE 0x2d
59 # ifndef LANG_BELARUSIAN
60 # define LANG_BELARUSIAN 0x23
63 # define LANG_BENGALI 0x45
66 # define LANG_CATALAN 0x03
69 # define LANG_DIVEHI 0x65
71 # ifndef LANG_ESTONIAN
72 # define LANG_ESTONIAN 0x25
74 # ifndef LANG_FAEROESE
75 # define LANG_FAEROESE 0x38
78 # define LANG_FARSI 0x29
80 # ifndef LANG_GALICIAN
81 # define LANG_GALICIAN 0x56
83 # ifndef LANG_GEORGIAN
84 # define LANG_GEORGIAN 0x37
86 # ifndef LANG_GUJARATI
87 # define LANG_GUJARATI 0x47
90 # define LANG_HEBREW 0x0d
93 # define LANG_HINDI 0x39
95 # ifndef LANG_INDONESIAN
96 # define LANG_INDONESIAN 0x21
99 # define LANG_KANNADA 0x4b
101 # ifndef LANG_KASHMIRI
102 # define LANG_KASHMIRI 0x60
105 # define LANG_KAZAK 0x3f
107 # ifndef LANG_KONKANI
108 # define LANG_KONKANI 0x57
111 # define LANG_KYRGYZ 0x40
113 # ifndef LANG_LATVIAN
114 # define LANG_LATVIAN 0x26
116 # ifndef LANG_LITHUANIAN
117 # define LANG_LITHUANIAN 0x27
119 # ifndef LANG_MACEDONIAN
120 # define LANG_MACEDONIAN 0x2f
123 # define LANG_MALAY 0x3e
125 # ifndef LANG_MALAYALAM
126 # define LANG_MALAYALAM 0x4c
128 # ifndef LANG_MANIPURI
129 # define LANG_MANIPURI 0x58
131 # ifndef LANG_MARATHI
132 # define LANG_MARATHI 0x4e
134 # ifndef LANG_MONGOLIAN
135 # define LANG_MONGOLIAN 0x50
138 # define LANG_NEPALI 0x61
141 # define LANG_ORIYA 0x48
143 # ifndef LANG_PUNJABI
144 # define LANG_PUNJABI 0x46
146 # ifndef LANG_SANSKRIT
147 # define LANG_SANSKRIT 0x4f
149 # ifndef LANG_SERBIAN
150 # define LANG_SERBIAN 0x1a
153 # define LANG_SINDHI 0x59
156 # define LANG_SLOVAK 0x1b
158 # ifndef LANG_SORBIAN
159 # define LANG_SORBIAN 0x2e
161 # ifndef LANG_SWAHILI
162 # define LANG_SWAHILI 0x41
165 # define LANG_SYRIAC 0x5a
168 # define LANG_TAMIL 0x49
171 # define LANG_TATAR 0x44
174 # define LANG_TELUGU 0x4a
177 # define LANG_THAI 0x1e
179 # ifndef LANG_UKRAINIAN
180 # define LANG_UKRAINIAN 0x22
183 # define LANG_URDU 0x20
186 # define LANG_UZBEK 0x43
188 # ifndef LANG_VIETNAMESE
189 # define LANG_VIETNAMESE 0x2a
191 # ifndef SUBLANG_ARABIC_SAUDI_ARABIA
192 # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
194 # ifndef SUBLANG_ARABIC_IRAQ
195 # define SUBLANG_ARABIC_IRAQ 0x02
197 # ifndef SUBLANG_ARABIC_EGYPT
198 # define SUBLANG_ARABIC_EGYPT 0x03
200 # ifndef SUBLANG_ARABIC_LIBYA
201 # define SUBLANG_ARABIC_LIBYA 0x04
203 # ifndef SUBLANG_ARABIC_ALGERIA
204 # define SUBLANG_ARABIC_ALGERIA 0x05
206 # ifndef SUBLANG_ARABIC_MOROCCO
207 # define SUBLANG_ARABIC_MOROCCO 0x06
209 # ifndef SUBLANG_ARABIC_TUNISIA
210 # define SUBLANG_ARABIC_TUNISIA 0x07
212 # ifndef SUBLANG_ARABIC_OMAN
213 # define SUBLANG_ARABIC_OMAN 0x08
215 # ifndef SUBLANG_ARABIC_YEMEN
216 # define SUBLANG_ARABIC_YEMEN 0x09
218 # ifndef SUBLANG_ARABIC_SYRIA
219 # define SUBLANG_ARABIC_SYRIA 0x0a
221 # ifndef SUBLANG_ARABIC_JORDAN
222 # define SUBLANG_ARABIC_JORDAN 0x0b
224 # ifndef SUBLANG_ARABIC_LEBANON
225 # define SUBLANG_ARABIC_LEBANON 0x0c
227 # ifndef SUBLANG_ARABIC_KUWAIT
228 # define SUBLANG_ARABIC_KUWAIT 0x0d
230 # ifndef SUBLANG_ARABIC_UAE
231 # define SUBLANG_ARABIC_UAE 0x0e
233 # ifndef SUBLANG_ARABIC_BAHRAIN
234 # define SUBLANG_ARABIC_BAHRAIN 0x0f
236 # ifndef SUBLANG_ARABIC_QATAR
237 # define SUBLANG_ARABIC_QATAR 0x10
239 # ifndef SUBLANG_AZERI_LATIN
240 # define SUBLANG_AZERI_LATIN 0x01
242 # ifndef SUBLANG_AZERI_CYRILLIC
243 # define SUBLANG_AZERI_CYRILLIC 0x02
245 # ifndef SUBLANG_CHINESE_MACAU
246 # define SUBLANG_CHINESE_MACAU 0x05
248 # ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
249 # define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
251 # ifndef SUBLANG_ENGLISH_JAMAICA
252 # define SUBLANG_ENGLISH_JAMAICA 0x08
254 # ifndef SUBLANG_ENGLISH_CARIBBEAN
255 # define SUBLANG_ENGLISH_CARIBBEAN 0x09
257 # ifndef SUBLANG_ENGLISH_BELIZE
258 # define SUBLANG_ENGLISH_BELIZE 0x0a
260 # ifndef SUBLANG_ENGLISH_TRINIDAD
261 # define SUBLANG_ENGLISH_TRINIDAD 0x0b
263 # ifndef SUBLANG_ENGLISH_ZIMBABWE
264 # define SUBLANG_ENGLISH_ZIMBABWE 0x0c
266 # ifndef SUBLANG_ENGLISH_PHILIPPINES
267 # define SUBLANG_ENGLISH_PHILIPPINES 0x0d
269 # ifndef SUBLANG_FRENCH_LUXEMBOURG
270 # define SUBLANG_FRENCH_LUXEMBOURG 0x05
272 # ifndef SUBLANG_FRENCH_MONACO
273 # define SUBLANG_FRENCH_MONACO 0x06
275 # ifndef SUBLANG_GERMAN_LUXEMBOURG
276 # define SUBLANG_GERMAN_LUXEMBOURG 0x04
278 # ifndef SUBLANG_GERMAN_LIECHTENSTEIN
279 # define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
281 # ifndef SUBLANG_KASHMIRI_INDIA
282 # define SUBLANG_KASHMIRI_INDIA 0x02
284 # ifndef SUBLANG_MALAY_MALAYSIA
285 # define SUBLANG_MALAY_MALAYSIA 0x01
287 # ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
288 # define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
290 # ifndef SUBLANG_NEPALI_INDIA
291 # define SUBLANG_NEPALI_INDIA 0x02
293 # ifndef SUBLANG_SERBIAN_LATIN
294 # define SUBLANG_SERBIAN_LATIN 0x02
296 # ifndef SUBLANG_SERBIAN_CYRILLIC
297 # define SUBLANG_SERBIAN_CYRILLIC 0x03
299 # ifndef SUBLANG_SPANISH_GUATEMALA
300 # define SUBLANG_SPANISH_GUATEMALA 0x04
302 # ifndef SUBLANG_SPANISH_COSTA_RICA
303 # define SUBLANG_SPANISH_COSTA_RICA 0x05
305 # ifndef SUBLANG_SPANISH_PANAMA
306 # define SUBLANG_SPANISH_PANAMA 0x06
308 # ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
309 # define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
311 # ifndef SUBLANG_SPANISH_VENEZUELA
312 # define SUBLANG_SPANISH_VENEZUELA 0x08
314 # ifndef SUBLANG_SPANISH_COLOMBIA
315 # define SUBLANG_SPANISH_COLOMBIA 0x09
317 # ifndef SUBLANG_SPANISH_PERU
318 # define SUBLANG_SPANISH_PERU 0x0a
320 # ifndef SUBLANG_SPANISH_ARGENTINA
321 # define SUBLANG_SPANISH_ARGENTINA 0x0b
323 # ifndef SUBLANG_SPANISH_ECUADOR
324 # define SUBLANG_SPANISH_ECUADOR 0x0c
326 # ifndef SUBLANG_SPANISH_CHILE
327 # define SUBLANG_SPANISH_CHILE 0x0d
329 # ifndef SUBLANG_SPANISH_URUGUAY
330 # define SUBLANG_SPANISH_URUGUAY 0x0e
332 # ifndef SUBLANG_SPANISH_PARAGUAY
333 # define SUBLANG_SPANISH_PARAGUAY 0x0f
335 # ifndef SUBLANG_SPANISH_BOLIVIA
336 # define SUBLANG_SPANISH_BOLIVIA 0x10
338 # ifndef SUBLANG_SPANISH_EL_SALVADOR
339 # define SUBLANG_SPANISH_EL_SALVADOR 0x11
341 # ifndef SUBLANG_SPANISH_HONDURAS
342 # define SUBLANG_SPANISH_HONDURAS 0x12
344 # ifndef SUBLANG_SPANISH_NICARAGUA
345 # define SUBLANG_SPANISH_NICARAGUA 0x13
347 # ifndef SUBLANG_SPANISH_PUERTO_RICO
348 # define SUBLANG_SPANISH_PUERTO_RICO 0x14
350 # ifndef SUBLANG_SWEDISH_FINLAND
351 # define SUBLANG_SWEDISH_FINLAND 0x02
353 # ifndef SUBLANG_URDU_PAKISTAN
354 # define SUBLANG_URDU_PAKISTAN 0x01
356 # ifndef SUBLANG_URDU_INDIA
357 # define SUBLANG_URDU_INDIA 0x02
359 # ifndef SUBLANG_UZBEK_LATIN
360 # define SUBLANG_UZBEK_LATIN 0x01
362 # ifndef SUBLANG_UZBEK_CYRILLIC
363 # define SUBLANG_UZBEK_CYRILLIC 0x02
367 /* XPG3 defines the result of 'setlocale (category, NULL)' as:
368 "Directs 'setlocale()' to query 'category' and return the current
370 However it does not specify the exact format. Neither do SUSV2 and
371 ISO C 99. So we can use this feature only on selected systems (e.g.
372 those using GNU C Library). */
373 #if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
374 # define HAVE_LOCALE_NULL
377 /* Determine the current locale's name, and canonicalize it into XPG syntax
378 language[_territory[.codeset]][@modifier]
379 The codeset part in the result is not reliable; the locale_charset()
380 should be used for codeset information instead.
381 The result must not be freed; it is statically allocated. */
384 _nl_locale_name (category
, categoryname
)
386 const char *categoryname
;
392 /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
393 On some systems this can be done by the 'setlocale' function itself. */
394 # if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
395 retval
= setlocale (category
, NULL
);
397 /* Setting of LC_ALL overwrites all other. */
398 retval
= getenv ("LC_ALL");
399 if (retval
== NULL
|| retval
[0] == '\0')
401 /* Next comes the name of the desired category. */
402 retval
= getenv (categoryname
);
403 if (retval
== NULL
|| retval
[0] == '\0')
405 /* Last possibility is the LANG environment variable. */
406 retval
= getenv ("LANG");
407 if (retval
== NULL
|| retval
[0] == '\0')
408 /* We use C as the default domain. POSIX says this is
409 implementation defined. */
419 /* Return an XPG style locale name language[_territory][@modifier].
420 Don't even bother determining the codeset; it's not useful in this
421 context, because message catalogs are not specific to a single
428 /* Let the user override the system settings through environment
429 variables, as on POSIX systems. */
430 retval
= getenv ("LC_ALL");
431 if (retval
!= NULL
&& retval
[0] != '\0')
433 retval
= getenv (categoryname
);
434 if (retval
!= NULL
&& retval
[0] != '\0')
436 retval
= getenv ("LANG");
437 if (retval
!= NULL
&& retval
[0] != '\0')
440 /* Use native Win32 API locale ID. */
441 lcid
= GetThreadLocale ();
443 /* Strip off the sorting rules, keep only the language part. */
444 langid
= LANGIDFROMLCID (lcid
);
446 /* Split into language and territory part. */
447 primary
= PRIMARYLANGID (langid
);
448 sub
= SUBLANGID (langid
);
450 /* Dispatch on language.
451 See also http://www.unicode.org/unicode/onlinedat/languages.html .
452 For details about languages, see http://www.ethnologue.com/ . */
455 case LANG_AFRIKAANS
: return "af_ZA";
456 case LANG_ALBANIAN
: return "sq_AL";
457 case 0x5e: /* AMHARIC */ return "am_ET";
461 case SUBLANG_ARABIC_SAUDI_ARABIA
: return "ar_SA";
462 case SUBLANG_ARABIC_IRAQ
: return "ar_IQ";
463 case SUBLANG_ARABIC_EGYPT
: return "ar_EG";
464 case SUBLANG_ARABIC_LIBYA
: return "ar_LY";
465 case SUBLANG_ARABIC_ALGERIA
: return "ar_DZ";
466 case SUBLANG_ARABIC_MOROCCO
: return "ar_MA";
467 case SUBLANG_ARABIC_TUNISIA
: return "ar_TN";
468 case SUBLANG_ARABIC_OMAN
: return "ar_OM";
469 case SUBLANG_ARABIC_YEMEN
: return "ar_YE";
470 case SUBLANG_ARABIC_SYRIA
: return "ar_SY";
471 case SUBLANG_ARABIC_JORDAN
: return "ar_JO";
472 case SUBLANG_ARABIC_LEBANON
: return "ar_LB";
473 case SUBLANG_ARABIC_KUWAIT
: return "ar_KW";
474 case SUBLANG_ARABIC_UAE
: return "ar_AE";
475 case SUBLANG_ARABIC_BAHRAIN
: return "ar_BH";
476 case SUBLANG_ARABIC_QATAR
: return "ar_QA";
479 case LANG_ARMENIAN
: return "hy_AM";
480 case LANG_ASSAMESE
: return "as_IN";
484 /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */
485 case SUBLANG_AZERI_LATIN
: return "az_AZ@latin";
486 case SUBLANG_AZERI_CYRILLIC
: return "az_AZ@cyrillic";
490 return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */
491 case LANG_BELARUSIAN
: return "be_BY";
492 case LANG_BENGALI
: return "bn_IN";
493 case LANG_BULGARIAN
: return "bg_BG";
494 case 0x55: /* BURMESE */ return "my_MM";
495 case 0x53: /* CAMBODIAN */ return "km_KH";
496 case LANG_CATALAN
: return "ca_ES";
497 case 0x5c: /* CHEROKEE */ return "chr_US";
501 case SUBLANG_CHINESE_TRADITIONAL
: return "zh_TW";
502 case SUBLANG_CHINESE_SIMPLIFIED
: return "zh_CN";
503 case SUBLANG_CHINESE_HONGKONG
: return "zh_HK";
504 case SUBLANG_CHINESE_SINGAPORE
: return "zh_SG";
505 case SUBLANG_CHINESE_MACAU
: return "zh_MO";
508 case LANG_CROATIAN
: /* LANG_CROATIAN == LANG_SERBIAN
509 * What used to be called Serbo-Croatian
510 * should really now be two separate
511 * languages because of political reasons.
512 * (Says tml, who knows nothing about Serbian
514 * (I can feel those flames coming already.)
518 case SUBLANG_DEFAULT
: return "hr_HR";
519 case SUBLANG_SERBIAN_LATIN
: return "sr_YU";
520 case SUBLANG_SERBIAN_CYRILLIC
: return "sr_YU@cyrillic";
523 case LANG_CZECH
: return "cs_CZ";
524 case LANG_DANISH
: return "da_DK";
525 case LANG_DIVEHI
: return "div_MV";
529 case SUBLANG_DUTCH
: return "nl_NL";
530 case SUBLANG_DUTCH_BELGIAN
: /* FLEMISH, VLAAMS */ return "nl_BE";
533 case 0x66: /* EDO */ return "bin_NG";
537 /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
538 * English was the language spoken in England.
541 case SUBLANG_ENGLISH_US
: return "en_US";
542 case SUBLANG_ENGLISH_UK
: return "en_GB";
543 case SUBLANG_ENGLISH_AUS
: return "en_AU";
544 case SUBLANG_ENGLISH_CAN
: return "en_CA";
545 case SUBLANG_ENGLISH_NZ
: return "en_NZ";
546 case SUBLANG_ENGLISH_EIRE
: return "en_IE";
547 case SUBLANG_ENGLISH_SOUTH_AFRICA
: return "en_ZA";
548 case SUBLANG_ENGLISH_JAMAICA
: return "en_JM";
549 case SUBLANG_ENGLISH_CARIBBEAN
: return "en_GD"; /* Grenada? */
550 case SUBLANG_ENGLISH_BELIZE
: return "en_BZ";
551 case SUBLANG_ENGLISH_TRINIDAD
: return "en_TT";
552 case SUBLANG_ENGLISH_ZIMBABWE
: return "en_ZW";
553 case SUBLANG_ENGLISH_PHILIPPINES
: return "en_PH";
556 case LANG_ESTONIAN
: return "et_EE";
557 case LANG_FAEROESE
: return "fo_FO";
558 case LANG_FARSI
: return "fa_IR";
559 case LANG_FINNISH
: return "fi_FI";
563 case SUBLANG_FRENCH
: return "fr_FR";
564 case SUBLANG_FRENCH_BELGIAN
: /* WALLOON */ return "fr_BE";
565 case SUBLANG_FRENCH_CANADIAN
: return "fr_CA";
566 case SUBLANG_FRENCH_SWISS
: return "fr_CH";
567 case SUBLANG_FRENCH_LUXEMBOURG
: return "fr_LU";
568 case SUBLANG_FRENCH_MONACO
: return "fr_MC";
571 case 0x62: /* FRISIAN */ return "fy_NL";
572 case 0x67: /* FULFULDE */ return "ful_NG";
573 case 0x3c: /* GAELIC */
576 case 0x01: /* SCOTTISH */ return "gd_GB";
577 case 0x02: /* IRISH */ return "ga_IE";
580 case LANG_GALICIAN
: return "gl_ES";
581 case LANG_GEORGIAN
: return "ka_GE";
585 case SUBLANG_GERMAN
: return "de_DE";
586 case SUBLANG_GERMAN_SWISS
: return "de_CH";
587 case SUBLANG_GERMAN_AUSTRIAN
: return "de_AT";
588 case SUBLANG_GERMAN_LUXEMBOURG
: return "de_LU";
589 case SUBLANG_GERMAN_LIECHTENSTEIN
: return "de_LI";
592 case LANG_GREEK
: return "el_GR";
593 case 0x74: /* GUARANI */ return "gn_PY";
594 case LANG_GUJARATI
: return "gu_IN";
595 case 0x68: /* HAUSA */ return "ha_NG";
596 case 0x75: /* HAWAIIAN */
597 /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers)
598 or Hawaii Creole English ("cpe_US", 600000 speakers)? */
600 case LANG_HEBREW
: return "he_IL";
601 case LANG_HINDI
: return "hi_IN";
602 case LANG_HUNGARIAN
: return "hu_HU";
603 case 0x69: /* IBIBIO */ return "nic_NG";
604 case LANG_ICELANDIC
: return "is_IS";
605 case 0x70: /* IGBO */ return "ibo_NG";
606 case LANG_INDONESIAN
: return "id_ID";
607 case 0x5d: /* INUKTITUT */ return "iu_CA";
611 case SUBLANG_ITALIAN
: return "it_IT";
612 case SUBLANG_ITALIAN_SWISS
: return "it_CH";
615 case LANG_JAPANESE
: return "ja_JP";
616 case LANG_KANNADA
: return "kn_IN";
617 case 0x71: /* KANURI */ return "kau_NG";
621 case SUBLANG_DEFAULT
: return "ks_PK";
622 case SUBLANG_KASHMIRI_INDIA
: return "ks_IN";
625 case LANG_KAZAK
: return "kk_KZ";
627 /* FIXME: Adjust this when such locales appear on Unix. */
629 case LANG_KOREAN
: return "ko_KR";
630 case LANG_KYRGYZ
: return "ky_KG";
631 case 0x54: /* LAO */ return "lo_LA";
632 case 0x76: /* LATIN */ return "la_VA";
633 case LANG_LATVIAN
: return "lv_LV";
634 case LANG_LITHUANIAN
: return "lt_LT";
635 case LANG_MACEDONIAN
: return "mk_MK";
639 case SUBLANG_MALAY_MALAYSIA
: return "ms_MY";
640 case SUBLANG_MALAY_BRUNEI_DARUSSALAM
: return "ms_BN";
643 case LANG_MALAYALAM
: return "ml_IN";
644 case 0x3a: /* MALTESE */ return "mt_MT";
646 /* FIXME: Adjust this when such locales appear on Unix. */
648 case LANG_MARATHI
: return "mr_IN";
650 return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */
654 case SUBLANG_DEFAULT
: return "ne_NP";
655 case SUBLANG_NEPALI_INDIA
: return "ne_IN";
661 case SUBLANG_NORWEGIAN_BOKMAL
: return "no_NO";
662 case SUBLANG_NORWEGIAN_NYNORSK
: return "nn_NO";
665 case LANG_ORIYA
: return "or_IN";
666 case 0x72: /* OROMO */ return "om_ET";
667 case 0x79: /* PAPIAMENTU */ return "pap_AN";
668 case 0x63: /* PASHTO */
669 return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */
670 case LANG_POLISH
: return "pl_PL";
671 case LANG_PORTUGUESE
:
674 case SUBLANG_PORTUGUESE
: return "pt_PT";
675 /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
676 Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
677 case SUBLANG_PORTUGUESE_BRAZILIAN
: return "pt_BR";
680 case LANG_PUNJABI
: return "pa_IN";
681 case 0x17: /* RHAETO-ROMANCE */ return "rm_CH";
682 case LANG_ROMANIAN
: return "ro_RO";
684 return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA". */
685 case 0x3b: /* SAMI */ return "se_NO";
686 case LANG_SANSKRIT
: return "sa_IN";
687 case LANG_SINDHI
: return "sd";
688 case 0x5b: /* SINHALESE */ return "si_LK";
689 case LANG_SLOVAK
: return "sk_SK";
690 case LANG_SLOVENIAN
: return "sl_SI";
691 case 0x77: /* SOMALI */ return "so_SO";
693 /* FIXME: Adjust this when such locales appear on Unix. */
698 case SUBLANG_SPANISH
: return "es_ES";
699 case SUBLANG_SPANISH_MEXICAN
: return "es_MX";
700 case SUBLANG_SPANISH_MODERN
:
701 return "es_ES@modern"; /* not seen on Unix */
702 case SUBLANG_SPANISH_GUATEMALA
: return "es_GT";
703 case SUBLANG_SPANISH_COSTA_RICA
: return "es_CR";
704 case SUBLANG_SPANISH_PANAMA
: return "es_PA";
705 case SUBLANG_SPANISH_DOMINICAN_REPUBLIC
: return "es_DO";
706 case SUBLANG_SPANISH_VENEZUELA
: return "es_VE";
707 case SUBLANG_SPANISH_COLOMBIA
: return "es_CO";
708 case SUBLANG_SPANISH_PERU
: return "es_PE";
709 case SUBLANG_SPANISH_ARGENTINA
: return "es_AR";
710 case SUBLANG_SPANISH_ECUADOR
: return "es_EC";
711 case SUBLANG_SPANISH_CHILE
: return "es_CL";
712 case SUBLANG_SPANISH_URUGUAY
: return "es_UY";
713 case SUBLANG_SPANISH_PARAGUAY
: return "es_PY";
714 case SUBLANG_SPANISH_BOLIVIA
: return "es_BO";
715 case SUBLANG_SPANISH_EL_SALVADOR
: return "es_SV";
716 case SUBLANG_SPANISH_HONDURAS
: return "es_HN";
717 case SUBLANG_SPANISH_NICARAGUA
: return "es_NI";
718 case SUBLANG_SPANISH_PUERTO_RICO
: return "es_PR";
721 case 0x30: /* SUTU */ return "bnt_TZ";
722 case LANG_SWAHILI
: return "sw_KE";
726 case SUBLANG_DEFAULT
: return "sv_SE";
727 case SUBLANG_SWEDISH_FINLAND
: return "sv_FI";
730 case LANG_SYRIAC
: return "syr_TR"; /* An extinct language. */
731 case 0x64: /* TAGALOG */ return "tl_PH";
732 case 0x28: /* TAJIK */ return "tg_TJ";
733 case 0x5f: /* TAMAZIGHT */ return "ber_MA";
735 return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */
736 case LANG_TATAR
: return "tt_RU";
737 case LANG_TELUGU
: return "te_IN";
738 case LANG_THAI
: return "th_TH";
739 case 0x51: /* TIBETAN */ return "bo_CN";
740 case 0x73: /* TIGRINYA */ return "ti_ET";
741 case 0x31: /* TSONGA */ return "ts_ZA";
742 case LANG_TURKISH
: return "tr_TR";
743 case 0x42: /* TURKMEN */ return "tk_TM";
744 case LANG_UKRAINIAN
: return "uk_UA";
748 case SUBLANG_URDU_PAKISTAN
: return "ur_PK";
749 case SUBLANG_URDU_INDIA
: return "ur_IN";
755 /* FIXME: Adjust this when Uzbek locales appear on Unix. */
756 case SUBLANG_UZBEK_LATIN
: return "uz_UZ@latin";
757 case SUBLANG_UZBEK_CYRILLIC
: return "uz_UZ@cyrillic";
760 case 0x33: /* VENDA */ return "ven_ZA";
761 case LANG_VIETNAMESE
: return "vi_VN";
762 case 0x52: /* WELSH */ return "cy_GB";
763 case 0x34: /* XHOSA */ return "xh_ZA";
764 case 0x78: /* YI */ return "sit_CN";
765 case 0x3d: /* YIDDISH */ return "yi_IL";
766 case 0x6a: /* YORUBA */ return "yo_NG";
767 case 0x35: /* ZULU */ return "zu_ZA";