/[drupal]/contributions/modules/site_country/site_country_country_list.inc
ViewVC logotype

Contents of /contributions/modules/site_country/site_country_country_list.inc

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.2 - (show annotations) (download) (as text)
Wed Nov 12 12:51:23 2008 UTC (12 months, 1 week ago) by snpower
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +304 -0 lines
File MIME type: text/x-php
Head versions.
1 <?php
2 // $Id: site_country_country_list.inc,v 1.1.2.1 2008/11/11 23:53:21 snpower Exp $
3
4 /**
5 * @file
6 * Provides a list of countries based on ISO 3166-1 alpha-2.
7 */
8
9 /**
10 * Get an array of all country code => country name pairs as layed out
11 * in ISO 3166-1 alpha-2 with the exception that on the ISO standard
12 * country codes are uppercased.
13 *
14 * Grabbed from location project (http://drupal.org/project/location).
15 *
16 * @return
17 * An array of all country code => country name pairs.
18 */
19 function _site_country_country_list() {
20 static $countries;
21
22 if (isset($countries)) {
23 return $countries;
24 }
25 $t = _site_country_get_t();
26
27 $countries = array(
28 'ad' => $t('Andorra'),
29 'ae' => $t('United Arab Emirates'),
30 'af' => $t('Afghanistan'),
31 'ag' => $t('Antigua and Barbuda'),
32 'ai' => $t('Anguilla'),
33 'al' => $t('Albania'),
34 'am' => $t('Armenia'),
35 'an' => $t('Netherlands Antilles'),
36 'ao' => $t('Angola'),
37 'aq' => $t('Antarctica'),
38 'ar' => $t('Argentina'),
39 'as' => $t('American Samoa'),
40 'at' => $t('Austria'),
41 'au' => $t('Australia'),
42 'aw' => $t('Aruba'),
43 'ax' => $t('Aland Islands'),
44 'az' => $t('Azerbaijan'),
45 'ba' => $t('Bosnia and Herzegovina'),
46 'bb' => $t('Barbados'),
47 'bd' => $t('Bangladesh'),
48 'be' => $t('Belgium'),
49 'bf' => $t('Burkina Faso'),
50 'bg' => $t('Bulgaria'),
51 'bh' => $t('Bahrain'),
52 'bi' => $t('Burundi'),
53 'bj' => $t('Benin'),
54 'bm' => $t('Bermuda'),
55 'bn' => $t('Brunei'),
56 'bo' => $t('Bolivia'),
57 'br' => $t('Brazil'),
58 'bs' => $t('Bahamas'),
59 'bt' => $t('Bhutan'),
60 'bv' => $t('Bouvet Island'),
61 'bw' => $t('Botswana'),
62 'by' => $t('Belarus'),
63 'bz' => $t('Belize'),
64 'ca' => $t('Canada'),
65 'cc' => $t('Cocos (Keeling) Islands'),
66 'cd' => $t('Congo (Kinshasa)'),
67 'cf' => $t('Central African Republic'),
68 'cg' => $t('Congo (Brazzaville)'),
69 'ch' => $t('Switzerland'),
70 'ci' => $t('Ivory Coast'),
71 'ck' => $t('Cook Islands'),
72 'cl' => $t('Chile'),
73 'cm' => $t('Cameroon'),
74 'cn' => $t('China'),
75 'co' => $t('Colombia'),
76 'cr' => $t('Costa Rica'),
77 'cs' => $t('Serbia And Montenegro'),
78 'cu' => $t('Cuba'),
79 'cv' => $t('Cape Verde'),
80 'cx' => $t('Christmas Island'),
81 'cy' => $t('Cyprus'),
82 'cz' => $t('Czech Republic'),
83 'de' => $t('Germany'),
84 'dj' => $t('Djibouti'),
85 'dk' => $t('Denmark'),
86 'dm' => $t('Dominica'),
87 'do' => $t('Dominican Republic'),
88 'dz' => $t('Algeria'),
89 'ec' => $t('Ecuador'),
90 'ee' => $t('Estonia'),
91 'eg' => $t('Egypt'),
92 'eh' => $t('Western Sahara'),
93 'er' => $t('Eritrea'),
94 'es' => $t('Spain'),
95 'et' => $t('Ethiopia'),
96 'fi' => $t('Finland'),
97 'fj' => $t('Fiji'),
98 'fk' => $t('Falkland Islands'),
99 'fm' => $t('Micronesia'),
100 'fo' => $t('Faroe Islands'),
101 'fr' => $t('France'),
102 'ga' => $t('Gabon'),
103 'gd' => $t('Grenada'),
104 'ge' => $t('Georgia'),
105 'gf' => $t('French Guiana'),
106 'gg' => $t('Guernsey'),
107 'gh' => $t('Ghana'),
108 'gi' => $t('Gibraltar'),
109 'gl' => $t('Greenland'),
110 'gm' => $t('Gambia'),
111 'gn' => $t('Guinea'),
112 'gp' => $t('Guadeloupe'),
113 'gq' => $t('Equatorial Guinea'),
114 'gr' => $t('Greece'),
115 'gs' => $t('South Georgia and the South Sandwich Islands'),
116 'gt' => $t('Guatemala'),
117 'gu' => $t('Guam'),
118 'gw' => $t('Guinea-Bissau'),
119 'gy' => $t('Guyana'),
120 'hk' => $t('Hong Kong S.A.R., China'),
121 'hm' => $t('Heard Island and McDonald Islands'),
122 'hn' => $t('Honduras'),
123 'hr' => $t('Croatia'),
124 'ht' => $t('Haiti'),
125 'hu' => $t('Hungary'),
126 'id' => $t('Indonesia'),
127 'ie' => $t('Ireland'),
128 'il' => $t('Israel'),
129 'im' => $t('Isle of Man'),
130 'in' => $t('India'),
131 'io' => $t('British Indian Ocean Territory'),
132 'iq' => $t('Iraq'),
133 'ir' => $t('Iran'),
134 'is' => $t('Iceland'),
135 'it' => $t('Italy'),
136 'je' => $t('Jersey'),
137 'jm' => $t('Jamaica'),
138 'jo' => $t('Jordan'),
139 'jp' => $t('Japan'),
140 'ke' => $t('Kenya'),
141 'kg' => $t('Kyrgyzstan'),
142 'kh' => $t('Cambodia'),
143 'ki' => $t('Kiribati'),
144 'km' => $t('Comoros'),
145 'kn' => $t('Saint Kitts and Nevis'),
146 'kp' => $t('North Korea'),
147 'kr' => $t('South Korea'),
148 'kw' => $t('Kuwait'),
149 'ky' => $t('Cayman Islands'),
150 'kz' => $t('Kazakhstan'),
151 'la' => $t('Laos'),
152 'lb' => $t('Lebanon'),
153 'lc' => $t('Saint Lucia'),
154 'li' => $t('Liechtenstein'),
155 'lk' => $t('Sri Lanka'),
156 'lr' => $t('Liberia'),
157 'ls' => $t('Lesotho'),
158 'lt' => $t('Lithuania'),
159 'lu' => $t('Luxembourg'),
160 'lv' => $t('Latvia'),
161 'ly' => $t('Libya'),
162 'ma' => $t('Morocco'),
163 'mc' => $t('Monaco'),
164 'md' => $t('Moldova'),
165 'me' => $t('Montenegro'),
166 'mg' => $t('Madagascar'),
167 'mh' => $t('Marshall Islands'),
168 'mk' => $t('Macedonia'),
169 'ml' => $t('Mali'),
170 'mm' => $t('Myanmar'),
171 'mn' => $t('Mongolia'),
172 'mo' => $t('Macao S.A.R., China'),
173 'mp' => $t('Northern Mariana Islands'),
174 'mq' => $t('Martinique'),
175 'mr' => $t('Mauritania'),
176 'ms' => $t('Montserrat'),
177 'mt' => $t('Malta'),
178 'mu' => $t('Mauritius'),
179 'mv' => $t('Maldives'),
180 'mw' => $t('Malawi'),
181 'mx' => $t('Mexico'),
182 'my' => $t('Malaysia'),
183 'mz' => $t('Mozambique'),
184 'na' => $t('Namibia'),
185 'nc' => $t('New Caledonia'),
186 'ne' => $t('Niger'),
187 'nf' => $t('Norfolk Island'),
188 'ng' => $t('Nigeria'),
189 'ni' => $t('Nicaragua'),
190 'nl' => $t('Netherlands'),
191 'no' => $t('Norway'),
192 'np' => $t('Nepal'),
193 'nr' => $t('Nauru'),
194 'nu' => $t('Niue'),
195 'nz' => $t('New Zealand'),
196 'om' => $t('Oman'),
197 'pa' => $t('Panama'),
198 'pe' => $t('Peru'),
199 'pf' => $t('French Polynesia'),
200 'pg' => $t('Papua New Guinea'),
201 'ph' => $t('Philippines'),
202 'pk' => $t('Pakistan'),
203 'pl' => $t('Poland'),
204 'pm' => $t('Saint Pierre and Miquelon'),
205 'pn' => $t('Pitcairn'),
206 'pr' => $t('Puerto Rico'),
207 'ps' => $t('Palestinian Territory'),
208 'pt' => $t('Portugal'),
209 'pw' => $t('Palau'),
210 'py' => $t('Paraguay'),
211 'qa' => $t('Qatar'),
212 're' => $t('Reunion'),
213 'ro' => $t('Romania'),
214 'rs' => $t('Serbia'),
215 'ru' => $t('Russia'),
216 'rw' => $t('Rwanda'),
217 'sa' => $t('Saudi Arabia'),
218 'sb' => $t('Solomon Islands'),
219 'sc' => $t('Seychelles'),
220 'sd' => $t('Sudan'),
221 'se' => $t('Sweden'),
222 'sg' => $t('Singapore'),
223 'sh' => $t('Saint Helena'),
224 'si' => $t('Slovenia'),
225 'sj' => $t('Svalbard and Jan Mayen'),
226 'sk' => $t('Slovakia'),
227 'sl' => $t('Sierra Leone'),
228 'sm' => $t('San Marino'),
229 'sn' => $t('Senegal'),
230 'so' => $t('Somalia'),
231 'sr' => $t('Suriname'),
232 'st' => $t('Sao Tome and Principe'),
233 'sv' => $t('El Salvador'),
234 'sy' => $t('Syria'),
235 'sz' => $t('Swaziland'),
236 'tc' => $t('Turks and Caicos Islands'),
237 'td' => $t('Chad'),
238 'tf' => $t('French Southern Territories'),
239 'tg' => $t('Togo'),
240 'th' => $t('Thailand'),
241 'tj' => $t('Tajikistan'),
242 'tk' => $t('Tokelau'),
243 'tl' => $t('East Timor'),
244 'tm' => $t('Turkmenistan'),
245 'tn' => $t('Tunisia'),
246 'to' => $t('Tonga'),
247 'tr' => $t('Turkey'),
248 'tt' => $t('Trinidad and Tobago'),
249 'tv' => $t('Tuvalu'),
250 'tw' => $t('Taiwan'),
251 'tz' => $t('Tanzania'),
252 'ua' => $t('Ukraine'),
253 'ug' => $t('Uganda'),
254 'uk' => $t('United Kingdom'),
255 'um' => $t('United States Minor Outlying Islands'),
256 'us' => $t('United States'),
257 'uy' => $t('Uruguay'),
258 'uz' => $t('Uzbekistan'),
259 'va' => $t('Vatican'),
260 'vc' => $t('Saint Vincent and the Grenadines'),
261 've' => $t('Venezuela'),
262 'vg' => $t('British Virgin Islands'),
263 'vi' => $t('U.S. Virgin Islands'),
264 'vn' => $t('Vietnam'),
265 'vu' => $t('Vanuatu'),
266 'wf' => $t('Wallis and Futuna'),
267 'ws' => $t('Samoa'),
268 'ye' => $t('Yemen'),
269 'yt' => $t('Mayotte'),
270 'za' => $t('South Africa'),
271 'zm' => $t('Zambia'),
272 'zw' => $t('Zimbabwe'),
273 );
274
275 // Sort the list.
276 natcasesort($countries);
277
278 return $countries;
279 }
280
281 /**
282 * Date country version of get_t().
283 *
284 * t() isn't always available when this function is called even though
285 * function_exists() may return true.
286 * @return
287 * Return the name of the localisation function.
288 */
289 function _site_country_get_t() {
290 $t = (function_exists('t') && isset($language)) ? 't' : '_site_country_t';
291 return $t;
292 }
293
294 /**
295 * Dummy helper function; does nothing except return the string supplied.
296 *
297 * @param $string
298 * String to return.
299 * @return
300 * The supplied string, with no changes made.
301 */
302 function _site_country_t($string) {
303 return $string;
304 }

  ViewVC Help
Powered by ViewVC 1.1.2