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