]>
Commit | Line | Data |
---|---|---|
9068dba1 MT |
1 | #!/usr/bin/python |
2 | # encoding: utf-8 | |
3 | ||
66862195 | 4 | _ = lambda x: x.decode("utf-8") |
9068dba1 MT |
5 | |
6 | country_list = { | |
7 | "AD" : _("Andorra"), | |
8 | "AE" : _("United Arab Emirates"), | |
9 | "AF" : _("Afghanistan"), | |
10 | "AG" : _("Antigua and Barbuda"), | |
11 | "AI" : _("Aanguilla"), | |
12 | "AL" : _("Albania"), | |
13 | "AM" : _("Armenia"), | |
14 | "AO" : _("Angola"), | |
15 | "AQ" : _("Antarctica"), | |
16 | "AR" : _("Argentina"), | |
17 | "AS" : _("American Samoa"), | |
18 | "AT" : _("Austria"), | |
19 | "AU" : _("Australia"), | |
20 | "AW" : _("Aruba"), | |
21 | "AX" : _("Åland Islands"), | |
22 | "AZ" : _("Azerbaijan"), | |
23 | "BA" : _("Bosnia and Herzegovina"), | |
24 | "BB" : _("Barbados"), | |
25 | "BD" : _("Bangladesh"), | |
26 | "BE" : _("Belgium"), | |
27 | "BF" : _("Burkina Faso"), | |
28 | "BG" : _("Bulgaria"), | |
29 | "BH" : _("Bahrain"), | |
30 | "BI" : _("Burundi"), | |
31 | "BJ" : _("Benin"), | |
32 | "BL" : _("Saint Barthélemy"), | |
33 | "BM" : _("Bermuda"), | |
34 | "BN" : _("Brunei Darussalam"), | |
35 | "BO" : _("Plurinational State of Bolivia"), | |
36 | "BQ" : _("Sint Eustatius and Saba Bonaire"), | |
37 | "BR" : _("Brazil"), | |
38 | "BS" : _("Bahamas"), | |
39 | "BT" : _("Bhutan"), | |
40 | "BV" : _("Bouvet Island"), | |
41 | "BW" : _("Botswana"), | |
42 | "BY" : _("Belarus"), | |
43 | "BZ" : _("Belize"), | |
44 | "CA" : _("Canada"), | |
45 | "CC" : _("Cocos (Keeling) Islands"), | |
46 | "CD" : _("The Democratic Republic of the Congo"), | |
47 | "CF" : _("Central African Republic"), | |
48 | "CG" : _("Congo"), | |
49 | "CH" : _("Switzerland"), | |
50 | "CI" : _("Côte d'Ivoire"), | |
51 | "CK" : _("Cook Islands"), | |
52 | "CL" : _("Chile"), | |
53 | "CM" : _("Cameroon"), | |
54 | "CN" : _("China"), | |
55 | "CO" : _("Colombia"), | |
56 | "CR" : _("Costa Rica"), | |
57 | "CU" : _("Cuba"), | |
58 | "CV" : _("Cape Verde"), | |
59 | "CW" : _("Curaçao"), | |
60 | "CX" : _("Chrismas Islands"), | |
61 | "CY" : _("Cyprus"), | |
62 | "CZ" : _("Czech Republic"), | |
63 | "DE" : _("Germany"), | |
64 | "DJ" : _("Djibouti"), | |
65 | "DK" : _("Denmark"), | |
66 | "DM" : _("Dominica"), | |
67 | "DO" : _("Dominican Republic"), | |
68 | "DZ" : _("Algeria"), | |
69 | "EC" : _("Ecuador"), | |
70 | "EE" : _("Estonia"), | |
71 | "EG" : _("Egypt"), | |
72 | "EH" : _("Western Sahara"), | |
73 | "ER" : _("Eritrea"), | |
74 | "ES" : _("Spain"), | |
75 | "ET" : _("Ethiopia"), | |
76 | "FI" : _("Finland"), | |
77 | "FJ" : _("Fiji"), | |
78 | "FK" : _("Falkland Islands (Malvinas)"), | |
79 | "FM" : _("Federated States of Micronesia"), | |
80 | "FO" : _("Faroe Islands"), | |
81 | "FR" : _("France"), | |
82 | "GA" : _("Gabon"), | |
83 | "GB" : _("United Kingdom"), | |
84 | "GD" : _("Grenada"), | |
85 | "GE" : _("Georgia"), | |
86 | "GF" : _("French Guiana"), | |
87 | "GG" : _("Guersey"), | |
88 | "GH" : _("Ghana"), | |
89 | "GI" : _("Gibraltar"), | |
90 | "GL" : _("Greenland"), | |
91 | "GM" : _("Gambia"), | |
92 | "GN" : _("Guinea"), | |
93 | "GP" : _("Guadeloupe"), | |
94 | "GQ" : _("Equatorial Guinea"), | |
95 | "GR" : _("Greece"), | |
96 | "GS" : _("South Georgia and the South Sandwich Islands"), | |
97 | "GT" : _("Guatemala"), | |
98 | "GU" : _("Guam"), | |
99 | "GW" : _("Guinea-Bissau"), | |
100 | "GY" : _("Guyana"), | |
101 | "HK" : _("Hong Kong"), | |
102 | "HM" : _("Heard Island and McDonald Islands"), | |
103 | "HN" : _("Honduras"), | |
104 | "HR" : _("Croatia"), | |
105 | "HT" : _("Haiti"), | |
106 | "HU" : _("Hungary"), | |
107 | "ID" : _("Indonesia"), | |
108 | "IE" : _("Ireland"), | |
109 | "IL" : _("Israel"), | |
110 | "IM" : _("Isle of Man"), | |
111 | "IN" : _("India"), | |
112 | "IO" : _("British Indian Ocean Territory"), | |
113 | "IQ" : _("Iraq"), | |
114 | "IR" : _("Islamic Republic of Iran"), | |
115 | "IS" : _("Iceland"), | |
116 | "IT" : _("Italy"), | |
117 | "JE" : _("Jersey"), | |
118 | "JM" : _("Jamaica"), | |
119 | "JO" : _("Jordan"), | |
120 | "JP" : _("Japan"), | |
121 | "KE" : _("Kenya"), | |
122 | "KG" : _("Kyrgyzstan"), | |
123 | "KH" : _("Cambodia"), | |
124 | "KI" : _("Kiribati"), | |
125 | "KM" : _("Comoros"), | |
126 | "KN" : _("Saint Kitts and Nevis"), | |
127 | "KP" : _("Democratic People's Republic of Korea"), | |
128 | "KR" : _("Republic of Korea"), | |
129 | "KW" : _("Kuwait"), | |
130 | "KY" : _("Cayman Islands"), | |
131 | "KZ" : _("Kazakhstan"), | |
132 | "LA" : _("Lao People's Democratic Public"), | |
133 | "LB" : _("Lebanon"), | |
134 | "LC" : _("Saint Lucia"), | |
135 | "LI" : _("Liechtenstein"), | |
136 | "LK" : _("Sri Lanka"), | |
137 | "LR" : _("Liberia"), | |
138 | "LS" : _("Lesotho"), | |
139 | "LT" : _("Lithuania"), | |
140 | "LU" : _("Luxembourg"), | |
141 | "LV" : _("Latvia"), | |
142 | "LY" : _("Libya"), | |
143 | "MA" : _("Morocco"), | |
144 | "MC" : _("Monaco"), | |
145 | "MD" : _("Republic of Moldova"), | |
146 | "ME" : _("Montenegro"), | |
147 | "MF" : _("Saint Martin (French Part)"), | |
148 | "MG" : _("Madagascar"), | |
149 | "MH" : _("Marshall Islands"), | |
150 | "MK" : _("The former Yugoslav Republic of Macedonia"), | |
151 | "ML" : _("Mali"), | |
152 | "MM" : _("Myanmar"), | |
153 | "MN" : _("Mongolia"), | |
154 | "MO" : _("Macao"), | |
155 | "MP" : _("Northern Mariana Islands"), | |
156 | "MQ" : _("Martinique"), | |
157 | "MR" : _("Mauritania"), | |
158 | "MS" : _("Montserrat"), | |
159 | "MT" : _("Malta"), | |
160 | "MU" : _("Mauritius"), | |
161 | "MV" : _("Maldives"), | |
162 | "MW" : _("Malawi"), | |
163 | "MX" : _("Mexico"), | |
164 | "MY" : _("Malaysia"), | |
165 | "MZ" : _("Mozambique"), | |
166 | "NA" : _("Namibia"), | |
167 | "NC" : _("New Caledonia"), | |
168 | "NE" : _("Niger"), | |
169 | "NF" : _("Norfolk Island"), | |
170 | "NG" : _("Nigeria"), | |
171 | "NI" : _("Nicaragua"), | |
172 | "NL" : _("Netherlands"), | |
173 | "NO" : _("Norway"), | |
174 | "NP" : _("Nepal"), | |
175 | "NR" : _("Nauru"), | |
176 | "NU" : _("Niue"), | |
177 | "NZ" : _("New Zealand"), | |
178 | "OM" : _("Oman"), | |
179 | "PA" : _("Panama"), | |
180 | "PE" : _("Peru"), | |
181 | "PF" : _("French Polynesia"), | |
182 | "PG" : _("Papua New Guinea"), | |
183 | "PH" : _("Philipplines"), | |
184 | "PK" : _("Pakistan"), | |
185 | "PL" : _("Poland"), | |
186 | "PM" : _("Saint Pierre and Miquelon"), | |
187 | "PN" : _("Pitcairn"), | |
188 | "PR" : _("Puerto Rico"), | |
189 | "PS" : _("Palestinian Territory, occupied"), | |
190 | "PT" : _("Portugal"), | |
191 | "PW" : _("Palau"), | |
192 | "PY" : _("Paraguay"), | |
193 | "QA" : _("Qatar"), | |
194 | "RE" : _("Réunion"), | |
195 | "RO" : _("Romania"), | |
196 | "RS" : _("Serbia"), | |
197 | "RU" : _("Russian Federation"), | |
198 | "RW" : _("Rwanda"), | |
199 | "SA" : _("Saudi Arabia"), | |
200 | "SB" : _("Solomon Islands"), | |
201 | "SC" : _("Seychelles"), | |
202 | "SD" : _("Sudan"), | |
203 | "SE" : _("Sweden"), | |
204 | "SG" : _("Singapore"), | |
205 | "SH" : _("Saint Helena, Ascension and Tristan Da Cunha"), | |
206 | "SI" : _("Slovenia"), | |
207 | "SJ" : _("Svalbard and Jan Mayen"), | |
208 | "SK" : _("Slovakia"), | |
209 | "SL" : _("Sierra Leone"), | |
210 | "SM" : _("San Marino"), | |
211 | "SN" : _("Senegal"), | |
212 | "SO" : _("Somalia"), | |
213 | "SR" : _("Suriname"), | |
214 | "SS" : _("South Sudan"), | |
215 | "ST" : _("Sao Tome and Principe"), | |
216 | "SV" : _("El Salvador"), | |
217 | "SX" : _("Sint Maarten (Dutch Part)"), | |
218 | "SY" : _("Syrian Arab Republic"), | |
219 | "SZ" : _("Swaziland"), | |
220 | "TC" : _("Turks and Caicos Islands"), | |
221 | "TD" : _("Chad"), | |
222 | "TF" : _("French Southern Territories"), | |
223 | "TG" : _("Togo"), | |
224 | "TH" : _("Thailand"), | |
225 | "TJ" : _("Tajikistan"), | |
226 | "TK" : _("Tokelau"), | |
227 | "TL" : _("Timor-Leste"), | |
228 | "TM" : _("Turkmenistan"), | |
229 | "TN" : _("Tunisia"), | |
230 | "TO" : _("Tonga"), | |
231 | "TR" : _("Turkey"), | |
232 | "TT" : _("Trinidad and Tobago"), | |
233 | "TV" : _("Tuvalu"), | |
234 | "TW" : _("Taiwan, Province of China"), | |
235 | "TZ" : _("United Republic of Tanzania"), | |
236 | "UA" : _("Ukraine"), | |
237 | "UG" : _("Uganda"), | |
66862195 MT |
238 | "UM" : _("United States minor outlying islands"), |
239 | "US" : _("United States"), | |
9068dba1 MT |
240 | "UY" : _("Uruguay"), |
241 | "UZ" : _("Uzbekistan"), | |
242 | "VA" : _("Vatican City State"), | |
243 | "VC" : _("Saint Vincent and the Grenadines"), | |
244 | "VE" : _("Bolivarian Republic of Venezuela"), | |
245 | "VG" : _("Virgin Islands, British"), | |
246 | "VI" : _("Virgin Islands, U.S."), | |
247 | "VN" : _("Viet Nam"), | |
248 | "VU" : _("Vanuatu"), | |
249 | "WF" : _("Wallis and Futuna"), | |
250 | "WS" : _("Samoa"), | |
251 | "YE" : _("Yemen"), | |
252 | "YT" : _("Mayotte"), | |
253 | "ZA" : _("South Africa"), | |
254 | "ZM" : _("Zambia"), | |
255 | "ZW" : _("Zimbabwe"), | |
256 | } | |
257 | ||
258 | def get_by_code(code): | |
259 | return country_list.get(code, None) | |
260 | ||
261 | def get_all(locale=None): | |
262 | if locale is None: | |
263 | l = country_list.keys() | |
264 | else: | |
265 | l = [] | |
266 | ||
267 | for c in country_list.keys(): | |
268 | c = locale.translate(c) | |
269 | l.append(c) | |
270 | ||
271 | # Sort list in place. | |
272 | l.sort() | |
273 | ||
274 | return l |