GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-d6dec75dd4
winlocale.c
Go to the documentation of this file.
1 #include <stdio.h>
2 #include <stdlib.h>
3 
4 #include <windows.h>
5 
6 static struct locale {
7  unsigned int code;
8  const char name[8];
9 } locales[] = {
10  {0x0004, "zh_CHS"}, /* Chinese - Simplified */
11  {0x0401, "ar_SA"}, /* Arabic - Saudi Arabia */
12  {0x0402, "bg_BG"}, /* Bulgarian */
13  {0x0403, "ca_ES"}, /* Catalan */
14  {0x0404, "zh_TW"}, /* Chinese - Taiwan */
15  {0x0405, "cs_CZ"}, /* Czech */
16  {0x0406, "da_DK"}, /* Danish */
17  {0x0407, "de_DE"}, /* German - Germany */
18  {0x0408, "el_GR"}, /* Greek */
19  {0x0409, "en_US"}, /* English - United States */
20  {0x040a, "es_ES"}, /* Spanish - Spain */
21  {0x040b, "fi_FI"}, /* Finnish */
22  {0x040c, "fr_FR"}, /* French - France */
23  {0x040d, "he_IL"}, /* Hebrew */
24  {0x040e, "hu_HU"}, /* Hungarian */
25  {0x040f, "is_IS"}, /* Icelandic */
26  {0x0410, "it_IT"}, /* Italian - Italy */
27  {0x0411, "ja_JP"}, /* Japanese */
28  {0x0412, "ko_KR"}, /* Korean */
29  {0x0413, "nl_NL"}, /* Dutch - The Netherlands */
30  {0x0414, "nb_NO"}, /* Norwegian - Bokmal */
31  {0x0415, "pl_PL"}, /* Polish */
32  {0x0416, "pt_BR"}, /* Portuguese - Brazil */
33  {0x0417, "rm_CH"}, /* Raeto-Romanese */
34  {0x0418, "ro_RO"}, /* Romanian - Romania */
35  {0x0419, "ru_RU"}, /* Russian */
36  {0x041a, "hr_HR"}, /* Croatian */
37  {0x041b, "sk_SK"}, /* Slovak */
38  {0x041c, "sq_AL"}, /* Albanian */
39  {0x041d, "sv_SE"}, /* Swedish - Sweden */
40  {0x041e, "th_TH"}, /* Thai */
41  {0x041f, "tr_TR"}, /* Turkish */
42  {0x0420, "ur_PK"}, /* Urdu */
43  {0x0421, "id_ID"}, /* Indonesian */
44  {0x0422, "uk_UA"}, /* Ukrainian */
45  {0x0423, "be_BY"}, /* Belarusian */
46  {0x0424, "sl_SI"}, /* Slovenian */
47  {0x0425, "et_EE"}, /* Estonian */
48  {0x0426, "lv_LV"}, /* Latvian */
49  {0x0427, "lt_LT"}, /* Lithuanian */
50  {0x0429, "fa_IR"}, /* Persian */
51  {0x042a, "vi_VN"}, /* Vietnamese */
52  {0x042b, "hy_AM"}, /* Armenian */
53  {0x042c, "az_AZ"}, /* Azeri Latin */
54  {0x042d, "eu_ES"}, /* Basque */
55  {0x042f, "mk_MK"}, /* FYRO Macedonian */
56  {0x0432, "tn_ZA"}, /* Setswana - Southern Africa */
57  {0x0434, "xh_ZA"}, /* Xhosa - South Africa */
58  {0x0435, "zu_ZA"}, /* Zulu */
59  {0x0436, "af_ZA"}, /* Afrikaans */
60  {0x0437, "ka_GE"}, /* Georgian */
61  {0x0438, "fo_FO"}, /* Faroese */
62  {0x0439, "hi_IN"}, /* Hindi */
63  {0x043a, "mt_MT"}, /* Maltese */
64  {0x043b, "se_NO"}, /* Sami Northern Norway */
65  {0x043e, "ms_MY"}, /* Malay - Malaysia */
66  {0x043f, "kk_KZ"}, /* Kazakh */
67  {0x0440, "ky_KG"}, /* Kyrgyz */
68  {0x0441, "sw_KE"}, /* Swahili */
69  {0x0443, "uz_UZ"}, /* Uzbek - Latin */
70  {0x0444, "tt_RU"}, /* Tatar */
71  {0x0445, "bn_IN"}, /* Begali */
72  {0x0446, "pa_IN"}, /* Punjabi */
73  {0x0447, "gu_IN"}, /* Gujarati */
74  {0x0448, "or_IN"}, /* Oriya - India */
75  {0x0449, "ta_IN"}, /* Tamil */
76  {0x044a, "te_IN"}, /* Telugu */
77  {0x044b, "kn_IN"}, /* Kannada - India */
78  {0x044c, "ml_IN"}, /* Malayalam - India */
79  {0x044e, "mr_IN"}, /* Marathi */
80  {0x044f, "sa_IN"}, /* Sanskrit */
81  {0x0450, "mn_MN"}, /* Mongolian */
82  {0x0452, "cy_GB"}, /* Welsh */
83  {0x0456, "gl_ES"}, /* Galician */
84  {0x0457, "kok_IN"}, /* Konkani */
85  {0x045a, "syr_SY"}, /* Syriac */
86  {0x045d, "iu_CA"}, /* Inuktitut */
87  {0x0461, "ne_NP"}, /* Nepali */
88  {0x0462, "fy_NL"}, /* Frisian - Netherlands */
89  {0x0463, "ps_AF"}, /* Pashto - Afghanistan */
90  {0x0464, "fil_PH"}, /* Filipino */
91  {0x0465, "div_MV"}, /* Divehi - Maldives */
92  {0x046b, "quz_BO"}, /* Quechua (Bolivia) */
93  {0x046c, "ns_ZA"}, /* Northern Sotho */
94  {0x046e, "lb_LU"}, /* Luxembourgish */
95  {0x047a, "arn_CL"}, /* Mapudungun */
96  {0x047c, "moh_CA"}, /* Mohawk - Canada */
97  {0x047e, "br_FR"}, /* Breton - France */
98  {0x0481, "mi_NZ"}, /* Maori */
99  {0x0482, "oc_FR"}, /* Occitan - France */
100  {0x048c, "gbz_AF"}, /* Dari - Afghanistan */
101  {0x0801, "ar_IQ"}, /* Arabic - Iraq */
102  {0x0804, "zh_CN"}, /* Chinese - PRC */
103  {0x0807, "de_CH"}, /* German - Switzerland */
104  {0x0809, "en_GB"}, /* English - United Kingdom */
105  {0x080a, "es_MX"}, /* Spanish - Mexico */
106  {0x080c, "fr_BE"}, /* French - Belgium */
107  {0x0810, "it_CH"}, /* Italian - Switzerland */
108  {0x0813, "nl_BE"}, /* Dutch - Belgium */
109  {0x0814, "nn_NO"}, /* Norwegian - Nynorsk */
110  {0x0816, "pt_PT"}, /* Portuguese - Portugal */
111  {0x081a, "sr_SP"}, /* Serbian - Latin */
112  {0x081d, "sv_FI"}, /* Swedish - Finland */
113  {0x0820, "ur_IN"}, /* Urdu - India */
114  {0x082c, "az_AZ"}, /* Azeri - Cyrillic */
115  {0x083b, "se_SE"}, /* Sami Northern Sweden */
116  {0x083c, "ga_IE"}, /* Irish - Ireland */
117  {0x083e, "ms_BN"}, /* Malay - Brunei */
118  {0x0843, "uz_UZ"}, /* Uzbek - Cyrillic */
119  {0x085d, "iu_CA"}, /* Inuktitut - Latin */
120  {0x086b, "quz_EC"}, /* Quechua (Ecuador) */
121  {0x0c01, "ar_EG"}, /* Arabic - Egypt */
122  {0x0c04, "zh_HK"}, /* Chinese - Hong Kong S.A.R. */
123  {0x0c07, "de_AT"}, /* German - Austria */
124  {0x0c09, "en_AU"}, /* English - Australia */
125  {0x0c0a, "es_ES"}, /* Spanish - Spain (Modern) */
126  {0x0c0c, "fr_CA"}, /* French - Canada */
127  {0x0c1a, "sr_SP"}, /* Serbian - Cyrillic */
128  {0x0c3b, "se_FI"}, /* Sami Northern Finland */
129  {0x0c6b, "quz_PE"}, /* Quechua (Peru) */
130  {0x1001, "ar_LY"}, /* Arabic - Libya */
131  {0x1004, "zh_SG"}, /* Chinese - Singapore */
132  {0x1007, "de_LU"}, /* German - Luxembourg */
133  {0x1009, "en_CA"}, /* English - Canada */
134  {0x100a, "es_GT"}, /* Spanish - Guatemala */
135  {0x100c, "fr_CH"}, /* French - Switzerland */
136  {0x101a, "hr_BA"}, /* Croatian - Bosnia */
137  {0x103b, "smj_NO"}, /* Sami Norway */
138  {0x1401, "ar_DZ"}, /* Arabic - Algeria */
139  {0x1404, "zh_MO"}, /* Chinese - Macao S.A.R. */
140  {0x1407, "de_LI"}, /* German - Liechtenstein */
141  {0x1409, "en_NZ"}, /* English - New Zealand */
142  {0x140a, "es_CR"}, /* Spanish - Costa Rica */
143  {0x140c, "fr_LU"}, /* French - Luxembourg */
144  {0x141a, "bs_BA"}, /* Bosnian - Cyrillic */
145  {0x143b, "smj_SE"}, /* Sami Sweden */
146  {0x1801, "ar_MA"}, /* Arabic - Morocco */
147  {0x1809, "en_IE"}, /* English - Ireland */
148  {0x180a, "es_PA"}, /* Spanish - Panama */
149  {0x180c, "fr_MC"}, /* French - Monaco */
150  {0x181a, "sr_BA"}, /* Serbian - Bosnia Latin */
151  {0x183b, "sma_NO"}, /* Sami Southern Norway */
152  {0x1c01, "ar_TN"}, /* Arabic - Tunisia */
153  {0x1c09, "en_ZA"}, /* English - South Africa */
154  {0x1c0a, "es_DO"}, /* Spanish - Dominican Republic */
155  {0x1c1a, "sr_BA"}, /* Serbian - Bosnia Cyrillic */
156  {0x1c3b, "sma_SE"}, /* Sami Southern Sweden */
157  {0x2001, "ar_OM"}, /* Arabic - Oman */
158  {0x2009, "en_JA"}, /* English - Jamaica */
159  {0x200a, "es_VE"}, /* Spanish - Venezuela */
160  {0x201a, "bs_BA"}, /* Bosnian */
161  {0x203b, "sms_FI"}, /* Sami Skolt */
162  {0x2401, "ar_YE"}, /* Arabic - Yemen */
163  {0x2409, "en_CB"}, /* English - Carribbean */
164  {0x240a, "es_CO"}, /* Spanish - Colombia */
165  {0x243b, "smn_FI"}, /* Sami Finland */
166  {0x2801, "ar_SY"}, /* Arabic - Syria */
167  {0x2809, "en_BZ"}, /* English - Belize */
168  {0x280a, "es_PE"}, /* Spanish - Peru */
169  {0x2c01, "ar_JO"}, /* Arabic - Jordan */
170  {0x2c09, "en_TT"}, /* English - Trinidad */
171  {0x2c0a, "es_AR"}, /* Spanish - Argentina */
172  {0x3001, "ar_LB"}, /* Arabic - Lebanon */
173  {0x3009, "en_ZW"}, /* English - Zimbabwe */
174  {0x300a, "es_EC"}, /* Spanish - Ecuador */
175  {0x3401, "ar_KW"}, /* Arabic - Kuwait */
176  {0x3409, "en_PH"}, /* English - Phillippines */
177  {0x340a, "es_CL"}, /* Spanish - Chile */
178  {0x3801, "ar_AE"}, /* Arabic - United Arab Emirates */
179  {0x380a, "es_UR"}, /* Spanish - Uruguay */
180  {0x3c01, "ar_BH"}, /* Arabic - Bahrain */
181  {0x3c0a, "es_PY"}, /* Spanish - Paraguay */
182  {0x4001, "ar_QA"}, /* Arabic - Qatar */
183  {0x400a, "es_BO"}, /* Spanish - Bolivia */
184  {0x440a, "es_SV"}, /* Spanish - El Salvador */
185  {0x480a, "es_HN"}, /* Spanish - Honduras */
186  {0x4c0a, "es_NI"}, /* Spanish - Nicaragua */
187  {0x500a, "es_PR"}, /* Spanish - Puerto Rico */
188  {0x7c04, "zh_CHT"}, /* Chinese - Traditional */
189 };
190 
191 static int num_locales = sizeof(locales) / sizeof(locales[0]);
192 
193 static int compare(const void *pkey, const void *pval)
194 {
195  LCID code = *(const LCID *)pkey;
196  const struct locale *loc = pval;
197 
198  return code - loc->code;
199 }
200 
201 int main(void)
202 {
203  LCID code = GetUserDefaultLCID();
204  struct locale *loc =
205  bsearch(&code, locales, num_locales, sizeof(locales[0]), compare);
206 
207  if (!loc)
208  return 1;
209  fprintf(stdout, "%s\n", loc->name);
210  return 0;
211 }
int compare(const void *a, const void *b)
Definition: dgraph.c:168
const char * name
Definition: named_colr.c:6
int main(void)
Definition: winlocale.c:201