diff --git a/src/Pluf/L10n.php b/src/Pluf/L10n.php index e4a2e57..a984347 100644 --- a/src/Pluf/L10n.php +++ b/src/Pluf/L10n.php @@ -380,6 +380,264 @@ class Pluf_L10n } /** + * Get the country codes. + * + * @param Indexed by code (false) + * @return array English name indexed country code or reverse + */ + public static function getCountryCodes($idx_by_code=false) + { + $ctr = array( + 'Andorra' => 'AD', + 'United Arab Emirates' => 'AE', + 'Afghanistan' => 'AF', + 'Antigua & Barbuda' => 'AG', + 'Anguilla' => 'AI', + 'Albania' => 'AL', + 'Armenia' => 'AM', + 'Netherlands Antilles' => 'AN', + 'Angola' => 'AO', + 'Antarctica' => 'AQ', + 'Argentina' => 'AR', + 'American Samoa' => 'AS', + 'Austria' => 'AT', + 'Australia' => 'AU', + 'Aruba' => 'AW', + 'Azerbaijan' => 'AZ', + 'Bosnia and Herzegovina' => 'BA', + 'Barbados' => 'BB', + 'Bangladesh' => 'BD', + 'Belgium' => 'BE', + 'Burkina Faso' => 'BF', + 'Bulgaria' => 'BG', + 'Bahrain' => 'BH', + 'Burundi' => 'BI', + 'Benin' => 'BJ', + 'Bermuda' => 'BM', + 'Brunei Darussalam' => 'BN', + 'Bolivia' => 'BO', + 'Brazil' => 'BR', + 'Bahama' => 'BS', + 'Bhutan' => 'BT', + 'Bouvet Island' => 'BV', + 'Botswana' => 'BW', + 'Belarus' => 'BY', + 'Belize' => 'BZ', + 'Canada' => 'CA', + 'Cocos (Keeling) Islands' => 'CC', + 'Central African Republic' => 'CF', + 'Congo' => 'CG', + 'Switzerland' => 'CH', + 'Côte D\'ivoire (Ivory Coast)' => 'CI', + 'Cook Iislands' => 'CK', + 'Chile' => 'CL', + 'Cameroon' => 'CM', + 'China' => 'CN', + 'Colombia' => 'CO', + 'Costa Rica' => 'CR', + 'Cuba' => 'CU', + 'Cape Verde' => 'CV', + 'Christmas Island' => 'CX', + 'Cyprus' => 'CY', + 'Czech Republic' => 'CZ', + 'Germany' => 'DE', + 'Djibouti' => 'DJ', + 'Denmark' => 'DK', + 'Dominica' => 'DM', + 'Dominican Republic' => 'DO', + 'Algeria' => 'DZ', + 'Ecuador' => 'EC', + 'Estonia' => 'EE', + 'Egypt' => 'EG', + 'Western Sahara' => 'EH', + 'Eritrea' => 'ER', + 'Spain' => 'ES', + 'Ethiopia' => 'ET', + 'Finland' => 'FI', + 'Fiji' => 'FJ', + 'Falkland Islands (Malvinas)' => 'FK', + 'Micronesia' => 'FM', + 'Faroe Islands' => 'FO', + 'France' => 'FR', + 'France, Metropolitan' => 'FX', + 'Gabon' => 'GA', + 'United Kingdom (Great Britain)' => 'GB', + 'Grenada' => 'GD', + 'Georgia' => 'GE', + 'French Guiana' => 'GF', + 'Ghana' => 'GH', + 'Gibraltar' => 'GI', + 'Greenland' => 'GL', + 'Gambia' => 'GM', + 'Guinea' => 'GN', + 'Guadeloupe' => 'GP', + 'Equatorial Guinea' => 'GQ', + 'Greece' => 'GR', + 'South Georgia and the South Sandwich Islands' => 'GS', + 'Guatemala' => 'GT', + 'Guam' => 'GU', + 'Guinea-Bissau' => 'GW', + 'Guyana' => 'GY', + 'Hong Kong' => 'HK', + 'Heard & McDonald Islands' => 'HM', + 'Honduras' => 'HN', + 'Croatia' => 'HR', + 'Haiti' => 'HT', + 'Hungary' => 'HU', + 'Indonesia' => 'ID', + 'Ireland' => 'IE', + 'Israel' => 'IL', + 'India' => 'IN', + 'British Indian Ocean Territory' => 'IO', + 'Iraq' => 'IQ', + 'Iran, Islamic Republic of' => 'IR', + 'Iceland' => 'IS', + 'Italy' => 'IT', + 'Jamaica' => 'JM', + 'Jordan' => 'JO', + 'Japan' => 'JP', + 'Kenya' => 'KE', + 'Kyrgyzstan' => 'KG', + 'Cambodia' => 'KH', + 'Kiribati' => 'KI', + 'Comoros' => 'KM', + 'St. Kitts and Nevis' => 'KN', + 'Korea, Democratic People\'s Republic of' => 'KP', + 'Korea, Republic of' => 'KR', + 'Kuwait' => 'KW', + 'Cayman Islands' => 'KY', + 'Kazakhstan' => 'KZ', + 'Lao People\'s Democratic Republic' => 'LA', + 'Lebanon' => 'LB', + 'Saint Lucia' => 'LC', + 'Liechtenstein' => 'LI', + 'Sri Lanka' => 'LK', + 'Liberia' => 'LR', + 'Lesotho' => 'LS', + 'Lithuania' => 'LT', + 'Luxembourg' => 'LU', + 'Latvia' => 'LV', + 'Libyan Arab Jamahiriya' => 'LY', + 'Morocco' => 'MA', + 'Monaco' => 'MC', + 'Moldova, Republic of' => 'MD', + 'Montenegro' => 'ME', + 'Madagascar' => 'MG', + 'Marshall Islands' => 'MH', + 'Macedonia, Republic of' => 'MK', + 'Mali' => 'ML', + 'Mongolia' => 'MN', + 'Myanmar' => 'MM', + 'Macau' => 'MO', + 'Northern Mariana Islands' => 'MP', + 'Martinique' => 'MQ', + 'Mauritania' => 'MR', + 'Monserrat' => 'MS', + 'Malta' => 'MT', + 'Mauritius' => 'MU', + 'Maldives' => 'MV', + 'Malawi' => 'MW', + 'Mexico' => 'MX', + 'Malaysia' => 'MY', + 'Mozambique' => 'MZ', + 'Namibia' => 'NA', + 'New Caledonia' => 'NC', + 'Niger' => 'NE', + 'Norfolk Island' => 'NF', + 'Nigeria' => 'NG', + 'Nicaragua' => 'NI', + 'Netherlands' => 'NL', + 'Norway' => 'NO', + 'Nepal' => 'NP', + 'Nauru' => 'NR', + 'Niue' => 'NU', + 'New Zealand' => 'NZ', + 'Oman' => 'OM', + 'Panama' => 'PA', + 'Peru' => 'PE', + 'French Polynesia' => 'PF', + 'Papua New Guinea' => 'PG', + 'Philippines' => 'PH', + 'Pakistan' => 'PK', + 'Poland' => 'PL', + 'St. Pierre & Miquelon' => 'PM', + 'Pitcairn' => 'PN', + 'Puerto Rico' => 'PR', + 'Portugal' => 'PT', + 'Palau' => 'PW', + 'Paraguay' => 'PY', + 'Qatar' => 'QA', + 'Réunion' => 'RE', + 'Romania' => 'RO', + 'Serbia' => 'RS', + 'Russian Federation' => 'RU', + 'Rwanda' => 'RW', + 'Saudi Arabia' => 'SA', + 'Solomon Islands' => 'SB', + 'Seychelles' => 'SC', + 'Sudan' => 'SD', + 'Sweden' => 'SE', + 'Singapore' => 'SG', + 'St. Helena' => 'SH', + 'Slovenia' => 'SI', + 'Svalbard & Jan Mayen Islands' => 'SJ', + 'Slovakia' => 'SK', + 'Sierra Leone' => 'SL', + 'San Marino' => 'SM', + 'Senegal' => 'SN', + 'Somalia' => 'SO', + 'Suriname' => 'SR', + 'Sao Tome & Principe' => 'ST', + 'El Salvador' => 'SV', + 'Syrian Arab Republic' => 'SY', + 'Swaziland' => 'SZ', + 'Turks & Caicos Islands' => 'TC', + 'Chad' => 'TD', + 'French Southern Territories' => 'TF', + 'Togo' => 'TG', + 'Thailand' => 'TH', + 'Tajikistan' => 'TJ', + 'Tokelau' => 'TK', + 'Turkmenistan' => 'TM', + 'Tunisia' => 'TN', + 'Tonga' => 'TO', + 'East Timor' => 'TP', + 'Turkey' => 'TR', + 'Trinidad & Tobago' => 'TT', + 'Tuvalu' => 'TV', + 'Taiwan' => 'TW', + 'Tanzania, United Republic of' => 'TZ', + 'Ukraine' => 'UA', + 'Uganda' => 'UG', + 'United States Minor Outlying Islands' => 'UM', + 'United States of America' => 'US', + 'Uruguay' => 'UY', + 'Uzbekistan' => 'UZ', + 'Vatican City State (Holy See)' => 'VA', + 'St. Vincent & the Grenadines' => 'VC', + 'Venezuela' => 'VE', + 'British Virgin Islands' => 'VG', + 'United States Virgin Islands' => 'VI', + 'Viet Nam' => 'VN', + 'Vanuatu' => 'VU', + 'Wallis & Futuna Islands' => 'WF', + 'Samoa' => 'WS', + 'Yemen' => 'YE', + 'Mayotte' => 'YT', + 'South Africa' => 'ZA', + 'Zambia' => 'ZM', + 'Zaire' => 'ZR', + 'Zimbabwe' => 'ZW', + 'Unknown or unspecified country' => 'ZZ' + ); + if ($idx_by_code) { + $ctr = array_flip($ctr); + } + ksort($ctr); + return $ctr; + } + + /** * Returns iso codes. * * @param bool Is the language the key in the array (false)