Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals  

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 <drepper@gnu.org>, 1995.  */
00020 /* Win32 code written by Tor Lillqvist <tml@iki.fi>.  */
00021 
00022 #ifdef HAVE_CONFIG_H
00023 # include <config.h>
00024 #endif
00025 
00026 #include <stdlib.h>
00027 #include <locale.h>
00028 
00029 #if defined _WIN32 || defined __WIN32__
00030 # undef WIN32   /* avoid warning on mingw32 */
00031 # define WIN32
00032 #endif
00033 
00034 #ifdef WIN32
00035 # define WIN32_LEAN_AND_MEAN
00036 # include <windows.h>
00037 /* 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_ESTONIAN
00069 # define LANG_ESTONIAN 0x25
00070 # endif
00071 # ifndef LANG_FAEROESE
00072 # define LANG_FAEROESE 0x38
00073 # endif
00074 # ifndef LANG_FARSI
00075 # define LANG_FARSI 0x29
00076 # endif
00077 # ifndef LANG_GEORGIAN
00078 # define LANG_GEORGIAN 0x37
00079 # endif
00080 # ifndef LANG_GUJARATI
00081 # define LANG_GUJARATI 0x47
00082 # endif
00083 # ifndef LANG_HEBREW
00084 # define LANG_HEBREW 0x0d
00085 # endif
00086 # ifndef LANG_HINDI
00087 # define LANG_HINDI 0x39
00088 # endif
00089 # ifndef LANG_INDONESIAN
00090 # define LANG_INDONESIAN 0x21
00091 # endif
00092 # ifndef LANG_KANNADA
00093 # define LANG_KANNADA 0x4b
00094 # endif
00095 # ifndef LANG_KASHMIRI
00096 # define LANG_KASHMIRI 0x60
00097 # endif
00098 # ifndef LANG_KAZAK
00099 # define LANG_KAZAK 0x3f
00100 # endif
00101 # ifndef LANG_KONKANI
00102 # define LANG_KONKANI 0x57
00103 # endif
00104 # ifndef LANG_LATVIAN
00105 # define LANG_LATVIAN 0x26
00106 # endif
00107 # ifndef LANG_LITHUANIAN
00108 # define LANG_LITHUANIAN 0x27
00109 # endif
00110 # ifndef LANG_MACEDONIAN
00111 # define LANG_MACEDONIAN 0x2f
00112 # endif
00113 # ifndef LANG_MALAY
00114 # define LANG_MALAY 0x3e
00115 # endif
00116 # ifndef LANG_MALAYALAM
00117 # define LANG_MALAYALAM 0x4c
00118 # endif
00119 # ifndef LANG_MANIPURI
00120 # define LANG_MANIPURI 0x58
00121 # endif
00122 # ifndef LANG_MARATHI
00123 # define LANG_MARATHI 0x4e
00124 # endif
00125 # ifndef LANG_NEPALI
00126 # define LANG_NEPALI 0x61
00127 # endif
00128 # ifndef LANG_ORIYA
00129 # define LANG_ORIYA 0x48
00130 # endif
00131 # ifndef LANG_PUNJABI
00132 # define LANG_PUNJABI 0x46
00133 # endif
00134 # ifndef LANG_SANSKRIT
00135 # define LANG_SANSKRIT 0x4f
00136 # endif
00137 # ifndef LANG_SERBIAN
00138 # define LANG_SERBIAN 0x1a
00139 # endif
00140 # ifndef LANG_SINDHI
00141 # define LANG_SINDHI 0x59
00142 # endif
00143 # ifndef LANG_SLOVAK
00144 # define LANG_SLOVAK 0x1b
00145 # endif
00146 # ifndef LANG_SWAHILI
00147 # define LANG_SWAHILI 0x41
00148 # endif
00149 # ifndef LANG_TAMIL
00150 # define LANG_TAMIL 0x49
00151 # endif
00152 # ifndef LANG_TATAR
00153 # define LANG_TATAR 0x44
00154 # endif
00155 # ifndef LANG_TELUGU
00156 # define LANG_TELUGU 0x4a
00157 # endif
00158 # ifndef LANG_THAI
00159 # define LANG_THAI 0x1e
00160 # endif
00161 # ifndef LANG_UKRAINIAN
00162 # define LANG_UKRAINIAN 0x22
00163 # endif
00164 # ifndef LANG_URDU
00165 # define LANG_URDU 0x20
00166 # endif
00167 # ifndef LANG_UZBEK
00168 # define LANG_UZBEK 0x43
00169 # endif
00170 # ifndef LANG_VIETNAMESE
00171 # define LANG_VIETNAMESE 0x2a
00172 # endif
00173 # ifndef SUBLANG_ARABIC_SAUDI_ARABIA
00174 # define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
00175 # endif
00176 # ifndef SUBLANG_ARABIC_IRAQ
00177 # define SUBLANG_ARABIC_IRAQ 0x02
00178 # endif
00179 # ifndef SUBLANG_ARABIC_EGYPT
00180 # define SUBLANG_ARABIC_EGYPT 0x03
00181 # endif
00182 # ifndef SUBLANG_ARABIC_LIBYA
00183 # define SUBLANG_ARABIC_LIBYA 0x04
00184 # endif
00185 # ifndef SUBLANG_ARABIC_ALGERIA
00186 # define SUBLANG_ARABIC_ALGERIA 0x05
00187 # endif
00188 # ifndef SUBLANG_ARABIC_MOROCCO
00189 # define SUBLANG_ARABIC_MOROCCO 0x06
00190 # endif
00191 # ifndef SUBLANG_ARABIC_TUNISIA
00192 # define SUBLANG_ARABIC_TUNISIA 0x07
00193 # endif
00194 # ifndef SUBLANG_ARABIC_OMAN
00195 # define SUBLANG_ARABIC_OMAN 0x08
00196 # endif
00197 # ifndef SUBLANG_ARABIC_YEMEN
00198 # define SUBLANG_ARABIC_YEMEN 0x09
00199 # endif
00200 # ifndef SUBLANG_ARABIC_SYRIA
00201 # define SUBLANG_ARABIC_SYRIA 0x0a
00202 # endif
00203 # ifndef SUBLANG_ARABIC_JORDAN
00204 # define SUBLANG_ARABIC_JORDAN 0x0b
00205 # endif
00206 # ifndef SUBLANG_ARABIC_LEBANON
00207 # define SUBLANG_ARABIC_LEBANON 0x0c
00208 # endif
00209 # ifndef SUBLANG_ARABIC_KUWAIT
00210 # define SUBLANG_ARABIC_KUWAIT 0x0d
00211 # endif
00212 # ifndef SUBLANG_ARABIC_UAE
00213 # define SUBLANG_ARABIC_UAE 0x0e
00214 # endif
00215 # ifndef SUBLANG_ARABIC_BAHRAIN
00216 # define SUBLANG_ARABIC_BAHRAIN 0x0f
00217 # endif
00218 # ifndef SUBLANG_ARABIC_QATAR
00219 # define SUBLANG_ARABIC_QATAR 0x10
00220 # endif
00221 # ifndef SUBLANG_AZERI_LATIN
00222 # define SUBLANG_AZERI_LATIN 0x01
00223 # endif
00224 # ifndef SUBLANG_AZERI_CYRILLIC
00225 # define SUBLANG_AZERI_CYRILLIC 0x02
00226 # endif
00227 # ifndef SUBLANG_CHINESE_MACAU
00228 # define SUBLANG_CHINESE_MACAU 0x05
00229 # endif
00230 # ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
00231 # define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
00232 # endif
00233 # ifndef SUBLANG_ENGLISH_JAMAICA
00234 # define SUBLANG_ENGLISH_JAMAICA 0x08
00235 # endif
00236 # ifndef SUBLANG_ENGLISH_CARIBBEAN
00237 # define SUBLANG_ENGLISH_CARIBBEAN 0x09
00238 # endif
00239 # ifndef SUBLANG_ENGLISH_BELIZE
00240 # define SUBLANG_ENGLISH_BELIZE 0x0a
00241 # endif
00242 # ifndef SUBLANG_ENGLISH_TRINIDAD
00243 # define SUBLANG_ENGLISH_TRINIDAD 0x0b
00244 # endif
00245 # ifndef SUBLANG_ENGLISH_ZIMBABWE
00246 # define SUBLANG_ENGLISH_ZIMBABWE 0x0c
00247 # endif
00248 # ifndef SUBLANG_ENGLISH_PHILIPPINES
00249 # define SUBLANG_ENGLISH_PHILIPPINES 0x0d
00250 # endif
00251 # ifndef SUBLANG_FRENCH_LUXEMBOURG
00252 # define SUBLANG_FRENCH_LUXEMBOURG 0x05
00253 # endif
00254 # ifndef SUBLANG_FRENCH_MONACO
00255 # define SUBLANG_FRENCH_MONACO 0x06
00256 # endif
00257 # ifndef SUBLANG_GERMAN_LUXEMBOURG
00258 # define SUBLANG_GERMAN_LUXEMBOURG 0x04
00259 # endif
00260 # ifndef SUBLANG_GERMAN_LIECHTENSTEIN
00261 # define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
00262 # endif
00263 # ifndef SUBLANG_KASHMIRI_INDIA
00264 # define SUBLANG_KASHMIRI_INDIA 0x02
00265 # endif
00266 # ifndef SUBLANG_MALAY_MALAYSIA
00267 # define SUBLANG_MALAY_MALAYSIA 0x01
00268 # endif
00269 # ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
00270 # define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
00271 # endif
00272 # ifndef SUBLANG_NEPALI_INDIA
00273 # define SUBLANG_NEPALI_INDIA 0x02
00274 # endif
00275 # ifndef SUBLANG_SERBIAN_LATIN
00276 # define SUBLANG_SERBIAN_LATIN 0x02
00277 # endif
00278 # ifndef SUBLANG_SERBIAN_CYRILLIC
00279 # define SUBLANG_SERBIAN_CYRILLIC 0x03
00280 # endif
00281 # ifndef SUBLANG_SPANISH_GUATEMALA
00282 # define SUBLANG_SPANISH_GUATEMALA 0x04
00283 # endif
00284 # ifndef SUBLANG_SPANISH_COSTA_RICA
00285 # define SUBLANG_SPANISH_COSTA_RICA 0x05
00286 # endif
00287 # ifndef SUBLANG_SPANISH_PANAMA
00288 # define SUBLANG_SPANISH_PANAMA 0x06
00289 # endif
00290 # ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
00291 # define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
00292 # endif
00293 # ifndef SUBLANG_SPANISH_VENEZUELA
00294 # define SUBLANG_SPANISH_VENEZUELA 0x08
00295 # endif
00296 # ifndef SUBLANG_SPANISH_COLOMBIA
00297 # define SUBLANG_SPANISH_COLOMBIA 0x09
00298 # endif
00299 # ifndef SUBLANG_SPANISH_PERU
00300 # define SUBLANG_SPANISH_PERU 0x0a
00301 # endif
00302 # ifndef SUBLANG_SPANISH_ARGENTINA
00303 # define SUBLANG_SPANISH_ARGENTINA 0x0b
00304 # endif
00305 # ifndef SUBLANG_SPANISH_ECUADOR
00306 # define SUBLANG_SPANISH_ECUADOR 0x0c
00307 # endif
00308 # ifndef SUBLANG_SPANISH_CHILE
00309 # define SUBLANG_SPANISH_CHILE 0x0d
00310 # endif
00311 # ifndef SUBLANG_SPANISH_URUGUAY
00312 # define SUBLANG_SPANISH_URUGUAY 0x0e
00313 # endif
00314 # ifndef SUBLANG_SPANISH_PARAGUAY
00315 # define SUBLANG_SPANISH_PARAGUAY 0x0f
00316 # endif
00317 # ifndef SUBLANG_SPANISH_BOLIVIA
00318 # define SUBLANG_SPANISH_BOLIVIA 0x10
00319 # endif
00320 # ifndef SUBLANG_SPANISH_EL_SALVADOR
00321 # define SUBLANG_SPANISH_EL_SALVADOR 0x11
00322 # endif
00323 # ifndef SUBLANG_SPANISH_HONDURAS
00324 # define SUBLANG_SPANISH_HONDURAS 0x12
00325 # endif
00326 # ifndef SUBLANG_SPANISH_NICARAGUA
00327 # define SUBLANG_SPANISH_NICARAGUA 0x13
00328 # endif
00329 # ifndef SUBLANG_SPANISH_PUERTO_RICO
00330 # define SUBLANG_SPANISH_PUERTO_RICO 0x14
00331 # endif
00332 # ifndef SUBLANG_SWEDISH_FINLAND
00333 # define SUBLANG_SWEDISH_FINLAND 0x02
00334 # endif
00335 # ifndef SUBLANG_URDU_PAKISTAN
00336 # define SUBLANG_URDU_PAKISTAN 0x01
00337 # endif
00338 # ifndef SUBLANG_URDU_INDIA
00339 # define SUBLANG_URDU_INDIA 0x02
00340 # endif
00341 # ifndef SUBLANG_UZBEK_LATIN
00342 # define SUBLANG_UZBEK_LATIN 0x01
00343 # endif
00344 # ifndef SUBLANG_UZBEK_CYRILLIC
00345 # define SUBLANG_UZBEK_CYRILLIC 0x02
00346 # endif
00347 #endif
00348 
00349 /* XPG3 defines the result of 'setlocale (category, NULL)' as:
00350    "Directs 'setlocale()' to query 'category' and return the current
00351     setting of 'local'."
00352    However it does not specify the exact format.  Neither do SUSV2 and
00353    ISO C 99.  So we can use this feature only on selected systems (e.g.
00354    those using GNU C Library).  */
00355 #if defined _LIBC || (defined __GNU_LIBRARY__ && __GNU_LIBRARY__ >= 2)
00356 # define HAVE_LOCALE_NULL
00357 #endif
00358 
00359 /* Determine the current locale's name, and canonicalize it into XPG syntax
00360      language[_territory[.codeset]][@modifier]
00361    The codeset part in the result is not reliable; the locale_charset()
00362    should be used for codeset information instead.
00363    The result must not be freed; it is statically allocated.  */
00364 
00365 const char *
00366 _nl_locale_name (category, categoryname)
00367      int category;
00368      const char *categoryname;
00369 {
00370   const char *retval;
00371 
00372 #ifndef WIN32
00373 
00374   /* Use the POSIX methods of looking to 'LC_ALL', 'LC_xxx', and 'LANG'.
00375      On some systems this can be done by the 'setlocale' function itself.  */
00376 # if defined HAVE_SETLOCALE && defined HAVE_LC_MESSAGES && defined HAVE_LOCALE_NULL
00377   retval = setlocale (category, NULL);
00378 # else
00379   /* Setting of LC_ALL overwrites all other.  */
00380   retval = getenv ("LC_ALL");
00381   if (retval == NULL || retval[0] == '\0')
00382     {
00383       /* Next comes the name of the desired category.  */
00384       retval = getenv (categoryname);
00385       if (retval == NULL || retval[0] == '\0')
00386         {
00387           /* Last possibility is the LANG environment variable.  */
00388           retval = getenv ("LANG");
00389           if (retval == NULL || retval[0] == '\0')
00390             /* We use C as the default domain.  POSIX says this is
00391                implementation defined.  */
00392             retval = "C";
00393         }
00394     }
00395 # endif
00396 
00397   return retval;
00398 
00399 #else /* WIN32 */
00400 
00401   /* Return an XPG style locale name language[_territory][@modifier].
00402      Don't even bother determining the codeset; it's not useful in this
00403      context, because message catalogs are not specific to a single
00404      codeset.  */
00405 
00406   LCID lcid;
00407   LANGID langid;
00408   int primary, sub;
00409 
00410   /* Let the user override the system settings through environment
00411      variables, as on POSIX systems.  */
00412   retval = getenv ("LC_ALL");
00413   if (retval != NULL && retval[0] != '\0')
00414     return retval;
00415   retval = getenv (categoryname);
00416   if (retval != NULL && retval[0] != '\0')
00417     return retval;
00418   retval = getenv ("LANG");
00419   if (retval != NULL && retval[0] != '\0')
00420     return retval;
00421 
00422   /* Use native Win32 API locale ID.  */
00423   lcid = GetThreadLocale ();
00424 
00425   /* Strip off the sorting rules, keep only the language part.  */
00426   langid = LANGIDFROMLCID (lcid);
00427 
00428   /* Split into language and territory part.  */
00429   primary = PRIMARYLANGID (langid);
00430   sub = SUBLANGID (langid);
00431   switch (primary)
00432     {
00433     case LANG_AFRIKAANS: return "af_ZA";
00434     case LANG_ALBANIAN: return "sq_AL";
00435     case LANG_ARABIC:
00436       switch (sub)
00437         {
00438         case SUBLANG_ARABIC_SAUDI_ARABIA: return "ar_SA";
00439         case SUBLANG_ARABIC_IRAQ: return "ar_IQ";
00440         case SUBLANG_ARABIC_EGYPT: return "ar_EG";
00441         case SUBLANG_ARABIC_LIBYA: return "ar_LY";
00442         case SUBLANG_ARABIC_ALGERIA: return "ar_DZ";
00443         case SUBLANG_ARABIC_MOROCCO: return "ar_MA";
00444         case SUBLANG_ARABIC_TUNISIA: return "ar_TN";
00445         case SUBLANG_ARABIC_OMAN: return "ar_OM";
00446         case SUBLANG_ARABIC_YEMEN: return "ar_YE";
00447         case SUBLANG_ARABIC_SYRIA: return "ar_SY";
00448         case SUBLANG_ARABIC_JORDAN: return "ar_JO";
00449         case SUBLANG_ARABIC_LEBANON: return "ar_LB";
00450         case SUBLANG_ARABIC_KUWAIT: return "ar_KW";
00451         case SUBLANG_ARABIC_UAE: return "ar_AE";
00452         case SUBLANG_ARABIC_BAHRAIN: return "ar_BH";
00453         case SUBLANG_ARABIC_QATAR: return "ar_QA";
00454         }
00455       return "ar";
00456     case LANG_ARMENIAN: return "hy_AM";
00457     case LANG_ASSAMESE: return "as_IN";
00458     case LANG_AZERI:
00459       switch (sub)
00460         {
00461         /* FIXME: Adjust this when Azerbaijani locales appear on Unix.  */
00462         case SUBLANG_AZERI_LATIN: return "az_AZ@latin";
00463         case SUBLANG_AZERI_CYRILLIC: return "az_AZ@cyrillic";
00464         }
00465       return "az";
00466     case LANG_BASQUE:
00467       return "eu"; /* Ambiguous: could be "eu_ES" or "eu_FR".  */
00468     case LANG_BELARUSIAN: return "be_BY";
00469     case LANG_BENGALI: return "bn_IN";
00470     case LANG_BULGARIAN: return "bg_BG";
00471     case LANG_CATALAN: return "ca_ES";
00472     case LANG_CHINESE:
00473       switch (sub)
00474         {
00475         case SUBLANG_CHINESE_TRADITIONAL: return "zh_TW";
00476         case SUBLANG_CHINESE_SIMPLIFIED: return "zh_CN";
00477         case SUBLANG_CHINESE_HONGKONG: return "zh_HK";
00478         case SUBLANG_CHINESE_SINGAPORE: return "zh_SG";
00479         case SUBLANG_CHINESE_MACAU: return "zh_MO";
00480         }
00481       return "zh";
00482     case LANG_CROATIAN:         /* LANG_CROATIAN == LANG_SERBIAN
00483                                  * What used to be called Serbo-Croatian
00484                                  * should really now be two separate
00485                                  * languages because of political reasons.
00486                                  * (Says tml, who knows nothing about Serbian
00487                                  * or Croatian.)
00488                                  * (I can feel those flames coming already.)
00489                                  */
00490       switch (sub)
00491         {
00492         /* FIXME: How to distinguish Croatian and Latin Serbian locales?  */
00493         case SUBLANG_SERBIAN_LATIN: return "sr_YU";
00494         case SUBLANG_SERBIAN_CYRILLIC: return "sr_YU@cyrillic";
00495         default: return "hr_HR";
00496         }
00497     case LANG_CZECH: return "cs_CZ";
00498     case LANG_DANISH: return "da_DK";
00499     case LANG_DUTCH:
00500       switch (sub)
00501         {
00502         case SUBLANG_DUTCH: return "nl_NL";
00503         case SUBLANG_DUTCH_BELGIAN: return "nl_BE";
00504         }
00505       return "nl";
00506     case LANG_ENGLISH:
00507       switch (sub)
00508         {
00509         /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
00510          * English was the language spoken in England.
00511          * Oh well.
00512          */
00513         case SUBLANG_ENGLISH_US: return "en_US";
00514         case SUBLANG_ENGLISH_UK: return "en_GB";
00515         case SUBLANG_ENGLISH_AUS: return "en_AU";
00516         case SUBLANG_ENGLISH_CAN: return "en_CA";
00517         case SUBLANG_ENGLISH_NZ: return "en_NZ";
00518         case SUBLANG_ENGLISH_EIRE: return "en_IE";
00519         case SUBLANG_ENGLISH_SOUTH_AFRICA: return "en_ZA";
00520         case SUBLANG_ENGLISH_JAMAICA: return "en_JM";
00521         case SUBLANG_ENGLISH_CARIBBEAN: return "en_GD"; /* Grenada? */
00522         case SUBLANG_ENGLISH_BELIZE: return "en_BZ";
00523         case SUBLANG_ENGLISH_TRINIDAD: return "en_TT";
00524         case SUBLANG_ENGLISH_ZIMBABWE: return "en_ZW";
00525         case SUBLANG_ENGLISH_PHILIPPINES: return "en_PH";
00526         }
00527       return "en";
00528     case LANG_ESTONIAN: return "et_EE";
00529     case LANG_FAEROESE: return "fo_FO";
00530     case LANG_FARSI: return "fa_IR";
00531     case LANG_FINNISH: return "fi_FI";
00532     case LANG_FRENCH:
00533       switch (sub)
00534         {
00535         case SUBLANG_FRENCH: return "fr_FR";
00536         case SUBLANG_FRENCH_BELGIAN: return "fr_BE";
00537         case SUBLANG_FRENCH_CANADIAN: return "fr_CA";
00538         case SUBLANG_FRENCH_SWISS: return "fr_CH";
00539         case SUBLANG_FRENCH_LUXEMBOURG: return "fr_LU";
00540         case SUBLANG_FRENCH_MONACO: return "fr_MC";
00541         }
00542       return "fr";
00543     case LANG_GEORGIAN: return "ka_GE";
00544     case LANG_GERMAN:
00545       switch (sub)
00546         {
00547         case SUBLANG_GERMAN: return "de_DE";
00548         case SUBLANG_GERMAN_SWISS: return "de_CH";
00549         case SUBLANG_GERMAN_AUSTRIAN: return "de_AT";
00550         case SUBLANG_GERMAN_LUXEMBOURG: return "de_LU";
00551         case SUBLANG_GERMAN_LIECHTENSTEIN: return "de_LI";
00552         }
00553       return "de";
00554     case LANG_GREEK: return "el_GR";
00555     case LANG_GUJARATI: return "gu_IN";
00556     case LANG_HEBREW: return "he_IL";
00557     case LANG_HINDI: return "hi_IN";
00558     case LANG_HUNGARIAN: return "hu_HU";
00559     case LANG_ICELANDIC: return "is_IS";
00560     case LANG_INDONESIAN: return "id_ID";
00561     case LANG_ITALIAN:
00562       switch (sub)
00563         {
00564         case SUBLANG_ITALIAN: return "it_IT";
00565         case SUBLANG_ITALIAN_SWISS: return "it_CH";
00566         }
00567       return "it";
00568     case LANG_JAPANESE: return "ja_JP";
00569     case LANG_KANNADA: return "kn_IN";
00570     case LANG_KASHMIRI:
00571       switch (sub)
00572         {
00573         case SUBLANG_DEFAULT: return "ks_PK";
00574         case SUBLANG_KASHMIRI_INDIA: return "ks_IN";
00575         }
00576       return "ks";
00577     case LANG_KAZAK: return "kk_KZ";
00578     case LANG_KONKANI:
00579       /* FIXME: Adjust this when such locales appear on Unix.  */
00580       return "kok_IN";
00581     case LANG_KOREAN: return "ko_KR";
00582     case LANG_LATVIAN: return "lv_LV";
00583     case LANG_LITHUANIAN: return "lt_LT";
00584     case LANG_MACEDONIAN: return "mk_MK";
00585     case LANG_MALAY:
00586       switch (sub)
00587         {
00588         case SUBLANG_MALAY_MALAYSIA: return "ms_MY";
00589         case SUBLANG_MALAY_BRUNEI_DARUSSALAM: return "ms_BN";
00590         }
00591       return "ms";
00592     case LANG_MALAYALAM: return "ml_IN";
00593     case LANG_MANIPURI:
00594       /* FIXME: Adjust this when such locales appear on Unix.  */
00595       return "mni_IN";
00596     case LANG_MARATHI: return "mr_IN";
00597     case LANG_NEPALI:
00598       switch (sub)
00599         {
00600         case SUBLANG_DEFAULT: return "ne_NP";
00601         case SUBLANG_NEPALI_INDIA: return "ne_IN";
00602         }
00603       return "ne";
00604     case LANG_NORWEGIAN:
00605       switch (sub)
00606         {
00607         case SUBLANG_NORWEGIAN_BOKMAL: return "no_NO";
00608         case SUBLANG_NORWEGIAN_NYNORSK: return "nn_NO";
00609         }
00610       return "no";
00611     case LANG_ORIYA: return "or_IN";
00612     case LANG_POLISH: return "pl_PL";
00613     case LANG_PORTUGUESE:
00614       switch (sub)
00615         {
00616         case SUBLANG_PORTUGUESE: return "pt_PT";
00617         /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT.
00618            Same phenomenon as SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. */
00619         case SUBLANG_PORTUGUESE_BRAZILIAN: return "pt_BR";
00620         }
00621       return "pt";
00622     case LANG_PUNJABI: return "pa_IN";
00623     case LANG_ROMANIAN: return "ro_RO";
00624     case LANG_RUSSIAN:
00625       return "ru"; /* Ambiguous: could be "ru_RU" or "ru_UA".  */
00626     case LANG_SANSKRIT: return "sa_IN";
00627     case LANG_SINDHI: return "sd";
00628     case LANG_SLOVAK: return "sk_SK";
00629     case LANG_SLOVENIAN: return "sl_SI";
00630     case LANG_SORBIAN:
00631       /* FIXME: Adjust this when such locales appear on Unix.  */
00632       return "wen_DE";
00633     case LANG_SPANISH:
00634       switch (sub)
00635         {
00636         case SUBLANG_SPANISH: return "es_ES";
00637         case SUBLANG_SPANISH_MEXICAN: return "es_MX";
00638         case SUBLANG_SPANISH_MODERN:
00639           return "es_ES@modern";        /* not seen on Unix */
00640         case SUBLANG_SPANISH_GUATEMALA: return "es_GT";
00641         case SUBLANG_SPANISH_COSTA_RICA: return "es_CR";
00642         case SUBLANG_SPANISH_PANAMA: return "es_PA";
00643         case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: return "es_DO";
00644         case SUBLANG_SPANISH_VENEZUELA: return "es_VE";
00645         case SUBLANG_SPANISH_COLOMBIA: return "es_CO";
00646         case SUBLANG_SPANISH_PERU: return "es_PE";
00647         case SUBLANG_SPANISH_ARGENTINA: return "es_AR";
00648         case SUBLANG_SPANISH_ECUADOR: return "es_EC";
00649         case SUBLANG_SPANISH_CHILE: return "es_CL";
00650         case SUBLANG_SPANISH_URUGUAY: return "es_UY";
00651         case SUBLANG_SPANISH_PARAGUAY: return "es_PY";
00652         case SUBLANG_SPANISH_BOLIVIA: return "es_BO";
00653         case SUBLANG_SPANISH_EL_SALVADOR: return "es_SV";
00654         case SUBLANG_SPANISH_HONDURAS: return "es_HN";
00655         case SUBLANG_SPANISH_NICARAGUA: return "es_NI";
00656         case SUBLANG_SPANISH_PUERTO_RICO: return "es_PR";
00657         }
00658       return "es";
00659     case LANG_SWAHILI: return "sw";
00660     case LANG_SWEDISH:
00661       switch (sub)
00662         {
00663         case SUBLANG_DEFAULT: return "sv_SE";
00664         case SUBLANG_SWEDISH_FINLAND: return "sv_FI";
00665         }
00666       return "sv";
00667     case LANG_TAMIL:
00668       return "ta"; /* Ambiguous: could be "ta_IN" or "ta_LK" or "ta_SG".  */
00669     case LANG_TATAR: return "tt";
00670     case LANG_TELUGU: return "te_IN";
00671     case LANG_THAI: return "th_TH";
00672     case LANG_TURKISH: return "tr_TR";
00673     case LANG_UKRAINIAN: return "uk_UA";
00674     case LANG_URDU:
00675       switch (sub)
00676         {
00677         case SUBLANG_URDU_PAKISTAN: return "ur_PK";
00678         case SUBLANG_URDU_INDIA: return "ur_IN";
00679         }
00680       return "ur";
00681     case LANG_UZBEK:
00682       switch (sub)
00683         {
00684         /* FIXME: Adjust this when Uzbek locales appear on Unix.  */
00685         case SUBLANG_UZBEK_LATIN: return "uz_UZ@latin";
00686         case SUBLANG_UZBEK_CYRILLIC: return "uz_UZ@cyrillic";
00687         }
00688       return "uz";
00689     case LANG_VIETNAMESE: return "vi_VN";
00690     default: return "C";
00691     }
00692 
00693 #endif
00694 }

Generated on Sun Feb 16 23:39:49 2003 for FreeLCD by doxygen1.2.18