Back to index

tetex-bin  3.0
localename.c
Go to the documentation of this file.
00001 /* Determine the current selected locale.
00002    Copyright (C) 1995-1999, 2000-2004 Free Software Foundation, Inc.
00003 
00004    This program is free software; you can redistribute it and/or modify it
00005    under the terms of the GNU Library General Public License as published
00006    by the Free Software Foundation; either version 2, or (at your option)
00007    any later version.
00008 
00009    This program is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Library General Public License for more details.
00013 
00014    You should have received a copy of the GNU Library General Public
00015    License along with this program; if not, write to the Free Software
00016    Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
00017    USA.  */
00018 
00019 /* Written by Ulrich Drepper <drepper@gnu.org>, 1995.  */
00020 /* Win32 code written by Tor Lillqvist <tml@iki.fi>.  */
00021 
00022 #ifdef HAVE_CONFIG_H
00023 # include <config.h>
00024 #endif
00025 
00026 #include <stdlib.h>
00027 #include <locale.h>
00028 
00029 #if defined _WIN32 || defined __WIN32__
00030 # undef WIN32   /* avoid warning on mingw32 */
00031 # define WIN32
00032 #endif
00033 
00034 #ifdef WIN32
00035 # define WIN32_LEAN_AND_MEAN
00036 # include <windows.h>
00037 /* List of language codes, sorted by value:
00038    0x01 LANG_ARABIC
00039    0x02 LANG_BULGARIAN
00040    0x03 LANG_CATALAN
00041    0x04 LANG_CHINESE
00042    0x05 LANG_CZECH
00043    0x06 LANG_DANISH
00044    0x07 LANG_GERMAN
00045    0x08 LANG_GREEK
00046    0x09 LANG_ENGLISH
00047    0x0a LANG_SPANISH
00048    0x0b LANG_FINNISH
00049    0x0c LANG_FRENCH
00050    0x0d LANG_HEBREW
00051    0x0e LANG_HUNGARIAN
00052    0x0f LANG_ICELANDIC
00053    0x10 LANG_ITALIAN
00054    0x11 LANG_JAPANESE
00055    0x12 LANG_KOREAN
00056    0x13 LANG_DUTCH
00057    0x14 LANG_NORWEGIAN
00058    0x15 LANG_POLISH
00059    0x16 LANG_PORTUGUESE
00060    0x17 LANG_RHAETO_ROMANCE
00061    0x18 LANG_ROMANIAN
00062    0x19 LANG_RUSSIAN
00063    0x1a LANG_CROATIAN == LANG_SERBIAN
00064    0x1b LANG_SLOVAK
00065    0x1c LANG_ALBANIAN
00066    0x1d LANG_SWEDISH
00067    0x1e LANG_THAI
00068    0x1f LANG_TURKISH
00069    0x20 LANG_URDU
00070    0x21 LANG_INDONESIAN
00071    0x22 LANG_UKRAINIAN
00072    0x23 LANG_BELARUSIAN
00073    0x24 LANG_SLOVENIAN
00074    0x25 LANG_ESTONIAN
00075    0x26 LANG_LATVIAN
00076    0x27 LANG_LITHUANIAN
00077    0x28 LANG_TAJIK
00078    0x29 LANG_FARSI
00079    0x2a LANG_VIETNAMESE
00080    0x2b LANG_ARMENIAN
00081    0x2c LANG_AZERI
00082    0x2d LANG_BASQUE
00083    0x2e LANG_SORBIAN
00084    0x2f LANG_MACEDONIAN
00085    0x30 LANG_SUTU
00086    0x31 LANG_TSONGA
00087    0x32 LANG_TSWANA
00088    0x33 LANG_VENDA
00089    0x34 LANG_XHOSA
00090    0x35 LANG_ZULU
00091    0x36 LANG_AFRIKAANS
00092    0x37 LANG_GEORGIAN
00093    0x38 LANG_FAEROESE
00094    0x39 LANG_HINDI
00095    0x3a LANG_MALTESE
00096    0x3b LANG_SAAMI
00097    0x3c LANG_GAELIC
00098    0x3d LANG_YIDDISH
00099    0x3e LANG_MALAY
00100    0x3f LANG_KAZAK
00101    0x40 LANG_KYRGYZ
00102    0x41 LANG_SWAHILI
00103    0x42 LANG_TURKMEN
00104    0x43 LANG_UZBEK
00105    0x44 LANG_TATAR
00106    0x45 LANG_BENGALI
00107    0x46 LANG_PUNJABI
00108    0x47 LANG_GUJARATI
00109    0x48 LANG_ORIYA
00110    0x49 LANG_TAMIL
00111    0x4a LANG_TELUGU
00112    0x4b LANG_KANNADA
00113    0x4c LANG_MALAYALAM
00114    0x4d LANG_ASSAMESE
00115    0x4e LANG_MARATHI
00116    0x4f LANG_SANSKRIT
00117    0x50 LANG_MONGOLIAN
00118    0x51 LANG_TIBETAN
00119    0x52 LANG_WELSH
00120    0x53 LANG_CAMBODIAN
00121    0x54 LANG_LAO
00122    0x55 LANG_BURMESE
00123    0x56 LANG_GALICIAN
00124    0x57 LANG_KONKANI
00125    0x58 LANG_MANIPURI
00126    0x59 LANG_SINDHI
00127    0x5a LANG_SYRIAC
00128    0x5b LANG_SINHALESE
00129    0x5c LANG_CHEROKEE
00130    0x5d LANG_INUKTITUT
00131    0x5e LANG_AMHARIC
00132    0x5f LANG_TAMAZIGHT
00133    0x60 LANG_KASHMIRI
00134    0x61 LANG_NEPALI
00135    0x62 LANG_FRISIAN
00136    0x63 LANG_PASHTO
00137    0x64 LANG_TAGALOG
00138    0x65 LANG_DIVEHI
00139    0x66 LANG_EDO
00140    0x67 LANG_FULFULDE
00141    0x68 LANG_HAUSA
00142    0x69 LANG_IBIBIO
00143    0x6a LANG_YORUBA
00144    0x70 LANG_IGBO
00145    0x71 LANG_KANURI
00146    0x72 LANG_OROMO
00147    0x73 LANG_TIGRINYA
00148    0x74 LANG_GUARANI
00149    0x75 LANG_HAWAIIAN
00150    0x76 LANG_LATIN
00151    0x77 LANG_SOMALI
00152    0x78 LANG_YI
00153    0x79 LANG_PAPIAMENTU
00154 */
00155 /* Mingw headers don't have latest language and sublanguage codes.  */
00156 # ifndef LANG_AFRIKAANS
00157 # define LANG_AFRIKAANS 0x36
00158 # endif
00159 # ifndef LANG_ALBANIAN
00160 # define LANG_ALBANIAN 0x1c
00161 # endif
00162 # ifndef LANG_AMHARIC
00163 # define LANG_AMHARIC 0x5e
00164 # endif
00165 # ifndef LANG_ARABIC
00166 # define LANG_ARABIC 0x01
00167 # endif
00168 # ifndef LANG_ARMENIAN
00169 # define LANG_ARMENIAN 0x2b
00170 # endif
00171 # ifndef LANG_ASSAMESE
00172 # define LANG_ASSAMESE 0x4d
00173 # endif
00174 # ifndef LANG_AZERI
00175 # define LANG_AZERI 0x2c
00176 # endif
00177 # ifndef LANG_BASQUE
00178 # define LANG_BASQUE 0x2d
00179 # endif
00180 # ifndef LANG_BELARUSIAN
00181 # define LANG_BELARUSIAN 0x23
00182 # endif
00183 # ifndef LANG_BENGALI
00184 # define LANG_BENGALI 0x45
00185 # endif
00186 # ifndef LANG_BURMESE
00187 # define LANG_BURMESE 0x55
00188 # endif
00189 # ifndef LANG_CAMBODIAN
00190 # define LANG_CAMBODIAN 0x53
00191 # endif
00192 # ifndef LANG_CATALAN
00193 # define LANG_CATALAN 0x03
00194 # endif
00195 # ifndef LANG_CHEROKEE
00196 # define LANG_CHEROKEE 0x5c
00197 # endif
00198 # ifndef LANG_DIVEHI
00199 # define LANG_DIVEHI 0x65
00200 # endif
00201 # ifndef LANG_EDO
00202 # define LANG_EDO 0x66
00203 # endif
00204 # ifndef LANG_ESTONIAN
00205 # define LANG_ESTONIAN 0x25
00206 # endif
00207 # ifndef LANG_FAEROESE
00208 # define LANG_FAEROESE 0x38
00209 # endif
00210 # ifndef LANG_FARSI
00211 # define LANG_FARSI 0x29
00212 # endif
00213 # ifndef LANG_FRISIAN
00214 # define LANG_FRISIAN 0x62
00215 # endif
00216 # ifndef LANG_FULFULDE
00217 # define LANG_FULFULDE 0x67
00218 # endif
00219 # ifndef LANG_GAELIC
00220 # define LANG_GAELIC 0x3c
00221 # endif
00222 # ifndef LANG_GALICIAN
00223 # define LANG_GALICIAN 0x56
00224 # endif
00225 # ifndef LANG_GEORGIAN
00226 # define LANG_GEORGIAN 0x37
00227 # endif
00228 # ifndef LANG_GUARANI
00229 # define LANG_GUARANI 0x74
00230 # endif
00231 # ifndef LANG_GUJARATI
00232 # define LANG_GUJARATI 0x47
00233 # endif
00234 # ifndef LANG_HAUSA
00235 # define LANG_HAUSA 0x68
00236 # endif
00237 # ifndef LANG_HAWAIIAN
00238 # define LANG_HAWAIIAN 0x75
00239 # endif
00240 # ifndef LANG_HEBREW
00241 # define LANG_HEBREW 0x0d
00242 # endif
00243 # ifndef LANG_HINDI
00244 # define LANG_HINDI 0x39
00245 # endif
00246 # ifndef LANG_IBIBIO
00247 # define LANG_IBIBIO 0x69
00248 # endif
00249 # ifndef LANG_IGBO
00250 # define LANG_IGBO 0x70
00251 # endif
00252 # ifndef LANG_INDONESIAN
00253 # define LANG_INDONESIAN 0x21
00254 # endif
00255 # ifndef LANG_INUKTITUT
00256 # define LANG_INUKTITUT 0x5d
00257 # endif
00258 # ifndef LANG_KANNADA
00259 # define LANG_KANNADA 0x4b
00260 # endif
00261 # ifndef LANG_KANURI
00262 # define LANG_KANURI 0x71
00263 # endif
00264 # ifndef LANG_KASHMIRI
00265 # define LANG_KASHMIRI 0x60
00266 # endif
00267 # ifndef LANG_KAZAK
00268 # define LANG_KAZAK 0x3f
00269 # endif
00270 # ifndef LANG_KONKANI
00271 # define LANG_KONKANI 0x57
00272 # endif
00273 # ifndef LANG_KYRGYZ
00274 # define LANG_KYRGYZ 0x40
00275 # endif
00276 # ifndef LANG_LAO
00277 # define LANG_LAO 0x54
00278 # endif
00279 # ifndef LANG_LATIN
00280 # define LANG_LATIN 0x76
00281 # endif
00282 # ifndef LANG_LATVIAN
00283 # define LANG_LATVIAN 0x26
00284 # endif
00285 # ifndef LANG_LITHUANIAN
00286 # define LANG_LITHUANIAN 0x27
00287 # endif
00288 # ifndef LANG_MACEDONIAN
00289 # define LANG_MACEDONIAN 0x2f
00290 # endif
00291 # ifndef LANG_MALAY
00292 # define LANG_MALAY 0x3e
00293 # endif
00294 # ifndef LANG_MALAYALAM
00295 # define LANG_MALAYALAM 0x4c
00296 # endif
00297 # ifndef LANG_MALTESE
00298 # define LANG_MALTESE 0x3a
00299 # endif
00300 # ifndef LANG_MANIPURI
00301 # define LANG_MANIPURI 0x58
00302 # endif
00303 # ifndef LANG_MARATHI
00304 # define LANG_MARATHI 0x4e
00305 # endif
00306 # ifndef LANG_MONGOLIAN
00307 # define LANG_MONGOLIAN 0x50
00308 # endif
00309 # ifndef LANG_NEPALI
00310 # define LANG_NEPALI 0x61
00311 # endif
00312 # ifndef LANG_ORIYA
00313 # define LANG_ORIYA 0x48
00314 # endif
00315 # ifndef LANG_OROMO
00316 # define LANG_OROMO 0x72
00317 # endif
00318 # ifndef LANG_PAPIAMENTU
00319 # define LANG_PAPIAMENTU 0x79
00320 # endif
00321 # ifndef LANG_PASHTO
00322 # define LANG_PASHTO 0x63
00323 # endif
00324 # ifndef LANG_PUNJABI
00325 # define LANG_PUNJABI 0x46
00326 # endif
00327 # ifndef LANG_RHAETO_ROMANCE
00328 # define LANG_RHAETO_ROMANCE 0x17
00329 # endif
00330 # ifndef LANG_SAAMI
00331 # define LANG_SAAMI 0x3b
00332 # endif
00333 # ifndef LANG_SANSKRIT
00334 # define LANG_SANSKRIT 0x4f
00335 # endif
00336 # ifndef LANG_SERBIAN
00337 # define LANG_SERBIAN 0x1a
00338 # endif
00339 # ifndef LANG_SINDHI
00340 # define LANG_SINDHI 0x59
00341 # endif
00342 # ifndef LANG_SINHALESE
00343 # define LANG_SINHALESE 0x5b
00344 # endif
00345 # ifndef LANG_SLOVAK
00346 # define LANG_SLOVAK 0x1b
00347 # endif
00348 # ifndef LANG_SOMALI
00349 # define LANG_SOMALI 0x77
00350 # endif
00351 # ifndef LANG_SORBIAN
00352 # define LANG_SORBIAN 0x2e
00353 # endif
00354 # ifndef LANG_SUTU
00355 # define LANG_SUTU 0x30
00356 # endif
00357 # ifndef LANG_SWAHILI
00358 # define LANG_SWAHILI 0x41
00359 # endif
00360 # ifndef LANG_SYRIAC
00361 # define LANG_SYRIAC 0x5a
00362 # endif
00363 # ifndef LANG_TAGALOG
00364 # define LANG_TAGALOG 0x64
00365 # endif
00366 # ifndef LANG_TAJIK
00367 # define LANG_TAJIK 0x28
00368 # endif
00369 # ifndef LANG_TAMAZIGHT
00370 # define LANG_TAMAZIGHT 0x5f
00371 # endif
00372 # ifndef LANG_TAMIL
00373 # define LANG_TAMIL 0x49
00374 # endif
00375 # ifndef LANG_TATAR
00376 # define LANG_TATAR 0x44
00377 # endif
00378 # ifndef LANG_TELUGU
00379 # define LANG_TELUGU 0x4a
00380 # endif
00381 # ifndef LANG_THAI
00382 # define LANG_THAI 0x1e
00383 # endif
00384 # ifndef LANG_TIBETAN
00385 # define LANG_TIBETAN 0x51
00386 # endif
00387 # ifndef LANG_TIGRINYA
00388 # define LANG_TIGRINYA 0x73
00389 # endif
00390 # ifndef LANG_TSONGA
00391 # define LANG_TSONGA 0x31
00392 # endif
00393 # ifndef LANG_TSWANA
00394 # define LANG_TSWANA 0x32
00395 # endif
00396 # ifndef LANG_TURKMEN
00397 # define LANG_TURKMEN 0x42
00398 # endif
00399 # ifndef LANG_UKRAINIAN
00400 # define LANG_UKRAINIAN 0x22
00401 # endif
00402 # ifndef LANG_URDU
00403 # define LANG_URDU 0x20
00404 # endif
00405 # ifndef LANG_UZBEK
00406 # define LANG_UZBEK 0x43
00407 # endif
00408 # ifndef LANG_VENDA
00409 # define LANG_VENDA 0x33
00410 # endif
00411 # ifndef LANG_VIETNAMESE
00412 # define LANG_VIETNAMESE 0x2a
00413 # endif
00414 # ifndef LANG_WELSH
00415 # define LANG_WELSH 0x52
00416 # endif
00417 # ifndef LANG_XHOSA
00418 # define LANG_XHOSA 0x34
00419 # endif
00420 # ifndef LANG_YI
00421 # define LANG_YI 0x78
00422 # endif
00423 # ifndef LANG_YIDDISH
00424 # define LANG_YIDDISH 0x3d
00425 # endif
00426 # ifndef LANG_YORUBA
00427 # define LANG_YORUBA 0x6a
00428 # endif
00429 # ifndef LANG_ZULU
00430 # define LANG_ZULU 0x35
00431 # endif
00432 # ifndef SUBLANG_ARABIC_SAUDI_ARABIA
00433 # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
00434 # endif
00435 # ifndef SUBLANG_ARABIC_IRAQ
00436 # define SUBLANG_ARABIC_IRAQ 0x02
00437 # endif
00438 # ifndef SUBLANG_ARABIC_EGYPT
00439 # define SUBLANG_ARABIC_EGYPT 0x03
00440 # endif
00441 # ifndef SUBLANG_ARABIC_LIBYA
00442 # define SUBLANG_ARABIC_LIBYA 0x04
00443 # endif
00444 # ifndef SUBLANG_ARABIC_ALGERIA
00445 # define SUBLANG_ARABIC_ALGERIA 0x05
00446 # endif
00447 # ifndef SUBLANG_ARABIC_MOROCCO
00448 # define SUBLANG_ARABIC_MOROCCO 0x06
00449 # endif
00450 # ifndef SUBLANG_ARABIC_TUNISIA
00451 # define SUBLANG_ARABIC_TUNISIA 0x07
00452 # endif
00453 # ifndef SUBLANG_ARABIC_OMAN
00454 # define SUBLANG_ARABIC_OMAN 0x08
00455 # endif
00456 # ifndef SUBLANG_ARABIC_YEMEN
00457 # define SUBLANG_ARABIC_YEMEN 0x09
00458 # endif
00459 # ifndef SUBLANG_ARABIC_SYRIA
00460 # define SUBLANG_ARABIC_SYRIA 0x0a
00461 # endif
00462 # ifndef SUBLANG_ARABIC_JORDAN
00463 # define SUBLANG_ARABIC_JORDAN 0x0b
00464 # endif
00465 # ifndef SUBLANG_ARABIC_LEBANON
00466 # define SUBLANG_ARABIC_LEBANON 0x0c
00467 # endif
00468 # ifndef SUBLANG_ARABIC_KUWAIT
00469 # define SUBLANG_ARABIC_KUWAIT 0x0d
00470 # endif
00471 # ifndef SUBLANG_ARABIC_UAE
00472 # define SUBLANG_ARABIC_UAE 0x0e
00473 # endif
00474 # ifndef SUBLANG_ARABIC_BAHRAIN
00475 # define SUBLANG_ARABIC_BAHRAIN 0x0f
00476 # endif
00477 # ifndef SUBLANG_ARABIC_QATAR
00478 # define SUBLANG_ARABIC_QATAR 0x10
00479 # endif
00480 # ifndef SUBLANG_AZERI_LATIN
00481 # define SUBLANG_AZERI_LATIN 0x01
00482 # endif
00483 # ifndef SUBLANG_AZERI_CYRILLIC
00484 # define SUBLANG_AZERI_CYRILLIC 0x02
00485 # endif
00486 # ifndef SUBLANG_BENGALI_INDIA
00487 # define SUBLANG_BENGALI_INDIA 0x00
00488 # endif
00489 # ifndef SUBLANG_BENGALI_BANGLADESH
00490 # define SUBLANG_BENGALI_BANGLADESH 0x01
00491 # endif
00492 # ifndef SUBLANG_CHINESE_MACAU
00493 # define SUBLANG_CHINESE_MACAU 0x05
00494 # endif
00495 # ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
00496 # define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
00497 # endif
00498 # ifndef SUBLANG_ENGLISH_JAMAICA
00499 # define SUBLANG_ENGLISH_JAMAICA 0x08
00500 # endif
00501 # ifndef SUBLANG_ENGLISH_CARIBBEAN
00502 # define SUBLANG_ENGLISH_CARIBBEAN 0x09
00503 # endif
00504 # ifndef SUBLANG_ENGLISH_BELIZE
00505 # define SUBLANG_ENGLISH_BELIZE 0x0a
00506 # endif
00507 # ifndef SUBLANG_ENGLISH_TRINIDAD
00508 # define SUBLANG_ENGLISH_TRINIDAD 0x0b
00509 # endif
00510 # ifndef SUBLANG_ENGLISH_ZIMBABWE
00511 # define SUBLANG_ENGLISH_ZIMBABWE 0x0c
00512 # endif
00513 # ifndef SUBLANG_ENGLISH_PHILIPPINES
00514 # define SUBLANG_ENGLISH_PHILIPPINES 0x0d
00515 # endif
00516 # ifndef SUBLANG_ENGLISH_INDONESIA
00517 # define SUBLANG_ENGLISH_INDONESIA 0x0e
00518 # endif
00519 # ifndef SUBLANG_ENGLISH_HONGKONG
00520 # define SUBLANG_ENGLISH_HONGKONG 0x0f
00521 # endif
00522 # ifndef SUBLANG_ENGLISH_INDIA
00523 # define SUBLANG_ENGLISH_INDIA 0x10
00524 # endif
00525 # ifndef SUBLANG_ENGLISH_MALAYSIA
00526 # define SUBLANG_ENGLISH_MALAYSIA 0x11
00527 # endif
00528 # ifndef SUBLANG_ENGLISH_SINGAPORE
00529 # define SUBLANG_ENGLISH_SINGAPORE 0x12
00530 # endif
00531 # ifndef SUBLANG_FRENCH_LUXEMBOURG
00532 # define SUBLANG_FRENCH_LUXEMBOURG 0x05
00533 # endif
00534 # ifndef SUBLANG_FRENCH_MONACO
00535 # define SUBLANG_FRENCH_MONACO 0x06
00536 # endif
00537 # ifndef SUBLANG_FRENCH_WESTINDIES
00538 # define SUBLANG_FRENCH_WESTINDIES 0x07
00539 # endif
00540 # ifndef SUBLANG_FRENCH_REUNION
00541 # define SUBLANG_FRENCH_REUNION 0x08
00542 # endif
00543 # ifndef SUBLANG_FRENCH_CONGO
00544 # define SUBLANG_FRENCH_CONGO 0x09
00545 # endif
00546 # ifndef SUBLANG_FRENCH_SENEGAL
00547 # define SUBLANG_FRENCH_SENEGAL 0x0a
00548 # endif
00549 # ifndef SUBLANG_FRENCH_CAMEROON
00550 # define SUBLANG_FRENCH_CAMEROON 0x0b
00551 # endif
00552 # ifndef SUBLANG_FRENCH_COTEDIVOIRE
00553 # define SUBLANG_FRENCH_COTEDIVOIRE 0x0c
00554 # endif
00555 # ifndef SUBLANG_FRENCH_MALI
00556 # define SUBLANG_FRENCH_MALI 0x0d
00557 # endif
00558 # ifndef SUBLANG_FRENCH_MOROCCO
00559 # define SUBLANG_FRENCH_MOROCCO 0x0e
00560 # endif
00561 # ifndef SUBLANG_FRENCH_HAITI
00562 # define SUBLANG_FRENCH_HAITI 0x0f
00563 # endif
00564 # ifndef SUBLANG_GERMAN_LUXEMBOURG
00565 # define SUBLANG_GERMAN_LUXEMBOURG 0x04
00566 # endif
00567 # ifndef SUBLANG_GERMAN_LIECHTENSTEIN
00568 # define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
00569 # endif
00570 # ifndef SUBLANG_KASHMIRI_INDIA
00571 # define SUBLANG_KASHMIRI_INDIA 0x02
00572 # endif
00573 # ifndef SUBLANG_MALAY_MALAYSIA
00574 # define SUBLANG_MALAY_MALAYSIA 0x01
00575 # endif
00576 # ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
00577 # define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
00578 # endif
00579 # ifndef SUBLANG_NEPALI_INDIA
00580 # define SUBLANG_NEPALI_INDIA 0x02
00581 # endif
00582 # ifndef SUBLANG_PUNJABI_INDIA
00583 # define SUBLANG_PUNJABI_INDIA 0x00
00584 # endif
00585 # ifndef SUBLANG_PUNJABI_PAKISTAN
00586 # define SUBLANG_PUNJABI_PAKISTAN 0x01
00587 # endif
00588 # ifndef SUBLANG_ROMANIAN_ROMANIA
00589 # define SUBLANG_ROMANIAN_ROMANIA 0x00
00590 # endif
00591 # ifndef SUBLANG_ROMANIAN_MOLDOVA
00592 # define SUBLANG_ROMANIAN_MOLDOVA 0x01
00593 # endif
00594 # ifndef SUBLANG_SERBIAN_LATIN
00595 # define SUBLANG_SERBIAN_LATIN 0x02
00596 # endif
00597 # ifndef SUBLANG_SERBIAN_CYRILLIC
00598 # define SUBLANG_SERBIAN_CYRILLIC 0x03
00599 # endif
00600 # ifndef SUBLANG_SINDHI_INDIA
00601 # define SUBLANG_SINDHI_INDIA 0x00
00602 # endif
00603 # ifndef SUBLANG_SINDHI_PAKISTAN
00604 # define SUBLANG_SINDHI_PAKISTAN 0x01
00605 # endif
00606 # ifndef SUBLANG_SPANISH_GUATEMALA
00607 # define SUBLANG_SPANISH_GUATEMALA 0x04
00608 # endif
00609 # ifndef SUBLANG_SPANISH_COSTA_RICA
00610 # define SUBLANG_SPANISH_COSTA_RICA 0x05
00611 # endif
00612 # ifndef SUBLANG_SPANISH_PANAMA
00613 # define SUBLANG_SPANISH_PANAMA 0x06
00614 # endif
00615 # ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
00616 # define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
00617 # endif
00618 # ifndef SUBLANG_SPANISH_VENEZUELA
00619 # define SUBLANG_SPANISH_VENEZUELA 0x08
00620 # endif
00621 # ifndef SUBLANG_SPANISH_COLOMBIA
00622 # define SUBLANG_SPANISH_COLOMBIA 0x09
00623 # endif
00624 # ifndef SUBLANG_SPANISH_PERU
00625 # define SUBLANG_SPANISH_PERU 0x0a
00626 # endif
00627 # ifndef SUBLANG_SPANISH_ARGENTINA
00628 # define SUBLANG_SPANISH_ARGENTINA 0x0b
00629 # endif
00630 # ifndef SUBLANG_SPANISH_ECUADOR
00631 # define SUBLANG_SPANISH_ECUADOR 0x0c
00632 # endif
00633 # ifndef SUBLANG_SPANISH_CHILE
00634 # define SUBLANG_SPANISH_CHILE 0x0d
00635 # endif
00636 # ifndef SUBLANG_SPANISH_URUGUAY
00637 # define SUBLANG_SPANISH_URUGUAY 0x0e
00638 # endif
00639 # ifndef SUBLANG_SPANISH_PARAGUAY
00640 # define SUBLANG_SPANISH_PARAGUAY 0x0f
00641 # endif
00642 # ifndef SUBLANG_SPANISH_BOLIVIA
00643 # define SUBLANG_SPANISH_BOLIVIA 0x10
00644 # endif
00645 # ifndef SUBLANG_SPANISH_EL_SALVADOR
00646 # define SUBLANG_SPANISH_EL_SALVADOR 0x11
00647 # endif
00648 # ifndef SUBLANG_SPANISH_HONDURAS
00649 # define SUBLANG_SPANISH_HONDURAS 0x12
00650 # endif
00651 # ifndef SUBLANG_SPANISH_NICARAGUA
00652 # define SUBLANG_SPANISH_NICARAGUA 0x13
00653 # endif
00654 # ifndef SUBLANG_SPANISH_PUERTO_RICO
00655 # define SUBLANG_SPANISH_PUERTO_RICO 0x14
00656 # endif
00657 # ifndef SUBLANG_SWEDISH_FINLAND
00658 # define SUBLANG_SWEDISH_FINLAND 0x02
00659 # endif
00660 # ifndef SUBLANG_TAMAZIGHT_ARABIC
00661 # define SUBLANG_TAMAZIGHT_ARABIC 0x01
00662 # endif
00663 # ifndef SUBLANG_TAMAZIGHT_LATIN
00664 # define SUBLANG_TAMAZIGHT_LATIN 0x02
00665 # endif
00666 # ifndef SUBLANG_TIGRINYA_ETHIOPIA
00667 # define SUBLANG_TIGRINYA_ETHIOPIA 0x00
00668 # endif
00669 # ifndef SUBLANG_TIGRINYA_ERITREA
00670 # define SUBLANG_TIGRINYA_ERITREA 0x01
00671 # endif
00672 # ifndef SUBLANG_URDU_PAKISTAN
00673 # define SUBLANG_URDU_PAKISTAN 0x01
00674 # endif
00675 # ifndef SUBLANG_URDU_INDIA
00676 # define SUBLANG_URDU_INDIA 0x02
00677 # endif
00678 # ifndef SUBLANG_UZBEK_LATIN
00679 # define SUBLANG_UZBEK_LATIN 0x01
00680 # endif
00681 # ifndef SUBLANG_UZBEK_CYRILLIC
00682 # define SUBLANG_UZBEK_CYRILLIC 0x02
00683 # endif
00684 #endif
00685 
00686 /* XPG3 defines the result of 'setlocale (category, NULL)' as:
00687    "Directs 'setlocale()' to query 'category' and return the current
00688     setting of 'local'."
00689    However it does not specify the exact format.  Neither do SUSV2 and
00690    ISO C 99.  So we can use this feature only on selected systems (e.g.
00691    those using GNU C Library).  */
00692 #if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
00693 # define HAVE_LOCALE_NULL
00694 #endif
00695 
00696 /* Determine the current locale's name, and canonicalize it into XPG syntax
00697      language[_territory[.codeset]][@modifier]
00698    The codeset part in the result is not reliable; the locale_charset()
00699    should be used for codeset information instead.
00700    The result must not be freed; it is statically allocated.  */
00701 
00702 const char *
00703 _nl_locale_name (int category, const char *categoryname)
00704 {
00705   const char *retval;
00706 
00707 #ifndef WIN32
00708 
00709   /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
00710      On some systems this can be done by the 'setlocale' function itself.  */
00711 # if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
00712   retval = setlocale (category, NULL);
00713 # else
00714   /* Setting of LC_ALL overwrites all other.  */
00715   retval = getenv ("LC_ALL");
00716   if (retval == NULL || retval[0] == '\0')
00717     {
00718       /* Next comes the name of the desired category.  */
00719       retval = getenv (categoryname);
00720       if (retval == NULL || retval[0] == '\0')
00721        {
00722          /* Last possibility is the LANG environment variable.  */
00723          retval = getenv ("LANG");
00724          if (retval == NULL || retval[0] == '\0')
00725            /* We use C as the default domain.  POSIX says this is
00726               implementation defined.  */
00727            retval = "C";
00728        }
00729     }
00730 # endif
00731 
00732   return retval;
00733 
00734 #else /* WIN32 */
00735 
00736   /* Return an XPG style locale name language[_territory][@modifier].
00737      Don't even bother determining the codeset; it's not useful in this
00738      context, because message catalogs are not specific to a single
00739      codeset.  */
00740 
00741   LCID lcid;
00742   LANGID langid;
00743   int primary, sub;
00744 
00745   /* Let the user override the system settings through environment
00746      variables, as on POSIX systems.  */
00747   retval = getenv ("LC_ALL");
00748   if (retval != NULL && retval[0] != '\0')
00749     return retval;
00750   retval = getenv (categoryname);
00751   if (retval != NULL && retval[0] != '\0')
00752     return retval;
00753   retval = getenv ("LANG");
00754   if (retval != NULL && retval[0] != '\0')
00755     return retval;
00756 
00757   /* Use native Win32 API locale ID.  */
00758   lcid = GetThreadLocale ();
00759 
00760   /* Strip off the sorting rules, keep only the language part.  */
00761   langid = LANGIDFROMLCID (lcid);
00762 
00763   /* Split into language and territory part.  */
00764   primary = PRIMARYLANGID (langid);
00765   sub = SUBLANGID (langid);
00766 
00767   /* Dispatch on language.
00768      See also http://www.unicode.org/unicode/onlinedat/languages.html .
00769      For details about languages, see http://www.ethnologue.com/ .  */
00770   switch (primary)
00771     {
00772     case LANG_AFRIKAANS: return "af_ZA";
00773     case LANG_ALBANIAN: return "sq_AL";
00774     case LANG_AMHARIC: return "am_ET";
00775     case LANG_ARABIC:
00776       switch (sub)
00777        {
00778        case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA";
00779        case SUBLANG_ARABIC_IRAQ: return "ar_IQ";
00780        case SUBLANG_ARABIC_EGYPT: return "ar_EG";
00781        case SUBLANG_ARABIC_LIBYA: return "ar_LY";
00782        case SUBLANG_ARABIC_ALGERIA: return "ar_DZ";
00783        case SUBLANG_ARABIC_MOROCCO: return "ar_MA";
00784        case SUBLANG_ARABIC_TUNISIA: return "ar_TN";
00785        case SUBLANG_ARABIC_OMAN: return "ar_OM";
00786        case SUBLANG_ARABIC_YEMEN: return "ar_YE";
00787        case SUBLANG_ARABIC_SYRIA: return "ar_SY";
00788        case SUBLANG_ARABIC_JORDAN: return "ar_JO";
00789        case SUBLANG_ARABIC_LEBANON: return "ar_LB";
00790        case SUBLANG_ARABIC_KUWAIT: return "ar_KW";
00791        case SUBLANG_ARABIC_UAE: return "ar_AE";
00792        case SUBLANG_ARABIC_BAHRAIN: return "ar_BH";
00793        case SUBLANG_ARABIC_QATAR: return "ar_QA";
00794        }
00795       return "ar";
00796     case LANG_ARMENIAN: return "hy_AM";
00797     case LANG_ASSAMESE: return "as_IN";
00798     case LANG_AZERI:
00799       switch (sub)
00800        {
00801        /* FIXME: Adjust this when Azerbaijani locales appear on Unix.  */
00802        case SUBLANG_AZERI_LATIN: return "az_AZ@latin";
00803        case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic";
00804        }
00805       return "az";
00806     case LANG_BASQUE:
00807       return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR".  */
00808     case LANG_BELARUSIAN: return "be_BY";
00809     case LANG_BENGALI:
00810       switch (sub)
00811        {
00812        case SUBLANG_BENGALI_INDIA: return "bn_IN";
00813        case SUBLANG_BENGALI_BANGLADESH: return "bn_BD";
00814        }
00815       return "bn";
00816     case LANG_BULGARIAN: return "bg_BG";
00817     case LANG_BURMESE: return "my_MM";
00818     case LANG_CAMBODIAN: return "km_KH";
00819     case LANG_CATALAN: return "ca_ES";
00820     case LANG_CHEROKEE: return "chr_US";
00821     case LANG_CHINESE:
00822       switch (sub)
00823        {
00824        case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW";
00825        case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN";
00826        case SUBLANG_CHINESE_HONGKONG: return "zh_HK";
00827        case SUBLANG_CHINESE_SINGAPORE: return "zh_SG";
00828        case SUBLANG_CHINESE_MACAU: return "zh_MO";
00829        }
00830       return "zh";
00831     case LANG_CROATIAN:            /* LANG_CROATIAN == LANG_SERBIAN
00832                              * What used to be called Serbo-Croatian
00833                              * should really now be two separate
00834                              * languages because of political reasons.
00835                              * (Says tml, who knows nothing about Serbian
00836                              * or Croatian.)
00837                              * (I can feel those flames coming already.)
00838                              */
00839       switch (sub)
00840        {
00841        case SUBLANG_DEFAULT: return "hr_HR";
00842        case SUBLANG_SERBIAN_LATIN: return "sr_CS";
00843        case SUBLANG_SERBIAN_CYRILLIC: return "sr_CS@cyrillic";
00844        }
00845       return "hr";
00846     case LANG_CZECH: return "cs_CZ";
00847     case LANG_DANISH: return "da_DK";
00848     case LANG_DIVEHI: return "dv_MV";
00849     case LANG_DUTCH:
00850       switch (sub)
00851        {
00852        case SUBLANG_DUTCH: return "nl_NL";
00853        case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE";
00854        }
00855       return "nl";
00856     case LANG_EDO: return "bin_NG";
00857     case LANG_ENGLISH:
00858       switch (sub)
00859        {
00860        /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
00861         * English was the language spoken in England.
00862         * Oh well.
00863         */
00864        case SUBLANG_ENGLISH_US: return "en_US";
00865        case SUBLANG_ENGLISH_UK: return "en_GB";
00866        case SUBLANG_ENGLISH_AUS: return "en_AU";
00867        case SUBLANG_ENGLISH_CAN: return "en_CA";
00868        case SUBLANG_ENGLISH_NZ: return "en_NZ";
00869        case SUBLANG_ENGLISH_EIRE: return "en_IE";
00870        case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA";
00871        case SUBLANG_ENGLISH_JAMAICA: return "en_JM";
00872        case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */
00873        case SUBLANG_ENGLISH_BELIZE: return "en_BZ";
00874        case SUBLANG_ENGLISH_TRINIDAD: return "en_TT";
00875        case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW";
00876        case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH";
00877        case SUBLANG_ENGLISH_INDONESIA: return "en_ID";
00878        case SUBLANG_ENGLISH_HONGKONG: return "en_HK";
00879        case SUBLANG_ENGLISH_INDIA: return "en_IN";
00880        case SUBLANG_ENGLISH_MALAYSIA: return "en_MY";
00881        case SUBLANG_ENGLISH_SINGAPORE: return "en_SG";
00882        }
00883       return "en";
00884     case LANG_ESTONIAN: return "et_EE";
00885     case LANG_FAEROESE: return "fo_FO";
00886     case LANG_FARSI: return "fa_IR";
00887     case LANG_FINNISH: return "fi_FI";
00888     case LANG_FRENCH:
00889       switch (sub)
00890        {
00891        case SUBLANG_FRENCH: return "fr_FR";
00892        case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE";
00893        case SUBLANG_FRENCH_CANADIAN: return "fr_CA";
00894        case SUBLANG_FRENCH_SWISS: return "fr_CH";
00895        case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU";
00896        case SUBLANG_FRENCH_MONACO: return "fr_MC";
00897        case SUBLANG_FRENCH_WESTINDIES: return "fr"; /* Caribbean? */
00898        case SUBLANG_FRENCH_REUNION: return "fr_RE";
00899        case SUBLANG_FRENCH_CONGO: return "fr_CG";
00900        case SUBLANG_FRENCH_SENEGAL: return "fr_SN";
00901        case SUBLANG_FRENCH_CAMEROON: return "fr_CM";
00902        case SUBLANG_FRENCH_COTEDIVOIRE: return "fr_CI";
00903        case SUBLANG_FRENCH_MALI: return "fr_ML";
00904        case SUBLANG_FRENCH_MOROCCO: return "fr_MA";
00905        case SUBLANG_FRENCH_HAITI: return "fr_HT";
00906        }
00907       return "fr";
00908     case LANG_FRISIAN: return "fy_NL";
00909     case LANG_FULFULDE:
00910       /* Spoken in Nigeria, Guinea, Senegal, Mali, Niger, Cameroon, Benin. */
00911       return "ff_NG";
00912     case LANG_GAELIC:
00913       switch (sub)
00914        {
00915        case 0x01: /* SCOTTISH */ return "gd_GB";
00916        case 0x02: /* IRISH */ return "ga_IE";
00917        }
00918       return "C";
00919     case LANG_GALICIAN: return "gl_ES";
00920     case LANG_GEORGIAN: return "ka_GE";
00921     case LANG_GERMAN:
00922       switch (sub)
00923        {
00924        case SUBLANG_GERMAN: return "de_DE";
00925        case SUBLANG_GERMAN_SWISS: return "de_CH";
00926        case SUBLANG_GERMAN_AUSTRIAN: return "de_AT";
00927        case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU";
00928        case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI";
00929        }
00930       return "de";
00931     case LANG_GREEK: return "el_GR";
00932     case LANG_GUARANI: return "gn_PY";
00933     case LANG_GUJARATI: return "gu_IN";
00934     case LANG_HAUSA: return "ha_NG";
00935     case LANG_HAWAIIAN:
00936       /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers)
00937         or Hawaii Creole English ("cpe_US", 600000 speakers)?  */
00938       return "cpe_US";
00939     case LANG_HEBREW: return "he_IL";
00940     case LANG_HINDI: return "hi_IN";
00941     case LANG_HUNGARIAN: return "hu_HU";
00942     case LANG_IBIBIO: return "nic_NG";
00943     case LANG_ICELANDIC: return "is_IS";
00944     case LANG_IGBO: return "ig_NG";
00945     case LANG_INDONESIAN: return "id_ID";
00946     case LANG_INUKTITUT: return "iu_CA";
00947     case LANG_ITALIAN:
00948       switch (sub)
00949        {
00950        case SUBLANG_ITALIAN: return "it_IT";
00951        case SUBLANG_ITALIAN_SWISS: return "it_CH";
00952        }
00953       return "it";
00954     case LANG_JAPANESE: return "ja_JP";
00955     case LANG_KANNADA: return "kn_IN";
00956     case LANG_KANURI: return "kr_NG";
00957     case LANG_KASHMIRI:
00958       switch (sub)
00959        {
00960        case SUBLANG_DEFAULT: return "ks_PK";
00961        case SUBLANG_KASHMIRI_INDIA: return "ks_IN";
00962        }
00963       return "ks";
00964     case LANG_KAZAK: return "kk_KZ";
00965     case LANG_KONKANI:
00966       /* FIXME: Adjust this when such locales appear on Unix.  */
00967       return "kok_IN";
00968     case LANG_KOREAN: return "ko_KR";
00969     case LANG_KYRGYZ: return "ky_KG";
00970     case LANG_LAO: return "lo_LA";
00971     case LANG_LATIN: return "la_VA";
00972     case LANG_LATVIAN: return "lv_LV";
00973     case LANG_LITHUANIAN: return "lt_LT";
00974     case LANG_MACEDONIAN: return "mk_MK";
00975     case LANG_MALAY:
00976       switch (sub)
00977        {
00978        case SUBLANG_MALAY_MALAYSIA: return "ms_MY";
00979        case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN";
00980        }
00981       return "ms";
00982     case LANG_MALAYALAM: return "ml_IN";
00983     case LANG_MALTESE: return "mt_MT";
00984     case LANG_MANIPURI:
00985       /* FIXME: Adjust this when such locales appear on Unix.  */
00986       return "mni_IN";
00987     case LANG_MARATHI: return "mr_IN";
00988     case LANG_MONGOLIAN:
00989       return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN".  */
00990     case LANG_NEPALI:
00991       switch (sub)
00992        {
00993        case SUBLANG_DEFAULT: return "ne_NP";
00994        case SUBLANG_NEPALI_INDIA: return "ne_IN";
00995        }
00996       return "ne";
00997     case LANG_NORWEGIAN:
00998       switch (sub)
00999        {
01000        case SUBLANG_NORWEGIAN_BOKMAL: return "no_NO";
01001        case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO";
01002        }
01003       return "no";
01004     case LANG_ORIYA: return "or_IN";
01005     case LANG_OROMO: return "om_ET";
01006     case LANG_PAPIAMENTU: return "pap_AN";
01007     case LANG_PASHTO:
01008       return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF".  */
01009     case LANG_POLISH: return "pl_PL";
01010     case LANG_PORTUGUESE:
01011       switch (sub)
01012        {
01013        case SUBLANG_PORTUGUESE: return "pt_PT";
01014        /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
01015           Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
01016        case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR";
01017        }
01018       return "pt";
01019     case LANG_PUNJABI:
01020       switch (sub)
01021        {
01022        case SUBLANG_PUNJABI_INDIA: return "pa_IN"; /* Gurmukhi script */
01023        case SUBLANG_PUNJABI_PAKISTAN: return "pa_PK"; /* Arabic script */
01024        }
01025       return "pa";
01026     case LANG_RHAETO_ROMANCE: return "rm_CH";
01027     case LANG_ROMANIAN:
01028       switch (sub)
01029        {
01030        case SUBLANG_ROMANIAN_ROMANIA: return "ro_RO";
01031        case SUBLANG_ROMANIAN_MOLDOVA: return "ro_MD";
01032        }
01033       return "ro";
01034     case LANG_RUSSIAN:
01035       return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA" or "ru_MD".  */
01036     case LANG_SAAMI: /* actually Northern Sami */ return "se_NO";
01037     case LANG_SANSKRIT: return "sa_IN";
01038     case LANG_SINDHI:
01039       switch (sub)
01040        {
01041        case SUBLANG_SINDHI_INDIA: return "sd_IN";
01042        case SUBLANG_SINDHI_PAKISTAN: return "sd_PK";
01043        }
01044       return "sd";
01045     case LANG_SINHALESE: return "si_LK";
01046     case LANG_SLOVAK: return "sk_SK";
01047     case LANG_SLOVENIAN: return "sl_SI";
01048     case LANG_SOMALI: return "so_SO";
01049     case LANG_SORBIAN:
01050       /* FIXME: Adjust this when such locales appear on Unix.  */
01051       return "wen_DE";
01052     case LANG_SPANISH:
01053       switch (sub)
01054        {
01055        case SUBLANG_SPANISH: return "es_ES";
01056        case SUBLANG_SPANISH_MEXICAN: return "es_MX";
01057        case SUBLANG_SPANISH_MODERN:
01058          return "es_ES@modern";    /* not seen on Unix */
01059        case SUBLANG_SPANISH_GUATEMALA: return "es_GT";
01060        case SUBLANG_SPANISH_COSTA_RICA: return "es_CR";
01061        case SUBLANG_SPANISH_PANAMA: return "es_PA";
01062        case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO";
01063        case SUBLANG_SPANISH_VENEZUELA: return "es_VE";
01064        case SUBLANG_SPANISH_COLOMBIA: return "es_CO";
01065        case SUBLANG_SPANISH_PERU: return "es_PE";
01066        case SUBLANG_SPANISH_ARGENTINA: return "es_AR";
01067        case SUBLANG_SPANISH_ECUADOR: return "es_EC";
01068        case SUBLANG_SPANISH_CHILE: return "es_CL";
01069        case SUBLANG_SPANISH_URUGUAY: return "es_UY";
01070        case SUBLANG_SPANISH_PARAGUAY: return "es_PY";
01071        case SUBLANG_SPANISH_BOLIVIA: return "es_BO";
01072        case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV";
01073        case SUBLANG_SPANISH_HONDURAS: return "es_HN";
01074        case SUBLANG_SPANISH_NICARAGUA: return "es_NI";
01075        case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR";
01076        }
01077       return "es";
01078     case LANG_SUTU: return "bnt_TZ"; /* or "st_LS" or "nso_ZA"? */
01079     case LANG_SWAHILI: return "sw_KE";
01080     case LANG_SWEDISH:
01081       switch (sub)
01082        {
01083        case SUBLANG_DEFAULT: return "sv_SE";
01084        case SUBLANG_SWEDISH_FINLAND: return "sv_FI";
01085        }
01086       return "sv";
01087     case LANG_SYRIAC: return "syr_TR"; /* An extinct language.  */
01088     case LANG_TAGALOG: return "tl_PH";
01089     case LANG_TAJIK: return "tg_TJ";
01090     case LANG_TAMAZIGHT:
01091       switch (sub)
01092        {
01093        /* FIXME: Adjust this when Tamazight locales appear on Unix.  */
01094        case SUBLANG_TAMAZIGHT_ARABIC: return "ber_MA@arabic";
01095        case SUBLANG_TAMAZIGHT_LATIN: return "ber_MA@latin";
01096        }
01097       return "ber_MA";
01098     case LANG_TAMIL:
01099       return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG".  */
01100     case LANG_TATAR: return "tt_RU";
01101     case LANG_TELUGU: return "te_IN";
01102     case LANG_THAI: return "th_TH";
01103     case LANG_TIBETAN: return "bo_CN";
01104     case LANG_TIGRINYA:
01105       switch (sub)
01106        {
01107        case SUBLANG_TIGRINYA_ETHIOPIA: return "ti_ET";
01108        case SUBLANG_TIGRINYA_ERITREA: return "ti_ER";
01109        }
01110       return "ti";
01111     case LANG_TSONGA: return "ts_ZA";
01112     case LANG_TSWANA: return "tn_BW";
01113     case LANG_TURKISH: return "tr_TR";
01114     case LANG_TURKMEN: return "tk_TM";
01115     case LANG_UKRAINIAN: return "uk_UA";
01116     case LANG_URDU:
01117       switch (sub)
01118        {
01119        case SUBLANG_URDU_PAKISTAN: return "ur_PK";
01120        case SUBLANG_URDU_INDIA: return "ur_IN";
01121        }
01122       return "ur";
01123     case LANG_UZBEK:
01124       switch (sub)
01125        {
01126        case SUBLANG_UZBEK_LATIN: return "uz_UZ";
01127        case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic";
01128        }
01129       return "uz";
01130     case LANG_VENDA: return "ve_ZA";
01131     case LANG_VIETNAMESE: return "vi_VN";
01132     case LANG_WELSH: return "cy_GB";
01133     case LANG_XHOSA: return "xh_ZA";
01134     case LANG_YI: return "sit_CN";
01135     case LANG_YIDDISH: return "yi_IL";
01136     case LANG_YORUBA: return "yo_NG";
01137     case LANG_ZULU: return "zu_ZA";
01138     default: return "C";
01139     }
01140 
01141 #endif
01142 }