GRASS Programmer's Manual  6.4.2(2012)
winlocale.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <stdlib.h>
00003 
00004 #include <windows.h>
00005 
00006 static struct locale {
00007     unsigned int code;
00008     const char name[8];
00009 } locales[] = {
00010     {0x0004, "zh_CHS"}, /* Chinese - Simplified */
00011     {0x0401, "ar_SA"},  /* Arabic - Saudi Arabia */
00012     {0x0402, "bg_BG"},  /* Bulgarian */
00013     {0x0403, "ca_ES"},  /* Catalan */
00014     {0x0404, "zh_TW"},  /* Chinese - Taiwan */
00015     {0x0405, "cs_CZ"},  /* Czech */
00016     {0x0406, "da_DK"},  /* Danish */
00017     {0x0407, "de_DE"},  /* German - Germany */
00018     {0x0408, "el_GR"},  /* Greek */
00019     {0x0409, "en_US"},  /* English - United States */
00020     {0x040a, "es_ES"},  /* Spanish - Spain */
00021     {0x040b, "fi_FI"},  /* Finnish */
00022     {0x040c, "fr_FR"},  /* French - France */
00023     {0x040d, "he_IL"},  /* Hebrew */
00024     {0x040e, "hu_HU"},  /* Hungarian */
00025     {0x040f, "is_IS"},  /* Icelandic */
00026     {0x0410, "it_IT"},  /* Italian - Italy */
00027     {0x0411, "ja_JP"},  /* Japanese */
00028     {0x0412, "ko_KR"},  /* Korean */
00029     {0x0413, "nl_NL"},  /* Dutch - The Netherlands */
00030     {0x0414, "nb_NO"},  /* Norwegian - Bokmal */
00031     {0x0415, "pl_PL"},  /* Polish */
00032     {0x0416, "pt_BR"},  /* Portuguese - Brazil */
00033     {0x0417, "rm_CH"},  /* Raeto-Romanese */
00034     {0x0418, "ro_RO"},  /* Romanian - Romania */
00035     {0x0419, "ru_RU"},  /* Russian */
00036     {0x041a, "hr_HR"},  /* Croatian */
00037     {0x041b, "sk_SK"},  /* Slovak */
00038     {0x041c, "sq_AL"},  /* Albanian */
00039     {0x041d, "sv_SE"},  /* Swedish - Sweden */
00040     {0x041e, "th_TH"},  /* Thai */
00041     {0x041f, "tr_TR"},  /* Turkish */
00042     {0x0420, "ur_PK"},  /* Urdu */
00043     {0x0421, "id_ID"},  /* Indonesian */
00044     {0x0422, "uk_UA"},  /* Ukrainian */
00045     {0x0423, "be_BY"},  /* Belarusian */
00046     {0x0424, "sl_SI"},  /* Slovenian */
00047     {0x0425, "et_EE"},  /* Estonian */
00048     {0x0426, "lv_LV"},  /* Latvian */
00049     {0x0427, "lt_LT"},  /* Lithuanian */
00050     {0x0429, "fa_IR"},  /* Persian */
00051     {0x042a, "vi_VN"},  /* Vietnamese */
00052     {0x042b, "hy_AM"},  /* Armenian */
00053     {0x042c, "az_AZ"},  /* Azeri Latin */
00054     {0x042d, "eu_ES"},  /* Basque */
00055     {0x042f, "mk_MK"},  /* FYRO Macedonian */
00056     {0x0432, "tn_ZA"},  /* Setswana - Southern Africa */
00057     {0x0434, "xh_ZA"},  /* Xhosa - South Africa */
00058     {0x0435, "zu_ZA"},  /* Zulu */
00059     {0x0436, "af_ZA"},  /* Afrikaans */
00060     {0x0437, "ka_GE"},  /* Georgian */
00061     {0x0438, "fo_FO"},  /* Faroese */
00062     {0x0439, "hi_IN"},  /* Hindi */
00063     {0x043a, "mt_MT"},  /* Maltese */
00064     {0x043b, "se_NO"},  /* Sami Northern Norway */
00065     {0x043e, "ms_MY"},  /* Malay - Malaysia */
00066     {0x043f, "kk_KZ"},  /* Kazakh */
00067     {0x0440, "ky_KG"},  /* Kyrgyz */
00068     {0x0441, "sw_KE"},  /* Swahili */
00069     {0x0443, "uz_UZ"},  /* Uzbek - Latin */
00070     {0x0444, "tt_RU"},  /* Tatar */
00071     {0x0445, "bn_IN"},  /* Begali */
00072     {0x0446, "pa_IN"},  /* Punjabi */
00073     {0x0447, "gu_IN"},  /* Gujarati */
00074     {0x0448, "or_IN"},  /* Oriya - India */
00075     {0x0449, "ta_IN"},  /* Tamil */
00076     {0x044a, "te_IN"},  /* Telugu */
00077     {0x044b, "kn_IN"},  /* Kannada - India */
00078     {0x044c, "ml_IN"},  /* Malayalam - India */
00079     {0x044e, "mr_IN"},  /* Marathi */
00080     {0x044f, "sa_IN"},  /* Sanskrit */
00081     {0x0450, "mn_MN"},  /* Mongolian */
00082     {0x0452, "cy_GB"},  /* Welsh */
00083     {0x0456, "gl_ES"},  /* Galician */
00084     {0x0457, "kok_IN"}, /* Konkani */
00085     {0x045a, "syr_SY"}, /* Syriac */
00086     {0x045d, "iu_CA"},  /* Inuktitut */
00087     {0x0461, "ne_NP"},  /* Nepali */
00088     {0x0462, "fy_NL"},  /* Frisian - Netherlands */
00089     {0x0463, "ps_AF"},  /* Pashto - Afghanistan */
00090     {0x0464, "fil_PH"}, /* Filipino */
00091     {0x0465, "div_MV"}, /* Divehi - Maldives */
00092     {0x046b, "quz_BO"}, /* Quechua (Bolivia) */
00093     {0x046c, "ns_ZA"},  /* Northern Sotho */
00094     {0x046e, "lb_LU"},  /* Luxembourgish */
00095     {0x047a, "arn_CL"}, /* Mapudungun */
00096     {0x047c, "moh_CA"}, /* Mohawk - Canada */
00097     {0x047e, "br_FR"},  /* Breton - France */
00098     {0x0481, "mi_NZ"},  /* Maori */
00099     {0x0482, "oc_FR"},  /* Occitan - France */
00100     {0x048c, "gbz_AF"}, /* Dari - Afghanistan */
00101     {0x0801, "ar_IQ"},  /* Arabic - Iraq */
00102     {0x0804, "zh_CN"},  /* Chinese - PRC */
00103     {0x0807, "de_CH"},  /* German - Switzerland */
00104     {0x0809, "en_GB"},  /* English - United Kingdom */
00105     {0x080a, "es_MX"},  /* Spanish - Mexico */
00106     {0x080c, "fr_BE"},  /* French - Belgium */
00107     {0x0810, "it_CH"},  /* Italian - Switzerland */
00108     {0x0813, "nl_BE"},  /* Dutch - Belgium */
00109     {0x0814, "nn_NO"},  /* Norwegian - Nynorsk */
00110     {0x0816, "pt_PT"},  /* Portuguese - Portugal */
00111     {0x081a, "sr_SP"},  /* Serbian - Latin */
00112     {0x081d, "sv_FI"},  /* Swedish - Finland */
00113     {0x0820, "ur_IN"},  /* Urdu - India */
00114     {0x082c, "az_AZ"},  /* Azeri - Cyrillic */
00115     {0x083b, "se_SE"},  /* Sami Northern Sweden */
00116     {0x083c, "ga_IE"},  /* Irish - Ireland */
00117     {0x083e, "ms_BN"},  /* Malay - Brunei */
00118     {0x0843, "uz_UZ"},  /* Uzbek - Cyrillic */
00119     {0x085d, "iu_CA"},  /* Inuktitut - Latin */
00120     {0x086b, "quz_EC"}, /* Quechua (Ecuador) */
00121     {0x0c01, "ar_EG"},  /* Arabic - Egypt */
00122     {0x0c04, "zh_HK"},  /* Chinese - Hong Kong S.A.R. */
00123     {0x0c07, "de_AT"},  /* German - Austria */
00124     {0x0c09, "en_AU"},  /* English - Australia */
00125     {0x0c0a, "es_ES"},  /* Spanish - Spain (Modern) */
00126     {0x0c0c, "fr_CA"},  /* French - Canada */
00127     {0x0c1a, "sr_SP"},  /* Serbian - Cyrillic */
00128     {0x0c3b, "se_FI"},  /* Sami Northern Finland */
00129     {0x0c6b, "quz_PE"}, /* Quechua (Peru) */
00130     {0x1001, "ar_LY"},  /* Arabic - Libya */
00131     {0x1004, "zh_SG"},  /* Chinese - Singapore */
00132     {0x1007, "de_LU"},  /* German - Luxembourg */
00133     {0x1009, "en_CA"},  /* English - Canada */
00134     {0x100a, "es_GT"},  /* Spanish - Guatemala */
00135     {0x100c, "fr_CH"},  /* French - Switzerland */
00136     {0x101a, "hr_BA"},  /* Croatian - Bosnia */
00137     {0x103b, "smj_NO"}, /* Sami Norway */
00138     {0x1401, "ar_DZ"},  /* Arabic - Algeria */
00139     {0x1404, "zh_MO"},  /* Chinese - Macao S.A.R. */
00140     {0x1407, "de_LI"},  /* German - Liechtenstein */
00141     {0x1409, "en_NZ"},  /* English - New Zealand */
00142     {0x140a, "es_CR"},  /* Spanish - Costa Rica */
00143     {0x140c, "fr_LU"},  /* French - Luxembourg */
00144     {0x141a, "bs_BA"},  /* Bosnian - Cyrillic */
00145     {0x143b, "smj_SE"}, /* Sami Sweden */
00146     {0x1801, "ar_MA"},  /* Arabic - Morocco */
00147     {0x1809, "en_IE"},  /* English - Ireland */
00148     {0x180a, "es_PA"},  /* Spanish - Panama */
00149     {0x180c, "fr_MC"},  /* French - Monaco */
00150     {0x181a, "sr_BA"},  /* Serbian - Bosnia Latin */
00151     {0x183b, "sma_NO"}, /* Sami Southern Norway */
00152     {0x1c01, "ar_TN"},  /* Arabic - Tunisia */
00153     {0x1c09, "en_ZA"},  /* English - South Africa */
00154     {0x1c0a, "es_DO"},  /* Spanish - Dominican Republic */
00155     {0x1c1a, "sr_BA"},  /* Serbian - Bosnia Cyrillic */
00156     {0x1c3b, "sma_SE"}, /* Sami Southern Sweden */
00157     {0x2001, "ar_OM"},  /* Arabic - Oman */
00158     {0x2009, "en_JA"},  /* English - Jamaica */
00159     {0x200a, "es_VE"},  /* Spanish - Venezuela */
00160     {0x201a, "bs_BA"},  /* Bosnian */
00161     {0x203b, "sms_FI"}, /* Sami Skolt */
00162     {0x2401, "ar_YE"},  /* Arabic - Yemen */
00163     {0x2409, "en_CB"},  /* English - Carribbean */
00164     {0x240a, "es_CO"},  /* Spanish - Colombia */
00165     {0x243b, "smn_FI"}, /* Sami Finland */
00166     {0x2801, "ar_SY"},  /* Arabic - Syria */
00167     {0x2809, "en_BZ"},  /* English - Belize */
00168     {0x280a, "es_PE"},  /* Spanish - Peru */
00169     {0x2c01, "ar_JO"},  /* Arabic - Jordan */
00170     {0x2c09, "en_TT"},  /* English - Trinidad */
00171     {0x2c0a, "es_AR"},  /* Spanish - Argentina */
00172     {0x3001, "ar_LB"},  /* Arabic - Lebanon */
00173     {0x3009, "en_ZW"},  /* English - Zimbabwe */
00174     {0x300a, "es_EC"},  /* Spanish - Ecuador */
00175     {0x3401, "ar_KW"},  /* Arabic - Kuwait */
00176     {0x3409, "en_PH"},  /* English - Phillippines */
00177     {0x340a, "es_CL"},  /* Spanish - Chile */
00178     {0x3801, "ar_AE"},  /* Arabic - United Arab Emirates */
00179     {0x380a, "es_UR"},  /* Spanish - Uruguay */
00180     {0x3c01, "ar_BH"},  /* Arabic - Bahrain */
00181     {0x3c0a, "es_PY"},  /* Spanish - Paraguay */
00182     {0x4001, "ar_QA"},  /* Arabic - Qatar */
00183     {0x400a, "es_BO"},  /* Spanish - Bolivia */
00184     {0x440a, "es_SV"},  /* Spanish - El Salvador */
00185     {0x480a, "es_HN"},  /* Spanish - Honduras */
00186     {0x4c0a, "es_NI"},  /* Spanish - Nicaragua */
00187     {0x500a, "es_PR"},  /* Spanish - Puerto Rico */
00188     {0x7c04, "zh_CHT"}, /* Chinese - Traditional */
00189 };
00190 
00191 static int num_locales = sizeof(locales) / sizeof(locales[0]);
00192 
00193 static int compare(const void *pkey, const void *pval)
00194 {
00195     LCID code = *(const LCID *)pkey;
00196     const struct locale *loc = pval;
00197     return code - loc->code;
00198 }
00199 
00200 int main(void)
00201 {
00202     LCID code = GetUserDefaultLCID();
00203     struct locale *loc = bsearch(&code,
00204                                  locales, num_locales, sizeof(locales[0]),
00205                                  compare);
00206     if (!loc)
00207         return 1;
00208     fprintf(stdout, "%s\n", loc->name);
00209     return 0;
00210 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines