Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | File Members | Related Pages

localename.c

00001 /* Determine the current selected locale.
00002    Copyright (C) 1995-1999, 2000-2002 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 <[email protected]>, 1995.  */
00020 /* Win32 code written by Tor Lillqvist <[email protected]>.  */
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 /* Mingw headers don't have latest language and sublanguage codes.  */
00038 # ifndef LANG_AFRIKAANS
00039 # define LANG_AFRIKAANS 0x36
00040 # endif
00041 # ifndef LANG_ALBANIAN
00042 # define LANG_ALBANIAN 0x1c
00043 # endif
00044 # ifndef LANG_ARABIC
00045 # define LANG_ARABIC 0x01
00046 # endif
00047 # ifndef LANG_ARMENIAN
00048 # define LANG_ARMENIAN 0x2b
00049 # endif
00050 # ifndef LANG_ASSAMESE
00051 # define LANG_ASSAMESE 0x4d
00052 # endif
00053 # ifndef LANG_AZERI
00054 # define LANG_AZERI 0x2c
00055 # endif
00056 # ifndef LANG_BASQUE
00057 # define LANG_BASQUE 0x2d
00058 # endif
00059 # ifndef LANG_BELARUSIAN
00060 # define LANG_BELARUSIAN 0x23
00061 # endif
00062 # ifndef LANG_BENGALI
00063 # define LANG_BENGALI 0x45
00064 # endif
00065 # ifndef LANG_CATALAN
00066 # define LANG_CATALAN 0x03
00067 # endif
00068 # ifndef LANG_DIVEHI
00069 # define LANG_DIVEHI 0x65
00070 # endif
00071 # ifndef LANG_ESTONIAN
00072 # define LANG_ESTONIAN 0x25
00073 # endif
00074 # ifndef LANG_FAEROESE
00075 # define LANG_FAEROESE 0x38
00076 # endif
00077 # ifndef LANG_FARSI
00078 # define LANG_FARSI 0x29
00079 # endif
00080 # ifndef LANG_GALICIAN
00081 # define LANG_GALICIAN 0x56
00082 # endif
00083 # ifndef LANG_GEORGIAN
00084 # define LANG_GEORGIAN 0x37
00085 # endif
00086 # ifndef LANG_GUJARATI
00087 # define LANG_GUJARATI 0x47
00088 # endif
00089 # ifndef LANG_HEBREW
00090 # define LANG_HEBREW 0x0d
00091 # endif
00092 # ifndef LANG_HINDI
00093 # define LANG_HINDI 0x39
00094 # endif
00095 # ifndef LANG_INDONESIAN
00096 # define LANG_INDONESIAN 0x21
00097 # endif
00098 # ifndef LANG_KANNADA
00099 # define LANG_KANNADA 0x4b
00100 # endif
00101 # ifndef LANG_KASHMIRI
00102 # define LANG_KASHMIRI 0x60
00103 # endif
00104 # ifndef LANG_KAZAK
00105 # define LANG_KAZAK 0x3f
00106 # endif
00107 # ifndef LANG_KONKANI
00108 # define LANG_KONKANI 0x57
00109 # endif
00110 # ifndef LANG_KYRGYZ
00111 # define LANG_KYRGYZ 0x40
00112 # endif
00113 # ifndef LANG_LATVIAN
00114 # define LANG_LATVIAN 0x26
00115 # endif
00116 # ifndef LANG_LITHUANIAN
00117 # define LANG_LITHUANIAN 0x27
00118 # endif
00119 # ifndef LANG_MACEDONIAN
00120 # define LANG_MACEDONIAN 0x2f
00121 # endif
00122 # ifndef LANG_MALAY
00123 # define LANG_MALAY 0x3e
00124 # endif
00125 # ifndef LANG_MALAYALAM
00126 # define LANG_MALAYALAM 0x4c
00127 # endif
00128 # ifndef LANG_MANIPURI
00129 # define LANG_MANIPURI 0x58
00130 # endif
00131 # ifndef LANG_MARATHI
00132 # define LANG_MARATHI 0x4e
00133 # endif
00134 # ifndef LANG_MONGOLIAN
00135 # define LANG_MONGOLIAN 0x50
00136 # endif
00137 # ifndef LANG_NEPALI
00138 # define LANG_NEPALI 0x61
00139 # endif
00140 # ifndef LANG_ORIYA
00141 # define LANG_ORIYA 0x48
00142 # endif
00143 # ifndef LANG_PUNJABI
00144 # define LANG_PUNJABI 0x46
00145 # endif
00146 # ifndef LANG_SANSKRIT
00147 # define LANG_SANSKRIT 0x4f
00148 # endif
00149 # ifndef LANG_SERBIAN
00150 # define LANG_SERBIAN 0x1a
00151 # endif
00152 # ifndef LANG_SINDHI
00153 # define LANG_SINDHI 0x59
00154 # endif
00155 # ifndef LANG_SLOVAK
00156 # define LANG_SLOVAK 0x1b
00157 # endif
00158 # ifndef LANG_SORBIAN
00159 # define LANG_SORBIAN 0x2e
00160 # endif
00161 # ifndef LANG_SWAHILI
00162 # define LANG_SWAHILI 0x41
00163 # endif
00164 # ifndef LANG_SYRIAC
00165 # define LANG_SYRIAC 0x5a
00166 # endif
00167 # ifndef LANG_TAMIL
00168 # define LANG_TAMIL 0x49
00169 # endif
00170 # ifndef LANG_TATAR
00171 # define LANG_TATAR 0x44
00172 # endif
00173 # ifndef LANG_TELUGU
00174 # define LANG_TELUGU 0x4a
00175 # endif
00176 # ifndef LANG_THAI
00177 # define LANG_THAI 0x1e
00178 # endif
00179 # ifndef LANG_UKRAINIAN
00180 # define LANG_UKRAINIAN 0x22
00181 # endif
00182 # ifndef LANG_URDU
00183 # define LANG_URDU 0x20
00184 # endif
00185 # ifndef LANG_UZBEK
00186 # define LANG_UZBEK 0x43
00187 # endif
00188 # ifndef LANG_VIETNAMESE
00189 # define LANG_VIETNAMESE 0x2a
00190 # endif
00191 # ifndef SUBLANG_ARABIC_SAUDI_ARABIA
00192 # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
00193 # endif
00194 # ifndef SUBLANG_ARABIC_IRAQ
00195 # define SUBLANG_ARABIC_IRAQ 0x02
00196 # endif
00197 # ifndef SUBLANG_ARABIC_EGYPT
00198 # define SUBLANG_ARABIC_EGYPT 0x03
00199 # endif
00200 # ifndef SUBLANG_ARABIC_LIBYA
00201 # define SUBLANG_ARABIC_LIBYA 0x04
00202 # endif
00203 # ifndef SUBLANG_ARABIC_ALGERIA
00204 # define SUBLANG_ARABIC_ALGERIA 0x05
00205 # endif
00206 # ifndef SUBLANG_ARABIC_MOROCCO
00207 # define SUBLANG_ARABIC_MOROCCO 0x06
00208 # endif
00209 # ifndef SUBLANG_ARABIC_TUNISIA
00210 # define SUBLANG_ARABIC_TUNISIA 0x07
00211 # endif
00212 # ifndef SUBLANG_ARABIC_OMAN
00213 # define SUBLANG_ARABIC_OMAN 0x08
00214 # endif
00215 # ifndef SUBLANG_ARABIC_YEMEN
00216 # define SUBLANG_ARABIC_YEMEN 0x09
00217 # endif
00218 # ifndef SUBLANG_ARABIC_SYRIA
00219 # define SUBLANG_ARABIC_SYRIA 0x0a
00220 # endif
00221 # ifndef SUBLANG_ARABIC_JORDAN
00222 # define SUBLANG_ARABIC_JORDAN 0x0b
00223 # endif
00224 # ifndef SUBLANG_ARABIC_LEBANON
00225 # define SUBLANG_ARABIC_LEBANON 0x0c
00226 # endif
00227 # ifndef SUBLANG_ARABIC_KUWAIT
00228 # define SUBLANG_ARABIC_KUWAIT 0x0d
00229 # endif
00230 # ifndef SUBLANG_ARABIC_UAE
00231 # define SUBLANG_ARABIC_UAE 0x0e
00232 # endif
00233 # ifndef SUBLANG_ARABIC_BAHRAIN
00234 # define SUBLANG_ARABIC_BAHRAIN 0x0f
00235 # endif
00236 # ifndef SUBLANG_ARABIC_QATAR
00237 # define SUBLANG_ARABIC_QATAR 0x10
00238 # endif
00239 # ifndef SUBLANG_AZERI_LATIN
00240 # define SUBLANG_AZERI_LATIN 0x01
00241 # endif
00242 # ifndef SUBLANG_AZERI_CYRILLIC
00243 # define SUBLANG_AZERI_CYRILLIC 0x02
00244 # endif
00245 # ifndef SUBLANG_CHINESE_MACAU
00246 # define SUBLANG_CHINESE_MACAU 0x05
00247 # endif
00248 # ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
00249 # define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
00250 # endif
00251 # ifndef SUBLANG_ENGLISH_JAMAICA
00252 # define SUBLANG_ENGLISH_JAMAICA 0x08
00253 # endif
00254 # ifndef SUBLANG_ENGLISH_CARIBBEAN
00255 # define SUBLANG_ENGLISH_CARIBBEAN 0x09
00256 # endif
00257 # ifndef SUBLANG_ENGLISH_BELIZE
00258 # define SUBLANG_ENGLISH_BELIZE 0x0a
00259 # endif
00260 # ifndef SUBLANG_ENGLISH_TRINIDAD
00261 # define SUBLANG_ENGLISH_TRINIDAD 0x0b
00262 # endif
00263 # ifndef SUBLANG_ENGLISH_ZIMBABWE
00264 # define SUBLANG_ENGLISH_ZIMBABWE 0x0c
00265 # endif
00266 # ifndef SUBLANG_ENGLISH_PHILIPPINES
00267 # define SUBLANG_ENGLISH_PHILIPPINES 0x0d
00268 # endif
00269 # ifndef SUBLANG_FRENCH_LUXEMBOURG
00270 # define SUBLANG_FRENCH_LUXEMBOURG 0x05
00271 # endif
00272 # ifndef SUBLANG_FRENCH_MONACO
00273 # define SUBLANG_FRENCH_MONACO 0x06
00274 # endif
00275 # ifndef SUBLANG_GERMAN_LUXEMBOURG
00276 # define SUBLANG_GERMAN_LUXEMBOURG 0x04
00277 # endif
00278 # ifndef SUBLANG_GERMAN_LIECHTENSTEIN
00279 # define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
00280 # endif
00281 # ifndef SUBLANG_KASHMIRI_INDIA
00282 # define SUBLANG_KASHMIRI_INDIA 0x02
00283 # endif
00284 # ifndef SUBLANG_MALAY_MALAYSIA
00285 # define SUBLANG_MALAY_MALAYSIA 0x01
00286 # endif
00287 # ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
00288 # define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
00289 # endif
00290 # ifndef SUBLANG_NEPALI_INDIA
00291 # define SUBLANG_NEPALI_INDIA 0x02
00292 # endif
00293 # ifndef SUBLANG_SERBIAN_LATIN
00294 # define SUBLANG_SERBIAN_LATIN 0x02
00295 # endif
00296 # ifndef SUBLANG_SERBIAN_CYRILLIC
00297 # define SUBLANG_SERBIAN_CYRILLIC 0x03
00298 # endif
00299 # ifndef SUBLANG_SPANISH_GUATEMALA
00300 # define SUBLANG_SPANISH_GUATEMALA 0x04
00301 # endif
00302 # ifndef SUBLANG_SPANISH_COSTA_RICA
00303 # define SUBLANG_SPANISH_COSTA_RICA 0x05
00304 # endif
00305 # ifndef SUBLANG_SPANISH_PANAMA
00306 # define SUBLANG_SPANISH_PANAMA 0x06
00307 # endif
00308 # ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
00309 # define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
00310 # endif
00311 # ifndef SUBLANG_SPANISH_VENEZUELA
00312 # define SUBLANG_SPANISH_VENEZUELA 0x08
00313 # endif
00314 # ifndef SUBLANG_SPANISH_COLOMBIA
00315 # define SUBLANG_SPANISH_COLOMBIA 0x09
00316 # endif
00317 # ifndef SUBLANG_SPANISH_PERU
00318 # define SUBLANG_SPANISH_PERU 0x0a
00319 # endif
00320 # ifndef SUBLANG_SPANISH_ARGENTINA
00321 # define SUBLANG_SPANISH_ARGENTINA 0x0b
00322 # endif
00323 # ifndef SUBLANG_SPANISH_ECUADOR
00324 # define SUBLANG_SPANISH_ECUADOR 0x0c
00325 # endif
00326 # ifndef SUBLANG_SPANISH_CHILE
00327 # define SUBLANG_SPANISH_CHILE 0x0d
00328 # endif
00329 # ifndef SUBLANG_SPANISH_URUGUAY
00330 # define SUBLANG_SPANISH_URUGUAY 0x0e
00331 # endif
00332 # ifndef SUBLANG_SPANISH_PARAGUAY
00333 # define SUBLANG_SPANISH_PARAGUAY 0x0f
00334 # endif
00335 # ifndef SUBLANG_SPANISH_BOLIVIA
00336 # define SUBLANG_SPANISH_BOLIVIA 0x10
00337 # endif
00338 # ifndef SUBLANG_SPANISH_EL_SALVADOR
00339 # define SUBLANG_SPANISH_EL_SALVADOR 0x11
00340 # endif
00341 # ifndef SUBLANG_SPANISH_HONDURAS
00342 # define SUBLANG_SPANISH_HONDURAS 0x12
00343 # endif
00344 # ifndef SUBLANG_SPANISH_NICARAGUA
00345 # define SUBLANG_SPANISH_NICARAGUA 0x13
00346 # endif
00347 # ifndef SUBLANG_SPANISH_PUERTO_RICO
00348 # define SUBLANG_SPANISH_PUERTO_RICO 0x14
00349 # endif
00350 # ifndef SUBLANG_SWEDISH_FINLAND
00351 # define SUBLANG_SWEDISH_FINLAND 0x02
00352 # endif
00353 # ifndef SUBLANG_URDU_PAKISTAN
00354 # define SUBLANG_URDU_PAKISTAN 0x01
00355 # endif
00356 # ifndef SUBLANG_URDU_INDIA
00357 # define SUBLANG_URDU_INDIA 0x02
00358 # endif
00359 # ifndef SUBLANG_UZBEK_LATIN
00360 # define SUBLANG_UZBEK_LATIN 0x01
00361 # endif
00362 # ifndef SUBLANG_UZBEK_CYRILLIC
00363 # define SUBLANG_UZBEK_CYRILLIC 0x02
00364 # endif
00365 #endif
00366 
00367 /* XPG3 defines the result of 'setlocale (category, NULL)' as:
00368    "Directs 'setlocale()' to query 'category' and return the current
00369     setting of 'local'."
00370    However it does not specify the exact format.  Neither do SUSV2 and
00371    ISO C 99.  So we can use this feature only on selected systems (e.g.
00372    those using GNU C Library).  */
00373 #if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
00374 # define HAVE_LOCALE_NULL
00375 #endif
00376 
00377 /* Determine the current locale's name, and canonicalize it into XPG syntax
00378      language[_territory[.codeset]][@modifier]
00379    The codeset part in the result is not reliable; the locale_charset()
00380    should be used for codeset information instead.
00381    The result must not be freed; it is statically allocated.  */
00382 
00383 const char *
00384 _nl_locale_name (category, categoryname)
00385      int category;
00386      const char *categoryname;
00387 {
00388   const char *retval;
00389 
00390 #ifndef WIN32
00391 
00392   /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
00393      On some systems this can be done by the 'setlocale' function itself.  */
00394 # if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
00395   retval = setlocale (category, NULL);
00396 # else
00397   /* Setting of LC_ALL overwrites all other.  */
00398   retval = getenv ("LC_ALL");
00399   if (retval == NULL || retval[0] == '\0')
00400     {
00401       /* Next comes the name of the desired category.  */
00402       retval = getenv (categoryname);
00403       if (retval == NULL || retval[0] == '\0')
00404         {
00405           /* Last possibility is the LANG environment variable.  */
00406           retval = getenv ("LANG");
00407           if (retval == NULL || retval[0] == '\0')
00408             /* We use C as the default domain.  POSIX says this is
00409                implementation defined.  */
00410             retval = "C";
00411         }
00412     }
00413 # endif
00414 
00415   return retval;
00416 
00417 #else /* WIN32 */
00418 
00419   /* Return an XPG style locale name language[_territory][@modifier].
00420      Don't even bother determining the codeset; it's not useful in this
00421      context, because message catalogs are not specific to a single
00422      codeset.  */
00423 
00424   LCID lcid;
00425   LANGID langid;
00426   int primary, sub;
00427 
00428   /* Let the user override the system settings through environment
00429      variables, as on POSIX systems.  */
00430   retval = getenv ("LC_ALL");
00431   if (retval != NULL && retval[0] != '\0')
00432     return retval;
00433   retval = getenv (categoryname);
00434   if (retval != NULL && retval[0] != '\0')
00435     return retval;
00436   retval = getenv ("LANG");
00437   if (retval != NULL && retval[0] != '\0')
00438     return retval;
00439 
00440   /* Use native Win32 API locale ID.  */
00441   lcid = GetThreadLocale ();
00442 
00443   /* Strip off the sorting rules, keep only the language part.  */
00444   langid = LANGIDFROMLCID (lcid);
00445 
00446   /* Split into language and territory part.  */
00447   primary = PRIMARYLANGID (langid);
00448   sub = SUBLANGID (langid);
00449 
00450   /* Dispatch on language.
00451      See also http://www.unicode.org/unicode/onlinedat/languages.html .
00452      For details about languages, see http://www.ethnologue.com/ .  */
00453   switch (primary)
00454     {
00455     case LANG_AFRIKAANS: return "af_ZA";
00456     case LANG_ALBANIAN: return "sq_AL";
00457     case 0x5e: /* AMHARIC */ return "am_ET";
00458     case LANG_ARABIC:
00459       switch (sub)
00460         {
00461         case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA";
00462         case SUBLANG_ARABIC_IRAQ: return "ar_IQ";
00463         case SUBLANG_ARABIC_EGYPT: return "ar_EG";
00464         case SUBLANG_ARABIC_LIBYA: return "ar_LY";
00465         case SUBLANG_ARABIC_ALGERIA: return "ar_DZ";
00466         case SUBLANG_ARABIC_MOROCCO: return "ar_MA";
00467         case SUBLANG_ARABIC_TUNISIA: return "ar_TN";
00468         case SUBLANG_ARABIC_OMAN: return "ar_OM";
00469         case SUBLANG_ARABIC_YEMEN: return "ar_YE";
00470         case SUBLANG_ARABIC_SYRIA: return "ar_SY";
00471         case SUBLANG_ARABIC_JORDAN: return "ar_JO";
00472         case SUBLANG_ARABIC_LEBANON: return "ar_LB";
00473         case SUBLANG_ARABIC_KUWAIT: return "ar_KW";
00474         case SUBLANG_ARABIC_UAE: return "ar_AE";
00475         case SUBLANG_ARABIC_BAHRAIN: return "ar_BH";
00476         case SUBLANG_ARABIC_QATAR: return "ar_QA";
00477         }
00478       return "ar";
00479     case LANG_ARMENIAN: return "hy_AM";
00480     case LANG_ASSAMESE: return "as_IN";
00481     case LANG_AZERI:
00482       switch (sub)
00483         {
00484         /* FIXME: Adjust this when Azerbaijani locales appear on Unix.  */
00485         case SUBLANG_AZERI_LATIN: return "az_AZ@latin";
00486         case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic";
00487         }
00488       return "az";
00489     case LANG_BASQUE:
00490       return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR".  */
00491     case LANG_BELARUSIAN: return "be_BY";
00492     case LANG_BENGALI: return "bn_IN";
00493     case LANG_BULGARIAN: return "bg_BG";
00494     case 0x55: /* BURMESE */ return "my_MM";
00495     case 0x53: /* CAMBODIAN */ return "km_KH";
00496     case LANG_CATALAN: return "ca_ES";
00497     case 0x5c: /* CHEROKEE */ return "chr_US";
00498     case LANG_CHINESE:
00499       switch (sub)
00500         {
00501         case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW";
00502         case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN";
00503         case SUBLANG_CHINESE_HONGKONG: return "zh_HK";
00504         case SUBLANG_CHINESE_SINGAPORE: return "zh_SG";
00505         case SUBLANG_CHINESE_MACAU: return "zh_MO";
00506         }
00507       return "zh";
00508     case LANG_CROATIAN:         /* LANG_CROATIAN == LANG_SERBIAN
00509                                  * What used to be called Serbo-Croatian
00510                                  * should really now be two separate
00511                                  * languages because of political reasons.
00512                                  * (Says tml, who knows nothing about Serbian
00513                                  * or Croatian.)
00514                                  * (I can feel those flames coming already.)
00515                                  */
00516       switch (sub)
00517         {
00518         case SUBLANG_DEFAULT: return "hr_HR";
00519         case SUBLANG_SERBIAN_LATIN: return "sr_YU";
00520         case SUBLANG_SERBIAN_CYRILLIC: return "sr_YU@cyrillic";
00521         }
00522       return "hr";
00523     case LANG_CZECH: return "cs_CZ";
00524     case LANG_DANISH: return "da_DK";
00525     case LANG_DIVEHI: return "div_MV";
00526     case LANG_DUTCH:
00527       switch (sub)
00528         {
00529         case SUBLANG_DUTCH: return "nl_NL";
00530         case SUBLANG_DUTCH_BELGIAN: /* FLEMISH, VLAAMS */ return "nl_BE";
00531         }
00532       return "nl";
00533     case 0x66: /* EDO */ return "bin_NG";
00534     case LANG_ENGLISH:
00535       switch (sub)
00536         {
00537         /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
00538          * English was the language spoken in England.
00539          * Oh well.
00540          */
00541         case SUBLANG_ENGLISH_US: return "en_US";
00542         case SUBLANG_ENGLISH_UK: return "en_GB";
00543         case SUBLANG_ENGLISH_AUS: return "en_AU";
00544         case SUBLANG_ENGLISH_CAN: return "en_CA";
00545         case SUBLANG_ENGLISH_NZ: return "en_NZ";
00546         case SUBLANG_ENGLISH_EIRE: return "en_IE";
00547         case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA";
00548         case SUBLANG_ENGLISH_JAMAICA: return "en_JM";
00549         case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */
00550         case SUBLANG_ENGLISH_BELIZE: return "en_BZ";
00551         case SUBLANG_ENGLISH_TRINIDAD: return "en_TT";
00552         case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW";
00553         case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH";
00554         }
00555       return "en";
00556     case LANG_ESTONIAN: return "et_EE";
00557     case LANG_FAEROESE: return "fo_FO";
00558     case LANG_FARSI: return "fa_IR";
00559     case LANG_FINNISH: return "fi_FI";
00560     case LANG_FRENCH:
00561       switch (sub)
00562         {
00563         case SUBLANG_FRENCH: return "fr_FR";
00564         case SUBLANG_FRENCH_BELGIAN: /* WALLOON */ return "fr_BE";
00565         case SUBLANG_FRENCH_CANADIAN: return "fr_CA";
00566         case SUBLANG_FRENCH_SWISS: return "fr_CH";
00567         case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU";
00568         case SUBLANG_FRENCH_MONACO: return "fr_MC";
00569         }
00570       return "fr";
00571     case 0x62: /* FRISIAN */ return "fy_NL";
00572     case 0x67: /* FULFULDE */ return "ful_NG";
00573     case 0x3c: /* GAELIC */
00574       switch (sub)
00575         {
00576         case 0x01: /* SCOTTISH */ return "gd_GB";
00577         case 0x02: /* IRISH */ return "ga_IE";
00578         }
00579       return "C";
00580     case LANG_GALICIAN: return "gl_ES";
00581     case LANG_GEORGIAN: return "ka_GE";
00582     case LANG_GERMAN:
00583       switch (sub)
00584         {
00585         case SUBLANG_GERMAN: return "de_DE";
00586         case SUBLANG_GERMAN_SWISS: return "de_CH";
00587         case SUBLANG_GERMAN_AUSTRIAN: return "de_AT";
00588         case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU";
00589         case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI";
00590         }
00591       return "de";
00592     case LANG_GREEK: return "el_GR";
00593     case 0x74: /* GUARANI */ return "gn_PY";
00594     case LANG_GUJARATI: return "gu_IN";
00595     case 0x68: /* HAUSA */ return "ha_NG";
00596     case 0x75: /* HAWAIIAN */
00597       /* FIXME: Do they mean Hawaiian ("haw_US", 1000 speakers)
00598          or Hawaii Creole English ("cpe_US", 600000 speakers)?  */
00599       return "cpe_US";
00600     case LANG_HEBREW: return "he_IL";
00601     case LANG_HINDI: return "hi_IN";
00602     case LANG_HUNGARIAN: return "hu_HU";
00603     case 0x69: /* IBIBIO */ return "nic_NG";
00604     case LANG_ICELANDIC: return "is_IS";
00605     case 0x70: /* IGBO */ return "ibo_NG";
00606     case LANG_INDONESIAN: return "id_ID";
00607     case 0x5d: /* INUKTITUT */ return "iu_CA";
00608     case LANG_ITALIAN:
00609       switch (sub)
00610         {
00611         case SUBLANG_ITALIAN: return "it_IT";
00612         case SUBLANG_ITALIAN_SWISS: return "it_CH";
00613         }
00614       return "it";
00615     case LANG_JAPANESE: return "ja_JP";
00616     case LANG_KANNADA: return "kn_IN";
00617     case 0x71: /* KANURI */ return "kau_NG";
00618     case LANG_KASHMIRI:
00619       switch (sub)
00620         {
00621         case SUBLANG_DEFAULT: return "ks_PK";
00622         case SUBLANG_KASHMIRI_INDIA: return "ks_IN";
00623         }
00624       return "ks";
00625     case LANG_KAZAK: return "kk_KZ";
00626     case LANG_KONKANI:
00627       /* FIXME: Adjust this when such locales appear on Unix.  */
00628       return "kok_IN";
00629     case LANG_KOREAN: return "ko_KR";
00630     case LANG_KYRGYZ: return "ky_KG";
00631     case 0x54: /* LAO */ return "lo_LA";
00632     case 0x76: /* LATIN */ return "la_VA";
00633     case LANG_LATVIAN: return "lv_LV";
00634     case LANG_LITHUANIAN: return "lt_LT";
00635     case LANG_MACEDONIAN: return "mk_MK";
00636     case LANG_MALAY:
00637       switch (sub)
00638         {
00639         case SUBLANG_MALAY_MALAYSIA: return "ms_MY";
00640         case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN";
00641         }
00642       return "ms";
00643     case LANG_MALAYALAM: return "ml_IN";
00644     case 0x3a: /* MALTESE */ return "mt_MT";
00645     case LANG_MANIPURI:
00646       /* FIXME: Adjust this when such locales appear on Unix.  */
00647       return "mni_IN";
00648     case LANG_MARATHI: return "mr_IN";
00649     case LANG_MONGOLIAN:
00650       return "mn"; /* Ambiguous: could be "mn_CN" or "mn_MN".  */
00651     case LANG_NEPALI:
00652       switch (sub)
00653         {
00654         case SUBLANG_DEFAULT: return "ne_NP";
00655         case SUBLANG_NEPALI_INDIA: return "ne_IN";
00656         }
00657       return "ne";
00658     case LANG_NORWEGIAN:
00659       switch (sub)
00660         {
00661         case SUBLANG_NORWEGIAN_BOKMAL: return "no_NO";
00662         case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO";
00663         }
00664       return "no";
00665     case LANG_ORIYA: return "or_IN";
00666     case 0x72: /* OROMO */ return "om_ET";
00667     case 0x79: /* PAPIAMENTU */ return "pap_AN";
00668     case 0x63: /* PASHTO */
00669       return "ps"; /* Ambiguous: could be "ps_PK" or "ps_AF".  */
00670     case LANG_POLISH: return "pl_PL";
00671     case LANG_PORTUGUESE:
00672       switch (sub)
00673         {
00674         case SUBLANG_PORTUGUESE: return "pt_PT";
00675         /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
00676            Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
00677         case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR";
00678         }
00679       return "pt";
00680     case LANG_PUNJABI: return "pa_IN";
00681     case 0x17: /* RHAETO-ROMANCE */ return "rm_CH";
00682     case LANG_ROMANIAN: return "ro_RO";
00683     case LANG_RUSSIAN:
00684       return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA".  */
00685     case 0x3b: /* SAMI */ return "se_NO";
00686     case LANG_SANSKRIT: return "sa_IN";
00687     case LANG_SINDHI: return "sd";
00688     case 0x5b: /* SINHALESE */ return "si_LK";
00689     case LANG_SLOVAK: return "sk_SK";
00690     case LANG_SLOVENIAN: return "sl_SI";
00691     case 0x77: /* SOMALI */ return "so_SO";
00692     case LANG_SORBIAN:
00693       /* FIXME: Adjust this when such locales appear on Unix.  */
00694       return "wen_DE";
00695     case LANG_SPANISH:
00696       switch (sub)
00697         {
00698         case SUBLANG_SPANISH: return "es_ES";
00699         case SUBLANG_SPANISH_MEXICAN: return "es_MX";
00700         case SUBLANG_SPANISH_MODERN:
00701           return "es_ES@modern";        /* not seen on Unix */
00702         case SUBLANG_SPANISH_GUATEMALA: return "es_GT";
00703         case SUBLANG_SPANISH_COSTA_RICA: return "es_CR";
00704         case SUBLANG_SPANISH_PANAMA: return "es_PA";
00705         case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO";
00706         case SUBLANG_SPANISH_VENEZUELA: return "es_VE";
00707         case SUBLANG_SPANISH_COLOMBIA: return "es_CO";
00708         case SUBLANG_SPANISH_PERU: return "es_PE";
00709         case SUBLANG_SPANISH_ARGENTINA: return "es_AR";
00710         case SUBLANG_SPANISH_ECUADOR: return "es_EC";
00711         case SUBLANG_SPANISH_CHILE: return "es_CL";
00712         case SUBLANG_SPANISH_URUGUAY: return "es_UY";
00713         case SUBLANG_SPANISH_PARAGUAY: return "es_PY";
00714         case SUBLANG_SPANISH_BOLIVIA: return "es_BO";
00715         case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV";
00716         case SUBLANG_SPANISH_HONDURAS: return "es_HN";
00717         case SUBLANG_SPANISH_NICARAGUA: return "es_NI";
00718         case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR";
00719         }
00720       return "es";
00721     case 0x30: /* SUTU */ return "bnt_TZ";
00722     case LANG_SWAHILI: return "sw_KE";
00723     case LANG_SWEDISH:
00724       switch (sub)
00725         {
00726         case SUBLANG_DEFAULT: return "sv_SE";
00727         case SUBLANG_SWEDISH_FINLAND: return "sv_FI";
00728         }
00729       return "sv";
00730     case LANG_SYRIAC: return "syr_TR"; /* An extinct language.  */
00731     case 0x64: /* TAGALOG */ return "tl_PH";
00732     case 0x28: /* TAJIK */ return "tg_TJ";
00733     case 0x5f: /* TAMAZIGHT */ return "ber_MA";
00734     case LANG_TAMIL:
00735       return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG".  */
00736     case LANG_TATAR: return "tt_RU";
00737     case LANG_TELUGU: return "te_IN";
00738     case LANG_THAI: return "th_TH";
00739     case 0x51: /* TIBETAN */ return "bo_CN";
00740     case 0x73: /* TIGRINYA */ return "ti_ET";
00741     case 0x31: /* TSONGA */ return "ts_ZA";
00742     case LANG_TURKISH: return "tr_TR";
00743     case 0x42: /* TURKMEN */ return "tk_TM";
00744     case LANG_UKRAINIAN: return "uk_UA";
00745     case LANG_URDU:
00746       switch (sub)
00747         {
00748         case SUBLANG_URDU_PAKISTAN: return "ur_PK";
00749         case SUBLANG_URDU_INDIA: return "ur_IN";
00750         }
00751       return "ur";
00752     case LANG_UZBEK:
00753       switch (sub)
00754         {
00755         /* FIXME: Adjust this when Uzbek locales appear on Unix.  */
00756         case SUBLANG_UZBEK_LATIN: return "uz_UZ@latin";
00757         case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic";
00758         }
00759       return "uz";
00760     case 0x33: /* VENDA */ return "ven_ZA";
00761     case LANG_VIETNAMESE: return "vi_VN";
00762     case 0x52: /* WELSH */ return "cy_GB";
00763     case 0x34: /* XHOSA */ return "xh_ZA";
00764     case 0x78: /* YI */ return "sit_CN";
00765     case 0x3d: /* YIDDISH */ return "yi_IL";
00766     case 0x6a: /* YORUBA */ return "yo_NG";
00767     case 0x35: /* ZULU */ return "zu_ZA";
00768     default: return "C";
00769     }
00770 
00771 #endif
00772 }

Generated on Tue Dec 20 10:14:20 2005 for vlc-0.8.4a by  doxygen 1.4.2