VirtualBox

source: kBuild/trunk/src/sed/intl/localename.c@ 2421

Last change on this file since 2421 was 599, checked in by bird, 18 years ago

GNU sed 4.1.5.

File size: 19.3 KB
Line 
1/* Determine the current selected locale.
2 Copyright (C) 1995-1999, 2000, 2001 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software Foundation,
16 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
17
18/* Written by Ulrich Drepper <[email protected]>, 1995. */
19/* Win32 code written by Tor Lillqvist <[email protected]>. */
20
21#ifdef HAVE_CONFIG_H
22# include <config.h>
23#endif
24
25#include <stdlib.h>
26#include <locale.h>
27
28#if defined _WIN32 || defined __WIN32__
29# undef WIN32 /* avoid warning on mingw32 */
30# define WIN32
31#endif
32
33#ifdef WIN32
34# define WIN32_LEAN_AND_MEAN
35# include <windows.h>
36/* Mingw headers don't have latest language and sublanguage codes. */
37# ifndef LANG_AFRIKAANS
38# define LANG_AFRIKAANS 0x36
39# endif
40# ifndef LANG_ALBANIAN
41# define LANG_ALBANIAN 0x1c
42# endif
43# ifndef LANG_ARABIC
44# define LANG_ARABIC 0x01
45# endif
46# ifndef LANG_ARMENIAN
47# define LANG_ARMENIAN 0x2b
48# endif
49# ifndef LANG_ASSAMESE
50# define LANG_ASSAMESE 0x4d
51# endif
52# ifndef LANG_AZERI
53# define LANG_AZERI 0x2c
54# endif
55# ifndef LANG_BASQUE
56# define LANG_BASQUE 0x2d
57# endif
58# ifndef LANG_BELARUSIAN
59# define LANG_BELARUSIAN 0x23
60# endif
61# ifndef LANG_BENGALI
62# define LANG_BENGALI 0x45
63# endif
64# ifndef LANG_CATALAN
65# define LANG_CATALAN 0x03
66# endif
67# ifndef LANG_ESTONIAN
68# define LANG_ESTONIAN 0x25
69# endif
70# ifndef LANG_FAEROESE
71# define LANG_FAEROESE 0x38
72# endif
73# ifndef LANG_FARSI
74# define LANG_FARSI 0x29
75# endif
76# ifndef LANG_GEORGIAN
77# define LANG_GEORGIAN 0x37
78# endif
79# ifndef LANG_GUJARATI
80# define LANG_GUJARATI 0x47
81# endif
82# ifndef LANG_HEBREW
83# define LANG_HEBREW 0x0d
84# endif
85# ifndef LANG_HINDI
86# define LANG_HINDI 0x39
87# endif
88# ifndef LANG_INDONESIAN
89# define LANG_INDONESIAN 0x21
90# endif
91# ifndef LANG_KANNADA
92# define LANG_KANNADA 0x4b
93# endif
94# ifndef LANG_KASHMIRI
95# define LANG_KASHMIRI 0x60
96# endif
97# ifndef LANG_KAZAK
98# define LANG_KAZAK 0x3f
99# endif
100# ifndef LANG_KONKANI
101# define LANG_KONKANI 0x57
102# endif
103# ifndef LANG_LATVIAN
104# define LANG_LATVIAN 0x26
105# endif
106# ifndef LANG_LITHUANIAN
107# define LANG_LITHUANIAN 0x27
108# endif
109# ifndef LANG_MACEDONIAN
110# define LANG_MACEDONIAN 0x2f
111# endif
112# ifndef LANG_MALAY
113# define LANG_MALAY 0x3e
114# endif
115# ifndef LANG_MALAYALAM
116# define LANG_MALAYALAM 0x4c
117# endif
118# ifndef LANG_MANIPURI
119# define LANG_MANIPURI 0x58
120# endif
121# ifndef LANG_MARATHI
122# define LANG_MARATHI 0x4e
123# endif
124# ifndef LANG_NEPALI
125# define LANG_NEPALI 0x61
126# endif
127# ifndef LANG_ORIYA
128# define LANG_ORIYA 0x48
129# endif
130# ifndef LANG_PUNJABI
131# define LANG_PUNJABI 0x46
132# endif
133# ifndef LANG_SANSKRIT
134# define LANG_SANSKRIT 0x4f
135# endif
136# ifndef LANG_SERBIAN
137# define LANG_SERBIAN 0x1a
138# endif
139# ifndef LANG_SINDHI
140# define LANG_SINDHI 0x59
141# endif
142# ifndef LANG_SLOVAK
143# define LANG_SLOVAK 0x1b
144# endif
145# ifndef LANG_SWAHILI
146# define LANG_SWAHILI 0x41
147# endif
148# ifndef LANG_SORBIAN
149# define LANG_SORBIAN 0x2e
150# endif
151# ifndef LANG_TAMIL
152# define LANG_TAMIL 0x49
153# endif
154# ifndef LANG_TATAR
155# define LANG_TATAR 0x44
156# endif
157# ifndef LANG_TELUGU
158# define LANG_TELUGU 0x4a
159# endif
160# ifndef LANG_THAI
161# define LANG_THAI 0x1e
162# endif
163# ifndef LANG_UKRAINIAN
164# define LANG_UKRAINIAN 0x22
165# endif
166# ifndef LANG_URDU
167# define LANG_URDU 0x20
168# endif
169# ifndef LANG_UZBEK
170# define LANG_UZBEK 0x43
171# endif
172# ifndef LANG_VIETNAMESE
173# define LANG_VIETNAMESE 0x2a
174# endif
175# ifndef SUBLANG_ARABIC_SAUDI_ARABIA
176# define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
177# endif
178# ifndef SUBLANG_ARABIC_IRAQ
179# define SUBLANG_ARABIC_IRAQ 0x02
180# endif
181# ifndef SUBLANG_ARABIC_EGYPT
182# define SUBLANG_ARABIC_EGYPT 0x03
183# endif
184# ifndef SUBLANG_ARABIC_LIBYA
185# define SUBLANG_ARABIC_LIBYA 0x04
186# endif
187# ifndef SUBLANG_ARABIC_ALGERIA
188# define SUBLANG_ARABIC_ALGERIA 0x05
189# endif
190# ifndef SUBLANG_ARABIC_MOROCCO
191# define SUBLANG_ARABIC_MOROCCO 0x06
192# endif
193# ifndef SUBLANG_ARABIC_TUNISIA
194# define SUBLANG_ARABIC_TUNISIA 0x07
195# endif
196# ifndef SUBLANG_ARABIC_OMAN
197# define SUBLANG_ARABIC_OMAN 0x08
198# endif
199# ifndef SUBLANG_ARABIC_YEMEN
200# define SUBLANG_ARABIC_YEMEN 0x09
201# endif
202# ifndef SUBLANG_ARABIC_SYRIA
203# define SUBLANG_ARABIC_SYRIA 0x0a
204# endif
205# ifndef SUBLANG_ARABIC_JORDAN
206# define SUBLANG_ARABIC_JORDAN 0x0b
207# endif
208# ifndef SUBLANG_ARABIC_LEBANON
209# define SUBLANG_ARABIC_LEBANON 0x0c
210# endif
211# ifndef SUBLANG_ARABIC_KUWAIT
212# define SUBLANG_ARABIC_KUWAIT 0x0d
213# endif
214# ifndef SUBLANG_ARABIC_UAE
215# define SUBLANG_ARABIC_UAE 0x0e
216# endif
217# ifndef SUBLANG_ARABIC_BAHRAIN
218# define SUBLANG_ARABIC_BAHRAIN 0x0f
219# endif
220# ifndef SUBLANG_ARABIC_QATAR
221# define SUBLANG_ARABIC_QATAR 0x10
222# endif
223# ifndef SUBLANG_AZERI_LATIN
224# define SUBLANG_AZERI_LATIN 0x01
225# endif
226# ifndef SUBLANG_AZERI_CYRILLIC
227# define SUBLANG_AZERI_CYRILLIC 0x02
228# endif
229# ifndef SUBLANG_CHINESE_MACAU
230# define SUBLANG_CHINESE_MACAU 0x05
231# endif
232# ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
233# define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
234# endif
235# ifndef SUBLANG_ENGLISH_JAMAICA
236# define SUBLANG_ENGLISH_JAMAICA 0x08
237# endif
238# ifndef SUBLANG_ENGLISH_CARIBBEAN
239# define SUBLANG_ENGLISH_CARIBBEAN 0x09
240# endif
241# ifndef SUBLANG_ENGLISH_BELIZE
242# define SUBLANG_ENGLISH_BELIZE 0x0a
243# endif
244# ifndef SUBLANG_ENGLISH_TRINIDAD
245# define SUBLANG_ENGLISH_TRINIDAD 0x0b
246# endif
247# ifndef SUBLANG_ENGLISH_ZIMBABWE
248# define SUBLANG_ENGLISH_ZIMBABWE 0x0c
249# endif
250# ifndef SUBLANG_ENGLISH_PHILIPPINES
251# define SUBLANG_ENGLISH_PHILIPPINES 0x0d
252# endif
253# ifndef SUBLANG_FRENCH_LUXEMBOURG
254# define SUBLANG_FRENCH_LUXEMBOURG 0x05
255# endif
256# ifndef SUBLANG_FRENCH_MONACO
257# define SUBLANG_FRENCH_MONACO 0x06
258# endif
259# ifndef SUBLANG_GERMAN_LUXEMBOURG
260# define SUBLANG_GERMAN_LUXEMBOURG 0x04
261# endif
262# ifndef SUBLANG_GERMAN_LIECHTENSTEIN
263# define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
264# endif
265# ifndef SUBLANG_KASHMIRI_INDIA
266# define SUBLANG_KASHMIRI_INDIA 0x02
267# endif
268# ifndef SUBLANG_MALAY_MALAYSIA
269# define SUBLANG_MALAY_MALAYSIA 0x01
270# endif
271# ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
272# define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
273# endif
274# ifndef SUBLANG_NEPALI_INDIA
275# define SUBLANG_NEPALI_INDIA 0x02
276# endif
277# ifndef SUBLANG_SERBIAN_LATIN
278# define SUBLANG_SERBIAN_LATIN 0x02
279# endif
280# ifndef SUBLANG_SERBIAN_CYRILLIC
281# define SUBLANG_SERBIAN_CYRILLIC 0x03
282# endif
283# ifndef SUBLANG_SPANISH_GUATEMALA
284# define SUBLANG_SPANISH_GUATEMALA 0x04
285# endif
286# ifndef SUBLANG_SPANISH_COSTA_RICA
287# define SUBLANG_SPANISH_COSTA_RICA 0x05
288# endif
289# ifndef SUBLANG_SPANISH_PANAMA
290# define SUBLANG_SPANISH_PANAMA 0x06
291# endif
292# ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
293# define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
294# endif
295# ifndef SUBLANG_SPANISH_VENEZUELA
296# define SUBLANG_SPANISH_VENEZUELA 0x08
297# endif
298# ifndef SUBLANG_SPANISH_COLOMBIA
299# define SUBLANG_SPANISH_COLOMBIA 0x09
300# endif
301# ifndef SUBLANG_SPANISH_PERU
302# define SUBLANG_SPANISH_PERU 0x0a
303# endif
304# ifndef SUBLANG_SPANISH_ARGENTINA
305# define SUBLANG_SPANISH_ARGENTINA 0x0b
306# endif
307# ifndef SUBLANG_SPANISH_ECUADOR
308# define SUBLANG_SPANISH_ECUADOR 0x0c
309# endif
310# ifndef SUBLANG_SPANISH_CHILE
311# define SUBLANG_SPANISH_CHILE 0x0d
312# endif
313# ifndef SUBLANG_SPANISH_URUGUAY
314# define SUBLANG_SPANISH_URUGUAY 0x0e
315# endif
316# ifndef SUBLANG_SPANISH_PARAGUAY
317# define SUBLANG_SPANISH_PARAGUAY 0x0f
318# endif
319# ifndef SUBLANG_SPANISH_BOLIVIA
320# define SUBLANG_SPANISH_BOLIVIA 0x10
321# endif
322# ifndef SUBLANG_SPANISH_EL_SALVADOR
323# define SUBLANG_SPANISH_EL_SALVADOR 0x11
324# endif
325# ifndef SUBLANG_SPANISH_HONDURAS
326# define SUBLANG_SPANISH_HONDURAS 0x12
327# endif
328# ifndef SUBLANG_SPANISH_NICARAGUA
329# define SUBLANG_SPANISH_NICARAGUA 0x13
330# endif
331# ifndef SUBLANG_SPANISH_PUERTO_RICO
332# define SUBLANG_SPANISH_PUERTO_RICO 0x14
333# endif
334# ifndef SUBLANG_SWEDISH_FINLAND
335# define SUBLANG_SWEDISH_FINLAND 0x02
336# endif
337# ifndef SUBLANG_URDU_PAKISTAN
338# define SUBLANG_URDU_PAKISTAN 0x01
339# endif
340# ifndef SUBLANG_URDU_INDIA
341# define SUBLANG_URDU_INDIA 0x02
342# endif
343# ifndef SUBLANG_UZBEK_LATIN
344# define SUBLANG_UZBEK_LATIN 0x01
345# endif
346# ifndef SUBLANG_UZBEK_CYRILLIC
347# define SUBLANG_UZBEK_CYRILLIC 0x02
348# endif
349#endif
350
351/* XPG3 defines the result of 'setlocale (category, NULL)' as:
352 "Directs 'setlocale()' to query 'category' and return the current
353 setting of 'local'."
354 However it does not specify the exact format. Neither do SUSV2 and
355 ISO C 99. So we can use this feature only on selected systems (e.g.
356 those using GNU C Library). */
357#if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
358# define HAVE_LOCALE_NULL
359#endif
360
361/* Determine the current locale's name, and canonicalize it into XPG syntax
362 language[_territory[.codeset]][@modifier]
363 The codeset part in the result is not reliable; the locale_charset()
364 should be used for codeset information instead.
365 The result must not be freed; it is statically allocated. */
366
367const char *
368_nl_locale_name (category, categoryname)
369 int category;
370 const char *categoryname;
371{
372 const char *retval;
373
374#ifndef WIN32
375
376 /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
377 On some systems this can be done by the 'setlocale' function itself. */
378# if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
379 retval = setlocale (category, NULL);
380# else
381 /* Setting of LC_ALL overwrites all other. */
382 retval = getenv ("LC_ALL");
383 if (retval == NULL || retval[0] == '\0')
384 {
385 /* Next comes the name of the desired category. */
386 retval = getenv (categoryname);
387 if (retval == NULL || retval[0] == '\0')
388 {
389 /* Last possibility is the LANG environment variable. */
390 retval = getenv ("LANG");
391 if (retval == NULL || retval[0] == '\0')
392 /* We use C as the default domain. POSIX says this is
393 implementation defined. */
394 retval = "C";
395 }
396 }
397# endif
398
399 return retval;
400
401#else /* WIN32 */
402
403 /* Return an XPG style locale name language[_territory][@modifier].
404 Don't even bother determining the codeset; it's not useful in this
405 context, because message catalogs are not specific to a single
406 codeset. */
407
408 LCID lcid;
409 LANGID langid;
410 int primary, sub;
411
412 /* Let the user override the system settings through environment
413 variables, as on POSIX systems. */
414 retval = getenv ("LC_ALL");
415 if (retval != NULL && retval[0] != '\0')
416 return retval;
417 retval = getenv (categoryname);
418 if (retval != NULL && retval[0] != '\0')
419 return retval;
420 retval = getenv ("LANG");
421 if (retval != NULL && retval[0] != '\0')
422 return retval;
423
424 /* Use native Win32 API locale ID. */
425 lcid = GetThreadLocale ();
426
427 /* Strip off the sorting rules, keep only the language part. */
428 langid = LANGIDFROMLCID (lcid);
429
430 /* Split into language and territory part. */
431 primary = PRIMARYLANGID (langid);
432 sub = SUBLANGID (langid);
433 switch (primary)
434 {
435 case LANG_AFRIKAANS: return "af_ZA";
436 case LANG_ALBANIAN: return "sq_AL";
437 case LANG_ARABIC:
438 switch (sub)
439 {
440 case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA";
441 case SUBLANG_ARABIC_IRAQ: return "ar_IQ";
442 case SUBLANG_ARABIC_EGYPT: return "ar_EG";
443 case SUBLANG_ARABIC_LIBYA: return "ar_LY";
444 case SUBLANG_ARABIC_ALGERIA: return "ar_DZ";
445 case SUBLANG_ARABIC_MOROCCO: return "ar_MA";
446 case SUBLANG_ARABIC_TUNISIA: return "ar_TN";
447 case SUBLANG_ARABIC_OMAN: return "ar_OM";
448 case SUBLANG_ARABIC_YEMEN: return "ar_YE";
449 case SUBLANG_ARABIC_SYRIA: return "ar_SY";
450 case SUBLANG_ARABIC_JORDAN: return "ar_JO";
451 case SUBLANG_ARABIC_LEBANON: return "ar_LB";
452 case SUBLANG_ARABIC_KUWAIT: return "ar_KW";
453 case SUBLANG_ARABIC_UAE: return "ar_AE";
454 case SUBLANG_ARABIC_BAHRAIN: return "ar_BH";
455 case SUBLANG_ARABIC_QATAR: return "ar_QA";
456 }
457 return "ar";
458 case LANG_ARMENIAN: return "hy_AM";
459 case LANG_ASSAMESE: return "as_IN";
460 case LANG_AZERI:
461 switch (sub)
462 {
463 /* FIXME: Adjust this when Azerbaijani locales appear on Unix. */
464 case SUBLANG_AZERI_LATIN: return "az_AZ@latin";
465 case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic";
466 }
467 return "az";
468 case LANG_BASQUE:
469 return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR". */
470 case LANG_BELARUSIAN: return "be_BY";
471 case LANG_BENGALI: return "bn_IN";
472 case LANG_BULGARIAN: return "bg_BG";
473 case LANG_CATALAN: return "ca_ES";
474 case LANG_CHINESE:
475 switch (sub)
476 {
477 case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW";
478 case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN";
479 case SUBLANG_CHINESE_HONGKONG: return "zh_HK";
480 case SUBLANG_CHINESE_SINGAPORE: return "zh_SG";
481 case SUBLANG_CHINESE_MACAU: return "zh_MO";
482 }
483 return "zh";
484 case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN
485 * What used to be called Serbo-Croatian
486 * should really now be two separate
487 * languages because of political reasons.
488 * (Says tml, who knows nothing about Serbian
489 * or Croatian.)
490 * (I can feel those flames coming already.)
491 */
492 switch (sub)
493 {
494 /* FIXME: How to distinguish Croatian and Latin Serbian locales? */
495 case SUBLANG_SERBIAN_LATIN: return "sr_YU";
496 case SUBLANG_SERBIAN_CYRILLIC: return "sr_YU@cyrillic";
497 default: return "hr_HR";
498 }
499 case LANG_CZECH: return "cs_CZ";
500 case LANG_DANISH: return "da_DK";
501 case LANG_DUTCH:
502 switch (sub)
503 {
504 case SUBLANG_DUTCH: return "nl_NL";
505 case SUBLANG_DUTCH_BELGIAN: return "nl_BE";
506 }
507 return "nl";
508 case LANG_ENGLISH:
509 switch (sub)
510 {
511 /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
512 * English was the language spoken in England.
513 * Oh well.
514 */
515 case SUBLANG_ENGLISH_US: return "en_US";
516 case SUBLANG_ENGLISH_UK: return "en_GB";
517 case SUBLANG_ENGLISH_AUS: return "en_AU";
518 case SUBLANG_ENGLISH_CAN: return "en_CA";
519 case SUBLANG_ENGLISH_NZ: return "en_NZ";
520 case SUBLANG_ENGLISH_EIRE: return "en_IE";
521 case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA";
522 case SUBLANG_ENGLISH_JAMAICA: return "en_JM";
523 case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */
524 case SUBLANG_ENGLISH_BELIZE: return "en_BZ";
525 case SUBLANG_ENGLISH_TRINIDAD: return "en_TT";
526 case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW";
527 case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH";
528 }
529 return "en";
530 case LANG_ESTONIAN: return "et_EE";
531 case LANG_FAEROESE: return "fo_FO";
532 case LANG_FARSI: return "fa_IR";
533 case LANG_FINNISH: return "fi_FI";
534 case LANG_FRENCH:
535 switch (sub)
536 {
537 case SUBLANG_FRENCH: return "fr_FR";
538 case SUBLANG_FRENCH_BELGIAN: return "fr_BE";
539 case SUBLANG_FRENCH_CANADIAN: return "fr_CA";
540 case SUBLANG_FRENCH_SWISS: return "fr_CH";
541 case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU";
542 case SUBLANG_FRENCH_MONACO: return "fr_MC";
543 }
544 return "fr";
545 case LANG_GEORGIAN: return "ka_GE";
546 case LANG_GERMAN:
547 switch (sub)
548 {
549 case SUBLANG_GERMAN: return "de_DE";
550 case SUBLANG_GERMAN_SWISS: return "de_CH";
551 case SUBLANG_GERMAN_AUSTRIAN: return "de_AT";
552 case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU";
553 case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI";
554 }
555 return "de";
556 case LANG_GREEK: return "el_GR";
557 case LANG_GUJARATI: return "gu_IN";
558 case LANG_HEBREW: return "he_IL";
559 case LANG_HINDI: return "hi_IN";
560 case LANG_HUNGARIAN: return "hu_HU";
561 case LANG_ICELANDIC: return "is_IS";
562 case LANG_INDONESIAN: return "id_ID";
563 case LANG_ITALIAN:
564 switch (sub)
565 {
566 case SUBLANG_ITALIAN: return "it_IT";
567 case SUBLANG_ITALIAN_SWISS: return "it_CH";
568 }
569 return "it";
570 case LANG_JAPANESE: return "ja_JP";
571 case LANG_KANNADA: return "kn_IN";
572 case LANG_KASHMIRI:
573 switch (sub)
574 {
575 case SUBLANG_DEFAULT: return "ks_PK";
576 case SUBLANG_KASHMIRI_INDIA: return "ks_IN";
577 }
578 return "ks";
579 case LANG_KAZAK: return "kk_KZ";
580 case LANG_KONKANI:
581 /* FIXME: Adjust this when such locales appear on Unix. */
582 return "kok_IN";
583 case LANG_KOREAN: return "ko_KR";
584 case LANG_LATVIAN: return "lv_LV";
585 case LANG_LITHUANIAN: return "lt_LT";
586 case LANG_MACEDONIAN: return "mk_MK";
587 case LANG_MALAY:
588 switch (sub)
589 {
590 case SUBLANG_MALAY_MALAYSIA: return "ms_MY";
591 case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN";
592 }
593 return "ms";
594 case LANG_MALAYALAM: return "ml_IN";
595 case LANG_MANIPURI:
596 /* FIXME: Adjust this when such locales appear on Unix. */
597 return "mni_IN";
598 case LANG_MARATHI: return "mr_IN";
599 case LANG_NEPALI:
600 switch (sub)
601 {
602 case SUBLANG_DEFAULT: return "ne_NP";
603 case SUBLANG_NEPALI_INDIA: return "ne_IN";
604 }
605 return "ne";
606 case LANG_NORWEGIAN:
607 switch (sub)
608 {
609 case SUBLANG_NORWEGIAN_BOKMAL: return "no_NO";
610 case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO";
611 }
612 return "no";
613 case LANG_ORIYA: return "or_IN";
614 case LANG_POLISH: return "pl_PL";
615 case LANG_PORTUGUESE:
616 switch (sub)
617 {
618 case SUBLANG_PORTUGUESE: return "pt_PT";
619 /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
620 Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
621 case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR";
622 }
623 return "pt";
624 case LANG_PUNJABI: return "pa_IN";
625 case LANG_ROMANIAN: return "ro_RO";
626 case LANG_RUSSIAN:
627 return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA". */
628 case LANG_SANSKRIT: return "sa_IN";
629 case LANG_SINDHI: return "sd";
630 case LANG_SLOVAK: return "sk_SK";
631 case LANG_SLOVENIAN: return "sl_SI";
632 case LANG_SORBIAN:
633 /* FIXME: Adjust this when such locales appear on Unix. */
634 return "wen_DE";
635 case LANG_SPANISH:
636 switch (sub)
637 {
638 case SUBLANG_SPANISH: return "es_ES";
639 case SUBLANG_SPANISH_MEXICAN: return "es_MX";
640 case SUBLANG_SPANISH_MODERN:
641 return "es_ES@modern"; /* not seen on Unix */
642 case SUBLANG_SPANISH_GUATEMALA: return "es_GT";
643 case SUBLANG_SPANISH_COSTA_RICA: return "es_CR";
644 case SUBLANG_SPANISH_PANAMA: return "es_PA";
645 case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO";
646 case SUBLANG_SPANISH_VENEZUELA: return "es_VE";
647 case SUBLANG_SPANISH_COLOMBIA: return "es_CO";
648 case SUBLANG_SPANISH_PERU: return "es_PE";
649 case SUBLANG_SPANISH_ARGENTINA: return "es_AR";
650 case SUBLANG_SPANISH_ECUADOR: return "es_EC";
651 case SUBLANG_SPANISH_CHILE: return "es_CL";
652 case SUBLANG_SPANISH_URUGUAY: return "es_UY";
653 case SUBLANG_SPANISH_PARAGUAY: return "es_PY";
654 case SUBLANG_SPANISH_BOLIVIA: return "es_BO";
655 case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV";
656 case SUBLANG_SPANISH_HONDURAS: return "es_HN";
657 case SUBLANG_SPANISH_NICARAGUA: return "es_NI";
658 case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR";
659 }
660 return "es";
661 case LANG_SWAHILI: return "sw";
662 case LANG_SWEDISH:
663 switch (sub)
664 {
665 case SUBLANG_DEFAULT: return "sv_SE";
666 case SUBLANG_SWEDISH_FINLAND: return "sv_FI";
667 }
668 return "sv";
669 case LANG_TAMIL:
670 return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG". */
671 case LANG_TATAR: return "tt";
672 case LANG_TELUGU: return "te_IN";
673 case LANG_THAI: return "th_TH";
674 case LANG_TURKISH: return "tr_TR";
675 case LANG_UKRAINIAN: return "uk_UA";
676 case LANG_URDU:
677 switch (sub)
678 {
679 case SUBLANG_URDU_PAKISTAN: return "ur_PK";
680 case SUBLANG_URDU_INDIA: return "ur_IN";
681 }
682 return "ur";
683 case LANG_UZBEK:
684 switch (sub)
685 {
686 /* FIXME: Adjust this when Uzbek locales appear on Unix. */
687 case SUBLANG_UZBEK_LATIN: return "uz_UZ@latin";
688 case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic";
689 }
690 return "uz";
691 case LANG_VIETNAMESE: return "vi_VN";
692 default: return "C";
693 }
694
695#endif
696}
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette