1 /* localename.c - Determine the current selected locale. */
3 /* Copyright (C) 1995-1999, 2000-2002, 2005-2009 Free Software Foundation, Inc.
5 This file is part of GNU Bash.
7 Bash is free software: you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation, either version 3 of the License, or
10 (at your option) any later version.
12 Bash is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with Bash. If not, see <http://www.gnu.org/licenses/>.
21 /* Written by Ulrich Drepper <drepper@gnu.org>, 1995. */
22 /* Win32 code written by Tor Lillqvist <tml@iki.fi>. */
31 #if defined _WIN32 || defined __WIN32__
32 # undef WIN32 /* avoid warning on mingw32 */
37 # define WIN32_LEAN_AND_MEAN
39 /* Mingw headers don't have latest language and sublanguage codes. */
40 # ifndef LANG_AFRIKAANS
41 # define LANG_AFRIKAANS 0x36
43 # ifndef LANG_ALBANIAN
44 # define LANG_ALBANIAN 0x1c
47 # define LANG_ARABIC 0x01
49 # ifndef LANG_ARMENIAN
50 # define LANG_ARMENIAN 0x2b
52 # ifndef LANG_ASSAMESE
53 # define LANG_ASSAMESE 0x4d
56 # define LANG_AZERI 0x2c
59 # define LANG_BASQUE 0x2d
61 # ifndef LANG_BELARUSIAN
62 # define LANG_BELARUSIAN 0x23
65 # define LANG_BENGALI 0x45
68 # define LANG_CATALAN 0x03
71 # define LANG_DIVEHI 0x65
73 # ifndef LANG_ESTONIAN
74 # define LANG_ESTONIAN 0x25
76 # ifndef LANG_FAEROESE
77 # define LANG_FAEROESE 0x38
80 # define LANG_FARSI 0x29
82 # ifndef LANG_GALICIAN
83 # define LANG_GALICIAN 0x56
85 # ifndef LANG_GEORGIAN
86 # define LANG_GEORGIAN 0x37
88 # ifndef LANG_GUJARATI
89 # define LANG_GUJARATI 0x47
92 # define LANG_HEBREW 0x0d
95 # define LANG_HINDI 0x39
97 # ifndef LANG_INDONESIAN
98 # define LANG_INDONESIAN 0x21
100 # ifndef LANG_KANNADA
101 # define LANG_KANNADA 0x4b
103 # ifndef LANG_KASHMIRI
104 # define LANG_KASHMIRI 0x60
107 # define LANG_KAZAK 0x3f
109 # ifndef LANG_KONKANI
110 # define LANG_KONKANI 0x57
113 # define LANG_KYRGYZ 0x40
115 # ifndef LANG_LATVIAN
116 # define LANG_LATVIAN 0x26
118 # ifndef LANG_LITHUANIAN
119 # define LANG_LITHUANIAN 0x27
121 # ifndef LANG_MACEDONIAN
122 # define LANG_MACEDONIAN 0x2f
125 # define LANG_MALAY 0x3e
127 # ifndef LANG_MALAYALAM
128 # define LANG_MALAYALAM 0x4c
130 # ifndef LANG_MANIPURI
131 # define LANG_MANIPURI 0x58
133 # ifndef LANG_MARATHI
134 # define LANG_MARATHI 0x4e
136 # ifndef LANG_MONGOLIAN
137 # define LANG_MONGOLIAN 0x50
140 # define LANG_NEPALI 0x61
143 # define LANG_ORIYA 0x48
145 # ifndef LANG_PUNJABI
146 # define LANG_PUNJABI 0x46
148 # ifndef LANG_SANSKRIT
149 # define LANG_SANSKRIT 0x4f
151 # ifndef LANG_SERBIAN
152 # define LANG_SERBIAN 0x1a
155 # define LANG_SINDHI 0x59
158 # define LANG_SLOVAK 0x1b
160 # ifndef LANG_SORBIAN
161 # define LANG_SORBIAN 0x2e
163 # ifndef LANG_SWAHILI
164 # define LANG_SWAHILI 0x41
167 # define LANG_SYRIAC 0x5a
170 # define LANG_TAMIL 0x49
173 # define LANG_TATAR 0x44
176 # define LANG_TELUGU 0x4a
179 # define LANG_THAI 0x1e
181 # ifndef LANG_UKRAINIAN
182 # define LANG_UKRAINIAN 0x22
185 # define LANG_URDU 0x20
188 # define LANG_UZBEK 0x43
190 # ifndef LANG_VIETNAMESE
191 # define LANG_VIETNAMESE 0x2a
193 # ifndef SUBLANG_ARABIC_SAUDI_ARABIA
194 # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
196 # ifndef SUBLANG_ARABIC_IRAQ
197 # define SUBLANG_ARABIC_IRAQ 0x02
199 # ifndef SUBLANG_ARABIC_EGYPT
200 # define SUBLANG_ARABIC_EGYPT 0x03
202 # ifndef SUBLANG_ARABIC_LIBYA
203 # define SUBLANG_ARABIC_LIBYA 0x04
205 # ifndef SUBLANG_ARABIC_ALGERIA
206 # define SUBLANG_ARABIC_ALGERIA 0x05
208 # ifndef SUBLANG_ARABIC_MOROCCO
209 # define SUBLANG_ARABIC_MOROCCO 0x06
211 # ifndef SUBLANG_ARABIC_TUNISIA
212 # define SUBLANG_ARABIC_TUNISIA 0x07
214 # ifndef SUBLANG_ARABIC_OMAN
215 # define SUBLANG_ARABIC_OMAN 0x08
217 # ifndef SUBLANG_ARABIC_YEMEN
218 # define SUBLANG_ARABIC_YEMEN 0x09
220 # ifndef SUBLANG_ARABIC_SYRIA
221 # define SUBLANG_ARABIC_SYRIA 0x0a
223 # ifndef SUBLANG_ARABIC_JORDAN
224 # define SUBLANG_ARABIC_JORDAN 0x0b
226 # ifndef SUBLANG_ARABIC_LEBANON
227 # define SUBLANG_ARABIC_LEBANON 0x0c
229 # ifndef SUBLANG_ARABIC_KUWAIT
230 # define SUBLANG_ARABIC_KUWAIT 0x0d
232 # ifndef SUBLANG_ARABIC_UAE
233 # define SUBLANG_ARABIC_UAE 0x0e
235 # ifndef SUBLANG_ARABIC_BAHRAIN
236 # define SUBLANG_ARABIC_BAHRAIN 0x0f
238 # ifndef SUBLANG_ARABIC_QATAR
239 # define SUBLANG_ARABIC_QATAR 0x10
241 # ifndef SUBLANG_AZERI_LATIN
242 # define SUBLANG_AZERI_LATIN 0x01
244 # ifndef SUBLANG_AZERI_CYRILLIC
245 # define SUBLANG_AZERI_CYRILLIC 0x02
247 # ifndef SUBLANG_CHINESE_MACAU
248 # define SUBLANG_CHINESE_MACAU 0x05
250 # ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
251 # define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
253 # ifndef SUBLANG_ENGLISH_JAMAICA
254 # define SUBLANG_ENGLISH_JAMAICA 0x08
256 # ifndef SUBLANG_ENGLISH_CARIBBEAN
257 # define SUBLANG_ENGLISH_CARIBBEAN 0x09
259 # ifndef SUBLANG_ENGLISH_BELIZE
260 # define SUBLANG_ENGLISH_BELIZE 0x0a
262 # ifndef SUBLANG_ENGLISH_TRINIDAD
263 # define SUBLANG_ENGLISH_TRINIDAD 0x0b
265 # ifndef SUBLANG_ENGLISH_ZIMBABWE
266 # define SUBLANG_ENGLISH_ZIMBABWE 0x0c
268 # ifndef SUBLANG_ENGLISH_PHILIPPINES
269 # define SUBLANG_ENGLISH_PHILIPPINES 0x0d
271 # ifndef SUBLANG_FRENCH_LUXEMBOURG
272 # define SUBLANG_FRENCH_LUXEMBOURG 0x05
274 # ifndef SUBLANG_FRENCH_MONACO
275 # define SUBLANG_FRENCH_MONACO 0x06
277 # ifndef SUBLANG_GERMAN_LUXEMBOURG
278 # define SUBLANG_GERMAN_LUXEMBOURG 0x04
280 # ifndef SUBLANG_GERMAN_LIECHTENSTEIN
281 # define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
283 # ifndef SUBLANG_KASHMIRI_INDIA
284 # define SUBLANG_KASHMIRI_INDIA 0x02
286 # ifndef SUBLANG_MALAY_MALAYSIA
287 # define SUBLANG_MALAY_MALAYSIA 0x01
289 # ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
290 # define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
292 # ifndef SUBLANG_NEPALI_INDIA
293 # define SUBLANG_NEPALI_INDIA 0x02
295 # ifndef SUBLANG_SERBIAN_LATIN
296 # define SUBLANG_SERBIAN_LATIN 0x02
298 # ifndef SUBLANG_SERBIAN_CYRILLIC
299 # define SUBLANG_SERBIAN_CYRILLIC 0x03
301 # ifndef SUBLANG_SPANISH_GUATEMALA
302 # define SUBLANG_SPANISH_GUATEMALA 0x04
304 # ifndef SUBLANG_SPANISH_COSTA_RICA
305 # define SUBLANG_SPANISH_COSTA_RICA 0x05
307 # ifndef SUBLANG_SPANISH_PANAMA
308 # define SUBLANG_SPANISH_PANAMA 0x06
310 # ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
311 # define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
313 # ifndef SUBLANG_SPANISH_VENEZUELA
314 # define SUBLANG_SPANISH_VENEZUELA 0x08
316 # ifndef SUBLANG_SPANISH_COLOMBIA
317 # define SUBLANG_SPANISH_COLOMBIA 0x09
319 # ifndef SUBLANG_SPANISH_PERU
320 # define SUBLANG_SPANISH_PERU 0x0a
322 # ifndef SUBLANG_SPANISH_ARGENTINA
323 # define SUBLANG_SPANISH_ARGENTINA 0x0b
325 # ifndef SUBLANG_SPANISH_ECUADOR
326 # define SUBLANG_SPANISH_ECUADOR 0x0c
328 # ifndef SUBLANG_SPANISH_CHILE
329 # define SUBLANG_SPANISH_CHILE 0x0d
331 # ifndef SUBLANG_SPANISH_URUGUAY
332 # define SUBLANG_SPANISH_URUGUAY 0x0e
334 # ifndef SUBLANG_SPANISH_PARAGUAY
335 # define SUBLANG_SPANISH_PARAGUAY 0x0f
337 # ifndef SUBLANG_SPANISH_BOLIVIA
338 # define SUBLANG_SPANISH_BOLIVIA 0x10
340 # ifndef SUBLANG_SPANISH_EL_SALVADOR
341 # define SUBLANG_SPANISH_EL_SALVADOR 0x11
343 # ifndef SUBLANG_SPANISH_HONDURAS
344 # define SUBLANG_SPANISH_HONDURAS 0x12
346 # ifndef SUBLANG_SPANISH_NICARAGUA
347 # define SUBLANG_SPANISH_NICARAGUA 0x13
349 # ifndef SUBLANG_SPANISH_PUERTO_RICO
350 # define SUBLANG_SPANISH_PUERTO_RICO 0x14
352 # ifndef SUBLANG_SWEDISH_FINLAND
353 # define SUBLANG_SWEDISH_FINLAND 0x02
355 # ifndef SUBLANG_URDU_PAKISTAN
356 # define SUBLANG_URDU_PAKISTAN 0x01
358 # ifndef SUBLANG_URDU_INDIA
359 # define SUBLANG_URDU_INDIA 0x02
361 # ifndef SUBLANG_UZBEK_LATIN
362 # define SUBLANG_UZBEK_LATIN 0x01
364 # ifndef SUBLANG_UZBEK_CYRILLIC
365 # define SUBLANG_UZBEK_CYRILLIC 0x02
369 /* XPG3 defines the result of 'setlocale (category, NULL)' as:
370 "Directs 'setlocale()' to query 'category' and return the current
372 However it does not specify the exact format. Neither do SUSV2 and
373 ISO C 99. So we can use this feature only on selected systems (e.g.
374 those using GNU C Library). */
375 #if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
376 # define HAVE_LOCALE_NULL
379 /* Determine the current locale's name, and canonicalize it into XPG syntax
380 language[_territory[.codeset]][@modifier]
381 The codeset part in the result is not reliable; the locale_charset()
382 should be used for codeset information instead.
383 The result must not be freed; it is statically allocated. */
386 _nl_locale_name (category
, categoryname
)
388 const char *categoryname
;
394 /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
395 On some systems this can be done by the 'setlocale' function itself. */
396 # if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
397 retval
= setlocale (category
, NULL
);
399 /* Setting of LC_ALL overwrites all other. */
400 retval
= getenv ("LC_ALL");
401 if (retval
== NULL
|| retval
[0] == '\0')
403 /* Next comes the name of the desired category. */
404 retval
= getenv (categoryname
);
405 if (retval
== NULL
|| retval
[0] == '\0')
407 /* Last possibility is the LANG environment variable. */
408 retval
= getenv ("LANG");
409 if (retval
== NULL
|| retval
[0] == '\0')
410 /* We use C as the default domain. POSIX says this is
411 implementation defined. */
421 /* Return an XPG style locale name language[_territory][@modifier].
422 Don't even bother determining the codeset; it's not useful in this
423 context, because message catalogs are not specific to a single
430 /* Let the user override the system settings through environment
431 variables, as on POSIX systems. */
432 retval
= getenv ("LC_ALL");
433 if (retval
!= NULL
&& retval
[0] != '\0')
435 retval
= getenv (categoryname
);
436 if (retval
!= NULL
&& retval
[0] != '\0')
438 retval
= getenv ("LANG");
439 if (retval
!= NULL
&& retval
[0] != '\0')
442 /* Use native Win32 API locale ID. */
443 lcid
= GetThreadLocale ();
445 /* Strip off the sorting rules, keep only the language part. */
446 langid
= LANGIDFROMLCID (lcid
);
448 /* Split into language and territory part. */
449 primary
= PRIMARYLANGID (langid
);
450 sub
= SUBLANGID (langid
);
452 /* Dispatch on language.
453 See also http://www.unicode.org/unicode/onlinedat/languages.html .
454 For details about languages, see http://www.ethnologue.com/ . */
457 case LANG_AFRIKAANS
: return "af_ZA";
458 case LANG_ALBANIAN
: return "sq_AL";
459 case 0x5e: /* AMHARIC */ return "am_ET";
463 case SUBLANG_ARABIC_SAUDI_ARABIA
: return "ar_SA";
464 case SUBLANG_ARABIC_IRAQ
: return "ar_IQ";
465 case SUBLANG_ARABIC_EGYPT
: return "ar_EG";
466 case SUBLANG_ARABIC_LIBYA
: return "ar_LY";
467 case SUBLANG_ARABIC_ALGERIA
: return "ar_DZ";
468 case SUBLANG_ARABIC_MOROCCO
: return "ar_MA";
469 case SUBLANG_ARABIC_TUNISIA
: return "ar_TN";
470 case SUBLANG_ARABIC_OMAN
: return "ar_OM";
471 case SUBLANG_ARABIC_YEMEN
: return "ar_YE";
472 case SUBLANG_ARABIC_SYRIA
: return "ar_SY";
473 case SUBLANG_ARABIC_JORDAN
: return "ar_JO";
474 case SUBLANG_ARABIC_LEBANON
: return "ar_LB";
475 case SUBLANG_ARABIC_KUWAIT
: return "ar_KW";
476 case SUBLANG_ARABIC_UAE
: return "ar_AE";
477 case SUBLANG_ARABIC_BAHRAIN
: return "ar_BH";
478 case SUBLANG_ARABIC_QATAR
: return "ar_QA";
481 case LANG_ARMENIAN
: return "hy_AM";
482 case LANG_ASSAMESE
: return "as_IN";
486 /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */
487 case SUBLANG_AZERI_LATIN
: return "az_AZ@latin";
488 case SUBLANG_AZERI_CYRILLIC
: return "az_AZ@cyrillic";
492 return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */
493 case LANG_BELARUSIAN
: return "be_BY";
494 case LANG_BENGALI
: return "bn_IN";
495 case LANG_BULGARIAN
: return "bg_BG";
496 case 0x55: /* BURMESE */ return "my_MM";
497 case 0x53: /* CAMBODIAN */ return "km_KH";
498 case LANG_CATALAN
: return "ca_ES";
499 case 0x5c: /* CHEROKEE */ return "chr_US";
503 case SUBLANG_CHINESE_TRADITIONAL
: return "zh_TW";
504 case SUBLANG_CHINESE_SIMPLIFIED
: return "zh_CN";
505 case SUBLANG_CHINESE_HONGKONG
: return "zh_HK";
506 case SUBLANG_CHINESE_SINGAPORE
: return "zh_SG";
507 case SUBLANG_CHINESE_MACAU
: return "zh_MO";
510 case LANG_CROATIAN
: /* LANG_CROATIAN == LANG_SERBIAN
511 * What used to be called Serbo-Croatian
512 * should really now be two separate
513 * languages because of political reasons.
514 * (Says tml, who knows nothing about Serbian
516 * (I can feel those flames coming already.)
520 case SUBLANG_DEFAULT
: return "hr_HR";
521 case SUBLANG_SERBIAN_LATIN
: return "sr_YU";
522 case SUBLANG_SERBIAN_CYRILLIC
: return "sr_YU@cyrillic";
525 case LANG_CZECH
: return "cs_CZ";
526 case LANG_DANISH
: return "da_DK";
527 case LANG_DIVEHI
: return "div_MV";
531 case SUBLANG_DUTCH
: return "nl_NL";
532 case SUBLANG_DUTCH_BELGIAN
: /* FLEMISH, VLAAMS */ return "nl_BE";
535 case 0x66: /* EDO */ return "bin_NG";
539 /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
540 * English was the language spoken in England.
543 case SUBLANG_ENGLISH_US
: return "en_US";
544 case SUBLANG_ENGLISH_UK
: return "en_GB";
545 case SUBLANG_ENGLISH_AUS
: return "en_AU";
546 case SUBLANG_ENGLISH_CAN
: return "en_CA";
547 case SUBLANG_ENGLISH_NZ
: return "en_NZ";
548 case SUBLANG_ENGLISH_EIRE
: return "en_IE";
549 case SUBLANG_ENGLISH_SOUTH_AFRICA
: return "en_ZA";
550 case SUBLANG_ENGLISH_JAMAICA
: return "en_JM";
551 case SUBLANG_ENGLISH_CARIBBEAN
: return "en_GD"; /* Grenada? */
552 case SUBLANG_ENGLISH_BELIZE
: return "en_BZ";
553 case SUBLANG_ENGLISH_TRINIDAD
: return "en_TT";
554 case SUBLANG_ENGLISH_ZIMBABWE
: return "en_ZW";
555 case SUBLANG_ENGLISH_PHILIPPINES
: return "en_PH";
558 case LANG_ESTONIAN
: return "et_EE";
559 case LANG_FAEROESE
: return "fo_FO";
560 case LANG_FARSI
: return "fa_IR";
561 case LANG_FINNISH
: return "fi_FI";
565 case SUBLANG_FRENCH
: return "fr_FR";
566 case SUBLANG_FRENCH_BELGIAN
: /* WALLOON */ return "fr_BE";
567 case SUBLANG_FRENCH_CANADIAN
: return "fr_CA";
568 case SUBLANG_FRENCH_SWISS
: return "fr_CH";
569 case SUBLANG_FRENCH_LUXEMBOURG
: return "fr_LU";
570 case SUBLANG_FRENCH_MONACO
: return "fr_MC";
573 case 0x62: /* FRISIAN */ return "fy_NL";
574 case 0x67: /* FULFULDE */ return "ful_NG";
575 case 0x3c: /* GAELIC */
578 case 0x01: /* SCOTTISH */ return "gd_GB";
579 case 0x02: /* IRISH */ return "ga_IE";
582 case LANG_GALICIAN
: return "gl_ES";
583 case LANG_GEORGIAN
: return "ka_GE";
587 case SUBLANG_GERMAN
: return "de_DE";
588 case SUBLANG_GERMAN_SWISS
: return "de_CH";
589 case SUBLANG_GERMAN_AUSTRIAN
: return "de_AT";
590 case SUBLANG_GERMAN_LUXEMBOURG
: return "de_LU";
591 case SUBLANG_GERMAN_LIECHTENSTEIN
: return "de_LI";
594 case LANG_GREEK
: return "el_GR";
595 case 0x74: /* GUARANI */ return "gn_PY";
596 case LANG_GUJARATI
: return "gu_IN";
597 case 0x68: /* HAUSA */ return "ha_NG";
598 case 0x75: /* HAWAIIAN */
599 /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers)
600 or Hawaii Creole English ("cpe_US", 600000 speakers)? */
602 case LANG_HEBREW
: return "he_IL";
603 case LANG_HINDI
: return "hi_IN";
604 case LANG_HUNGARIAN
: return "hu_HU";
605 case 0x69: /* IBIBIO */ return "nic_NG";
606 case LANG_ICELANDIC
: return "is_IS";
607 case 0x70: /* IGBO */ return "ibo_NG";
608 case LANG_INDONESIAN
: return "id_ID";
609 case 0x5d: /* INUKTITUT */ return "iu_CA";
613 case SUBLANG_ITALIAN
: return "it_IT";
614 case SUBLANG_ITALIAN_SWISS
: return "it_CH";
617 case LANG_JAPANESE
: return "ja_JP";
618 case LANG_KANNADA
: return "kn_IN";
619 case 0x71: /* KANURI */ return "kau_NG";
623 case SUBLANG_DEFAULT
: return "ks_PK";
624 case SUBLANG_KASHMIRI_INDIA
: return "ks_IN";
627 case LANG_KAZAK
: return "kk_KZ";
629 /* FIXME: Adjust this when such locales appear on Unix. */
631 case LANG_KOREAN
: return "ko_KR";
632 case LANG_KYRGYZ
: return "ky_KG";
633 case 0x54: /* LAO */ return "lo_LA";
634 case 0x76: /* LATIN */ return "la_VA";
635 case LANG_LATVIAN
: return "lv_LV";
636 case LANG_LITHUANIAN
: return "lt_LT";
637 case LANG_MACEDONIAN
: return "mk_MK";
641 case SUBLANG_MALAY_MALAYSIA
: return "ms_MY";
642 case SUBLANG_MALAY_BRUNEI_DARUSSALAM
: return "ms_BN";
645 case LANG_MALAYALAM
: return "ml_IN";
646 case 0x3a: /* MALTESE */ return "mt_MT";
648 /* FIXME: Adjust this when such locales appear on Unix. */
650 case LANG_MARATHI
: return "mr_IN";
652 return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN". */
656 case SUBLANG_DEFAULT
: return "ne_NP";
657 case SUBLANG_NEPALI_INDIA
: return "ne_IN";
663 case SUBLANG_NORWEGIAN_BOKMAL
: return "no_NO";
664 case SUBLANG_NORWEGIAN_NYNORSK
: return "nn_NO";
667 case LANG_ORIYA
: return "or_IN";
668 case 0x72: /* OROMO */ return "om_ET";
669 case 0x79: /* PAPIAMENTU */ return "pap_AN";
670 case 0x63: /* PASHTO */
671 return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF". */
672 case LANG_POLISH
: return "pl_PL";
673 case LANG_PORTUGUESE
:
676 case SUBLANG_PORTUGUESE
: return "pt_PT";
677 /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
678 Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
679 case SUBLANG_PORTUGUESE_BRAZILIAN
: return "pt_BR";
682 case LANG_PUNJABI
: return "pa_IN";
683 case 0x17: /* RHAETO-ROMANCE */ return "rm_CH";
684 case LANG_ROMANIAN
: return "ro_RO";
686 return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA". */
687 case 0x3b: /* SAMI */ return "se_NO";
688 case LANG_SANSKRIT
: return "sa_IN";
689 case LANG_SINDHI
: return "sd";
690 case 0x5b: /* SINHALESE */ return "si_LK";
691 case LANG_SLOVAK
: return "sk_SK";
692 case LANG_SLOVENIAN
: return "sl_SI";
693 case 0x77: /* SOMALI */ return "so_SO";
695 /* FIXME: Adjust this when such locales appear on Unix. */
700 case SUBLANG_SPANISH
: return "es_ES";
701 case SUBLANG_SPANISH_MEXICAN
: return "es_MX";
702 case SUBLANG_SPANISH_MODERN
:
703 return "es_ES@modern"; /* not seen on Unix */
704 case SUBLANG_SPANISH_GUATEMALA
: return "es_GT";
705 case SUBLANG_SPANISH_COSTA_RICA
: return "es_CR";
706 case SUBLANG_SPANISH_PANAMA
: return "es_PA";
707 case SUBLANG_SPANISH_DOMINICAN_REPUBLIC
: return "es_DO";
708 case SUBLANG_SPANISH_VENEZUELA
: return "es_VE";
709 case SUBLANG_SPANISH_COLOMBIA
: return "es_CO";
710 case SUBLANG_SPANISH_PERU
: return "es_PE";
711 case SUBLANG_SPANISH_ARGENTINA
: return "es_AR";
712 case SUBLANG_SPANISH_ECUADOR
: return "es_EC";
713 case SUBLANG_SPANISH_CHILE
: return "es_CL";
714 case SUBLANG_SPANISH_URUGUAY
: return "es_UY";
715 case SUBLANG_SPANISH_PARAGUAY
: return "es_PY";
716 case SUBLANG_SPANISH_BOLIVIA
: return "es_BO";
717 case SUBLANG_SPANISH_EL_SALVADOR
: return "es_SV";
718 case SUBLANG_SPANISH_HONDURAS
: return "es_HN";
719 case SUBLANG_SPANISH_NICARAGUA
: return "es_NI";
720 case SUBLANG_SPANISH_PUERTO_RICO
: return "es_PR";
723 case 0x30: /* SUTU */ return "bnt_TZ";
724 case LANG_SWAHILI
: return "sw_KE";
728 case SUBLANG_DEFAULT
: return "sv_SE";
729 case SUBLANG_SWEDISH_FINLAND
: return "sv_FI";
732 case LANG_SYRIAC
: return "syr_TR"; /* An extinct language. */
733 case 0x64: /* TAGALOG */ return "tl_PH";
734 case 0x28: /* TAJIK */ return "tg_TJ";
735 case 0x5f: /* TAMAZIGHT */ return "ber_MA";
737 return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */
738 case LANG_TATAR
: return "tt_RU";
739 case LANG_TELUGU
: return "te_IN";
740 case LANG_THAI
: return "th_TH";
741 case 0x51: /* TIBETAN */ return "bo_CN";
742 case 0x73: /* TIGRINYA */ return "ti_ET";
743 case 0x31: /* TSONGA */ return "ts_ZA";
744 case LANG_TURKISH
: return "tr_TR";
745 case 0x42: /* TURKMEN */ return "tk_TM";
746 case LANG_UKRAINIAN
: return "uk_UA";
750 case SUBLANG_URDU_PAKISTAN
: return "ur_PK";
751 case SUBLANG_URDU_INDIA
: return "ur_IN";
757 /* FIXME: Adjust this when Uzbek locales appear on Unix. */
758 case SUBLANG_UZBEK_LATIN
: return "uz_UZ@latin";
759 case SUBLANG_UZBEK_CYRILLIC
: return "uz_UZ@cyrillic";
762 case 0x33: /* VENDA */ return "ven_ZA";
763 case LANG_VIETNAMESE
: return "vi_VN";
764 case 0x52: /* WELSH */ return "cy_GB";
765 case 0x34: /* XHOSA */ return "xh_ZA";
766 case 0x78: /* YI */ return "sit_CN";
767 case 0x3d: /* YIDDISH */ return "yi_IL";
768 case 0x6a: /* YORUBA */ return "yo_NG";
769 case 0x35: /* ZULU */ return "zu_ZA";