Provides a list of countries and languages based on web standards.
<?php
/**
* @file
* Provides a list of countries and languages based on web standards.
*/
/**
* Get an array of all country code => country name pairs.
*
* Get an array of all country code => country name pairs as laid out
* in ISO 3166-1 alpha-2. Originally from the location project
* (http://drupal.org/project/location).
*
* @return
* An array of country code => country name pairs.
*/
function standard_country_list() {
static $countries;
if (isset($countries)) {
return $countries;
}
$t = get_t();
$countries = array(
'AD' => $t('Andorra'),
'AE' => $t('United Arab Emirates'),
'AF' => $t('Afghanistan'),
'AG' => $t('Antigua and Barbuda'),
'AI' => $t('Anguilla'),
'AL' => $t('Albania'),
'AM' => $t('Armenia'),
'AN' => $t('Netherlands Antilles'),
'AO' => $t('Angola'),
'AQ' => $t('Antarctica'),
'AR' => $t('Argentina'),
'AS' => $t('American Samoa'),
'AT' => $t('Austria'),
'AU' => $t('Australia'),
'AW' => $t('Aruba'),
'AX' => $t('Aland Islands'),
'AZ' => $t('Azerbaijan'),
'BA' => $t('Bosnia and Herzegovina'),
'BB' => $t('Barbados'),
'BD' => $t('Bangladesh'),
'BE' => $t('Belgium'),
'BF' => $t('Burkina Faso'),
'BG' => $t('Bulgaria'),
'BH' => $t('Bahrain'),
'BI' => $t('Burundi'),
'BJ' => $t('Benin'),
'BL' => $t('Saint Barthélemy'),
'BM' => $t('Bermuda'),
'BN' => $t('Brunei'),
'BO' => $t('Bolivia'),
'BR' => $t('Brazil'),
'BS' => $t('Bahamas'),
'BT' => $t('Bhutan'),
'BV' => $t('Bouvet Island'),
'BW' => $t('Botswana'),
'BY' => $t('Belarus'),
'BZ' => $t('Belize'),
'CA' => $t('Canada'),
'CC' => $t('Cocos (Keeling) Islands'),
'CD' => $t('Congo (Kinshasa)'),
'CF' => $t('Central African Republic'),
'CG' => $t('Congo (Brazzaville)'),
'CH' => $t('Switzerland'),
'CI' => $t('Ivory Coast'),
'CK' => $t('Cook Islands'),
'CL' => $t('Chile'),
'CM' => $t('Cameroon'),
'CN' => $t('China'),
'CO' => $t('Colombia'),
'CR' => $t('Costa Rica'),
'CU' => $t('Cuba'),
'CW' => $t('Curaçao'),
'CV' => $t('Cape Verde'),
'CX' => $t('Christmas Island'),
'CY' => $t('Cyprus'),
'CZ' => $t('Czech Republic'),
'DE' => $t('Germany'),
'DJ' => $t('Djibouti'),
'DK' => $t('Denmark'),
'DM' => $t('Dominica'),
'DO' => $t('Dominican Republic'),
'DZ' => $t('Algeria'),
'EC' => $t('Ecuador'),
'EE' => $t('Estonia'),
'EG' => $t('Egypt'),
'EH' => $t('Western Sahara'),
'ER' => $t('Eritrea'),
'ES' => $t('Spain'),
'ET' => $t('Ethiopia'),
'FI' => $t('Finland'),
'FJ' => $t('Fiji'),
'FK' => $t('Falkland Islands'),
'FM' => $t('Micronesia'),
'FO' => $t('Faroe Islands'),
'FR' => $t('France'),
'GA' => $t('Gabon'),
'GB' => $t('United Kingdom'),
'GD' => $t('Grenada'),
'GE' => $t('Georgia'),
'GF' => $t('French Guiana'),
'GG' => $t('Guernsey'),
'GH' => $t('Ghana'),
'GI' => $t('Gibraltar'),
'GL' => $t('Greenland'),
'GM' => $t('Gambia'),
'GN' => $t('Guinea'),
'GP' => $t('Guadeloupe'),
'GQ' => $t('Equatorial Guinea'),
'GR' => $t('Greece'),
'GS' => $t('South Georgia and the South Sandwich Islands'),
'GT' => $t('Guatemala'),
'GU' => $t('Guam'),
'GW' => $t('Guinea-Bissau'),
'GY' => $t('Guyana'),
'HK' => $t('Hong Kong S.A.R., China'),
'HM' => $t('Heard Island and McDonald Islands'),
'HN' => $t('Honduras'),
'HR' => $t('Croatia'),
'HT' => $t('Haiti'),
'HU' => $t('Hungary'),
'ID' => $t('Indonesia'),
'IE' => $t('Ireland'),
'IL' => $t('Israel'),
'IM' => $t('Isle of Man'),
'IN' => $t('India'),
'IO' => $t('British Indian Ocean Territory'),
'IQ' => $t('Iraq'),
'IR' => $t('Iran'),
'IS' => $t('Iceland'),
'IT' => $t('Italy'),
'JE' => $t('Jersey'),
'JM' => $t('Jamaica'),
'JO' => $t('Jordan'),
'JP' => $t('Japan'),
'KE' => $t('Kenya'),
'KG' => $t('Kyrgyzstan'),
'KH' => $t('Cambodia'),
'KI' => $t('Kiribati'),
'KM' => $t('Comoros'),
'KN' => $t('Saint Kitts and Nevis'),
'KP' => $t('North Korea'),
'KR' => $t('South Korea'),
'KW' => $t('Kuwait'),
'KY' => $t('Cayman Islands'),
'KZ' => $t('Kazakhstan'),
'LA' => $t('Laos'),
'LB' => $t('Lebanon'),
'LC' => $t('Saint Lucia'),
'LI' => $t('Liechtenstein'),
'LK' => $t('Sri Lanka'),
'LR' => $t('Liberia'),
'LS' => $t('Lesotho'),
'LT' => $t('Lithuania'),
'LU' => $t('Luxembourg'),
'LV' => $t('Latvia'),
'LY' => $t('Libya'),
'MA' => $t('Morocco'),
'MC' => $t('Monaco'),
'MD' => $t('Moldova'),
'ME' => $t('Montenegro'),
'MF' => $t('Saint Martin (French part)'),
'MG' => $t('Madagascar'),
'MH' => $t('Marshall Islands'),
'MK' => $t('Macedonia'),
'ML' => $t('Mali'),
'MM' => $t('Myanmar'),
'MN' => $t('Mongolia'),
'MO' => $t('Macao S.A.R., China'),
'MP' => $t('Northern Mariana Islands'),
'MQ' => $t('Martinique'),
'MR' => $t('Mauritania'),
'MS' => $t('Montserrat'),
'MT' => $t('Malta'),
'MU' => $t('Mauritius'),
'MV' => $t('Maldives'),
'MW' => $t('Malawi'),
'MX' => $t('Mexico'),
'MY' => $t('Malaysia'),
'MZ' => $t('Mozambique'),
'NA' => $t('Namibia'),
'NC' => $t('New Caledonia'),
'NE' => $t('Niger'),
'NF' => $t('Norfolk Island'),
'NG' => $t('Nigeria'),
'NI' => $t('Nicaragua'),
'NL' => $t('Netherlands'),
'NO' => $t('Norway'),
'NP' => $t('Nepal'),
'NR' => $t('Nauru'),
'NU' => $t('Niue'),
'NZ' => $t('New Zealand'),
'OM' => $t('Oman'),
'PA' => $t('Panama'),
'PE' => $t('Peru'),
'PF' => $t('French Polynesia'),
'PG' => $t('Papua New Guinea'),
'PH' => $t('Philippines'),
'PK' => $t('Pakistan'),
'PL' => $t('Poland'),
'PM' => $t('Saint Pierre and Miquelon'),
'PN' => $t('Pitcairn'),
'PR' => $t('Puerto Rico'),
'PS' => $t('Palestinian Territory'),
'PT' => $t('Portugal'),
'PW' => $t('Palau'),
'PY' => $t('Paraguay'),
'QA' => $t('Qatar'),
'RE' => $t('Reunion'),
'RO' => $t('Romania'),
'RS' => $t('Serbia'),
'RU' => $t('Russia'),
'RW' => $t('Rwanda'),
'SA' => $t('Saudi Arabia'),
'SB' => $t('Solomon Islands'),
'SC' => $t('Seychelles'),
'SD' => $t('Sudan'),
'SE' => $t('Sweden'),
'SG' => $t('Singapore'),
'SH' => $t('Saint Helena'),
'SI' => $t('Slovenia'),
'SJ' => $t('Svalbard and Jan Mayen'),
'SK' => $t('Slovakia'),
'SL' => $t('Sierra Leone'),
'SM' => $t('San Marino'),
'SN' => $t('Senegal'),
'SO' => $t('Somalia'),
'SR' => $t('Suriname'),
'ST' => $t('Sao Tome and Principe'),
'SV' => $t('El Salvador'),
'SY' => $t('Syria'),
'SZ' => $t('Swaziland'),
'TC' => $t('Turks and Caicos Islands'),
'TD' => $t('Chad'),
'TF' => $t('French Southern Territories'),
'TG' => $t('Togo'),
'TH' => $t('Thailand'),
'TJ' => $t('Tajikistan'),
'TK' => $t('Tokelau'),
'TL' => $t('Timor-Leste'),
'TM' => $t('Turkmenistan'),
'TN' => $t('Tunisia'),
'TO' => $t('Tonga'),
'TR' => $t('Turkey'),
'TT' => $t('Trinidad and Tobago'),
'TV' => $t('Tuvalu'),
'TW' => $t('Taiwan'),
'TZ' => $t('Tanzania'),
'UA' => $t('Ukraine'),
'UG' => $t('Uganda'),
'UM' => $t('United States Minor Outlying Islands'),
'US' => $t('United States'),
'UY' => $t('Uruguay'),
'UZ' => $t('Uzbekistan'),
'VA' => $t('Vatican'),
'VC' => $t('Saint Vincent and the Grenadines'),
'VE' => $t('Venezuela'),
'VG' => $t('British Virgin Islands'),
'VI' => $t('U.S. Virgin Islands'),
'VN' => $t('Vietnam'),
'VU' => $t('Vanuatu'),
'WF' => $t('Wallis and Futuna'),
'WS' => $t('Samoa'),
'YE' => $t('Yemen'),
'YT' => $t('Mayotte'),
'ZA' => $t('South Africa'),
'ZM' => $t('Zambia'),
'ZW' => $t('Zimbabwe'),
);
// Sort the list.
natcasesort($countries);
return $countries;
}
/**
* Some common languages with their English and native names.
*
* Language codes are defined by the W3C language tags document for
* interoperability. Language codes typically have a language and optionally,
* a script or regional variant name. See
* http://www.w3.org/International/articles/language-tags/ for more information.
*
* This list is based on languages available from localize.drupal.org. See
* http://localize.drupal.org/issues for information on how to add languages
* there.
*
* The "Left-to-right marker" comments and the enclosed UTF-8 markers are to
* make otherwise strange looking PHP syntax natural (to not be displayed in
* right to left). See http://drupal.org/node/128866#comment-528929.
*
* @return
* An array of language code to language name information.
* Language name information itself is an array of English and native names.
*/
function standard_language_list() {
return array(
'af' => array(
'Afrikaans',
'Afrikaans',
),
'am' => array(
'Amharic',
'አማርኛ',
),
'ar' => array(
'Arabic',
/* Left-to-right marker "" */
'العربية',
LANGUAGE_RTL,
),
'ast' => array(
'Asturian',
'Asturianu',
),
'az' => array(
'Azerbaijani',
'Azərbaycanca',
),
'be' => array(
'Belarusian',
'Беларуская',
),
'bg' => array(
'Bulgarian',
'Български',
),
'bn' => array(
'Bengali',
'বাংলা',
),
'bo' => array(
'Tibetan',
'བོད་སྐད་',
),
'bs' => array(
'Bosnian',
'Bosanski',
),
'ca' => array(
'Catalan',
'Català',
),
'cs' => array(
'Czech',
'Čeština',
),
'cy' => array(
'Welsh',
'Cymraeg',
),
'da' => array(
'Danish',
'Dansk',
),
'de' => array(
'German',
'Deutsch',
),
'dz' => array(
'Dzongkha',
'རྫོང་ཁ',
),
'el' => array(
'Greek',
'Ελληνικά',
),
'en' => array(
'English',
'English',
),
'en-gb' => array(
'English, British',
'English, British',
),
'eo' => array(
'Esperanto',
'Esperanto',
),
'es' => array(
'Spanish',
'Español',
),
'et' => array(
'Estonian',
'Eesti',
),
'eu' => array(
'Basque',
'Euskera',
),
'fa' => array(
'Persian, Farsi',
/* Left-to-right marker "" */
'فارسی',
LANGUAGE_RTL,
),
'fi' => array(
'Finnish',
'Suomi',
),
'fil' => array(
'Filipino',
'Filipino',
),
'fo' => array(
'Faeroese',
'Føroyskt',
),
'fr' => array(
'French',
'Français',
),
'ga' => array(
'Irish',
'Gaeilge',
),
'gd' => array(
'Scots Gaelic',
'Gàidhlig',
),
'gl' => array(
'Galician',
'Galego',
),
'gsw-berne' => array(
'Swiss German',
'Schwyzerdütsch',
),
'gu' => array(
'Gujarati',
'ગુજરાતી',
),
'he' => array(
'Hebrew',
/* Left-to-right marker "" */
'עברית',
LANGUAGE_RTL,
),
'hi' => array(
'Hindi',
'हिन्दी',
),
'hr' => array(
'Croatian',
'Hrvatski',
),
'ht' => array(
'Haitian Creole',
'Kreyòl ayisyen',
),
'hu' => array(
'Hungarian',
'Magyar',
),
'hy' => array(
'Armenian',
'Հայերեն',
),
'id' => array(
'Indonesian',
'Bahasa Indonesia',
),
'is' => array(
'Icelandic',
'Íslenska',
),
'it' => array(
'Italian',
'Italiano',
),
'ja' => array(
'Japanese',
'日本語',
),
'jv' => array(
'Javanese',
'Basa Java',
),
'ka' => array(
'Georgian',
'ქართული ენა',
),
'kk' => array(
'Kazakh',
'Қазақ',
),
'kn' => array(
'Kannada',
'ಕನ್ನಡ',
),
'ko' => array(
'Korean',
'한국어',
),
'ku' => array(
'Kurdish',
'Kurdî',
),
'ky' => array(
'Kyrgyz',
'Кыргызча',
),
'lo' => array(
'Lao',
'ພາສາລາວ',
),
'lt' => array(
'Lithuanian',
'Lietuvių',
),
'lv' => array(
'Latvian',
'Latviešu',
),
'mfe' => array(
'Mauritian Creole',
'Kreol Morisyen',
),
'mg' => array(
'Malagasy',
'Malagasy',
),
'mi' => array(
'Maori',
'Māori',
),
'mk' => array(
'Macedonian',
'Македонски',
),
'ml' => array(
'Malayalam',
'മലയാളം',
),
'mn' => array(
'Mongolian',
'монгол',
),
'mr' => array(
'Marathi',
'मराठी',
),
'mt' => array(
'Maltese',
'Malti',
),
'my' => array(
'Burmese',
'ဗမာစကား',
),
'ne' => array(
'Nepali',
'नेपाली',
),
'nl' => array(
'Dutch',
'Nederlands',
),
'nb' => array(
'Norwegian Bokmål',
'Bokmål',
),
'nn' => array(
'Norwegian Nynorsk',
'Nynorsk',
),
'oc' => array(
'Occitan',
'Occitan',
),
'or' => array(
'Oriya',
'ଓଡ଼ିଆ',
),
'pa' => array(
'Punjabi',
'ਪੰਜਾਬੀ',
),
'pl' => array(
'Polish',
'Polski',
),
'pt' => array(
'Portuguese, International',
'Português, Internacional',
),
'pt-pt' => array(
'Portuguese, Portugal',
'Português, Portugal',
),
'pt-br' => array(
'Portuguese, Brazil',
'Português, Brasil',
),
'ro' => array(
'Romanian',
'Română',
),
'ru' => array(
'Russian',
'Русский',
),
'sco' => array(
'Scots',
'Scots',
),
'se' => array(
'Northern Sami',
'Sámi',
),
'si' => array(
'Sinhala',
'සිංහල',
),
'sk' => array(
'Slovak',
'Slovenčina',
),
'sl' => array(
'Slovenian',
'Slovenščina',
),
'sq' => array(
'Albanian',
'Shqip',
),
'sr' => array(
'Serbian',
'Српски',
),
'sv' => array(
'Swedish',
'Svenska',
),
'sw' => array(
'Swahili',
'Kiswahili',
),
'ta' => array(
'Tamil',
'தமிழ்',
),
'ta-lk' => array(
'Tamil, Sri Lanka',
'தமிழ், இலங்கை',
),
'te' => array(
'Telugu',
'తెలుగు',
),
'th' => array(
'Thai',
'ภาษาไทย',
),
'ti' => array(
'Tigrinya',
'ትግርኛ',
),
'tr' => array(
'Turkish',
'Türkçe',
),
'tyv' => array(
'Tuvan',
'Тыва дыл',
),
'ug' => array(
'Uyghur',
'Уйғур',
),
'uk' => array(
'Ukrainian',
'Українська',
),
'ur' => array(
'Urdu',
/* Left-to-right marker "" */
'اردو',
LANGUAGE_RTL,
),
'vi' => array(
'Vietnamese',
'Tiếng Việt',
),
'xx-lolspeak' => array(
'Lolspeak',
'Lolspeak',
),
'zh-hans' => array(
'Chinese, Simplified',
'简体中文',
),
'zh-hant' => array(
'Chinese, Traditional',
'繁體中文',
),
);
}
Name | Description |
---|---|
standard_country_list | Get an array of all country code => country name pairs. |
standard_language_list | Some common languages with their English and native names. |