diff --git a/src/definitions/location.ts b/src/definitions/location.ts index 95362eddebc..c0f6dfa94a8 100644 --- a/src/definitions/location.ts +++ b/src/definitions/location.ts @@ -39,6 +39,11 @@ export type LocationDefinitions = LocaleEntry<{ */ country: string[]; + /** + * The [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country codes. + */ + country_code: Array<{ alpha2: string; alpha3: string }>; + /** * The names of this country's states. */ @@ -111,16 +116,6 @@ export type LocationDefinitions = LocaleEntry<{ */ secondary_address: string[]; - /** - * The ISO-3166-1 ALPHA-2 country codes related to this locale. - */ - country_code: string[]; - - /** - * The ISO-3166-1 ALPHA-3 country codes related to this locale. - */ - country_code_alpha_3: string[]; - /** * A list of timezones names. */ diff --git a/src/locales/de_CH/location/country_code.ts b/src/locales/de_CH/location/country_code.ts index 4f084d961b0..bd629a35036 100644 --- a/src/locales/de_CH/location/country_code.ts +++ b/src/locales/de_CH/location/country_code.ts @@ -1 +1,10 @@ -export default ['CH', 'DE', 'AT', 'US', 'LI', 'HK', 'VN']; +// [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) +export default [ + { alpha2: 'CH', alpha3: 'CHE' }, + { alpha2: 'DE', alpha3: 'DEU' }, + { alpha2: 'AT', alpha3: 'AUT' }, + { alpha2: 'US', alpha3: 'USA' }, + { alpha2: 'LI', alpha3: 'LIE' }, + { alpha2: 'HK', alpha3: 'HKG' }, + { alpha2: 'VN', alpha3: 'VNM' }, +]; diff --git a/src/locales/en/location/country_code.ts b/src/locales/en/location/country_code.ts index 325a7ff81cc..6fe5278c482 100644 --- a/src/locales/en/location/country_code.ts +++ b/src/locales/en/location/country_code.ts @@ -1,251 +1,252 @@ +// [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) export default [ - 'AD', - 'AE', - 'AF', - 'AG', - 'AI', - 'AL', - 'AM', - 'AO', - 'AQ', - 'AR', - 'AS', - 'AT', - 'AU', - 'AW', - 'AX', - 'AZ', - 'BA', - 'BB', - 'BD', - 'BE', - 'BF', - 'BG', - 'BH', - 'BI', - 'BJ', - 'BL', - 'BM', - 'BN', - 'BO', - 'BQ', - 'BR', - 'BS', - 'BT', - 'BV', - 'BW', - 'BY', - 'BZ', - 'CA', - 'CC', - 'CD', - 'CF', - 'CG', - 'CH', - 'CI', - 'CK', - 'CL', - 'CM', - 'CN', - 'CO', - 'CR', - 'CU', - 'CV', - 'CW', - 'CX', - 'CY', - 'CZ', - 'DE', - 'DJ', - 'DK', - 'DM', - 'DO', - 'DZ', - 'EC', - 'EE', - 'EG', - 'EH', - 'ER', - 'ES', - 'ET', - 'FI', - 'FJ', - 'FK', - 'FM', - 'FO', - 'FR', - 'GA', - 'GB', - 'GD', - 'GE', - 'GF', - 'GG', - 'GH', - 'GI', - 'GL', - 'GM', - 'GN', - 'GP', - 'GQ', - 'GR', - 'GS', - 'GT', - 'GU', - 'GW', - 'GY', - 'HK', - 'HM', - 'HN', - 'HR', - 'HT', - 'HU', - 'ID', - 'IE', - 'IL', - 'IM', - 'IN', - 'IO', - 'IQ', - 'IR', - 'IS', - 'IT', - 'JE', - 'JM', - 'JO', - 'JP', - 'KE', - 'KG', - 'KH', - 'KI', - 'KM', - 'KN', - 'KP', - 'KR', - 'KW', - 'KY', - 'KZ', - 'LA', - 'LB', - 'LC', - 'LI', - 'LK', - 'LR', - 'LS', - 'LT', - 'LU', - 'LV', - 'LY', - 'MA', - 'MC', - 'MD', - 'ME', - 'MF', - 'MG', - 'MH', - 'MK', - 'ML', - 'MM', - 'MN', - 'MO', - 'MP', - 'MQ', - 'MR', - 'MS', - 'MT', - 'MU', - 'MV', - 'MW', - 'MX', - 'MY', - 'MZ', - 'NA', - 'NC', - 'NE', - 'NF', - 'NG', - 'NI', - 'NL', - 'NO', - 'NP', - 'NR', - 'NU', - 'NZ', - 'OM', - 'PA', - 'PE', - 'PF', - 'PG', - 'PH', - 'PK', - 'PL', - 'PM', - 'PN', - 'PR', - 'PS', - 'PT', - 'PW', - 'PY', - 'QA', - 'RE', - 'RO', - 'RS', - 'RU', - 'RW', - 'SA', - 'SB', - 'SC', - 'SD', - 'SE', - 'SG', - 'SH', - 'SI', - 'SJ', - 'SK', - 'SL', - 'SM', - 'SN', - 'SO', - 'SR', - 'SS', - 'ST', - 'SV', - 'SX', - 'SY', - 'SZ', - 'TC', - 'TD', - 'TF', - 'TG', - 'TH', - 'TJ', - 'TK', - 'TL', - 'TM', - 'TN', - 'TO', - 'TR', - 'TT', - 'TV', - 'TW', - 'TZ', - 'UA', - 'UG', - 'UM', - 'US', - 'UY', - 'UZ', - 'VA', - 'VC', - 'VE', - 'VG', - 'VI', - 'VN', - 'VU', - 'WF', - 'WS', - 'YE', - 'YT', - 'ZA', - 'ZM', - 'ZW', + { alpha2: 'AD', alpha3: 'AND' }, + { alpha2: 'AE', alpha3: 'ARE' }, + { alpha2: 'AF', alpha3: 'AFG' }, + { alpha2: 'AG', alpha3: 'ATG' }, + { alpha2: 'AI', alpha3: 'AIA' }, + { alpha2: 'AL', alpha3: 'ALB' }, + { alpha2: 'AM', alpha3: 'ARM' }, + { alpha2: 'AO', alpha3: 'AGO' }, + { alpha2: 'AQ', alpha3: 'ATA' }, + { alpha2: 'AR', alpha3: 'ARG' }, + { alpha2: 'AS', alpha3: 'ASM' }, + { alpha2: 'AT', alpha3: 'AUT' }, + { alpha2: 'AU', alpha3: 'AUS' }, + { alpha2: 'AW', alpha3: 'ABW' }, + { alpha2: 'AX', alpha3: 'ALA' }, + { alpha2: 'AZ', alpha3: 'AZE' }, + { alpha2: 'BA', alpha3: 'BIH' }, + { alpha2: 'BB', alpha3: 'BRB' }, + { alpha2: 'BD', alpha3: 'BGD' }, + { alpha2: 'BE', alpha3: 'BEL' }, + { alpha2: 'BF', alpha3: 'BFA' }, + { alpha2: 'BG', alpha3: 'BGR' }, + { alpha2: 'BH', alpha3: 'BHR' }, + { alpha2: 'BI', alpha3: 'BDI' }, + { alpha2: 'BJ', alpha3: 'BEN' }, + { alpha2: 'BL', alpha3: 'BLM' }, + { alpha2: 'BM', alpha3: 'BMU' }, + { alpha2: 'BN', alpha3: 'BRN' }, + { alpha2: 'BO', alpha3: 'BOL' }, + { alpha2: 'BQ', alpha3: 'BES' }, + { alpha2: 'BR', alpha3: 'BRA' }, + { alpha2: 'BS', alpha3: 'BHS' }, + { alpha2: 'BT', alpha3: 'BTN' }, + { alpha2: 'BV', alpha3: 'BVT' }, + { alpha2: 'BW', alpha3: 'BWA' }, + { alpha2: 'BY', alpha3: 'BLR' }, + { alpha2: 'BZ', alpha3: 'BLZ' }, + { alpha2: 'CA', alpha3: 'CAN' }, + { alpha2: 'CC', alpha3: 'CCK' }, + { alpha2: 'CD', alpha3: 'COD' }, + { alpha2: 'CF', alpha3: 'CAF' }, + { alpha2: 'CG', alpha3: 'COG' }, + { alpha2: 'CH', alpha3: 'CHE' }, + { alpha2: 'CI', alpha3: 'CIV' }, + { alpha2: 'CK', alpha3: 'COK' }, + { alpha2: 'CL', alpha3: 'CHL' }, + { alpha2: 'CM', alpha3: 'CMR' }, + { alpha2: 'CN', alpha3: 'CHN' }, + { alpha2: 'CO', alpha3: 'COL' }, + { alpha2: 'CR', alpha3: 'CRI' }, + { alpha2: 'CU', alpha3: 'CUB' }, + { alpha2: 'CV', alpha3: 'CPV' }, + { alpha2: 'CW', alpha3: 'CUW' }, + { alpha2: 'CX', alpha3: 'CXR' }, + { alpha2: 'CY', alpha3: 'CYP' }, + { alpha2: 'CZ', alpha3: 'CZE' }, + { alpha2: 'DE', alpha3: 'DEU' }, + { alpha2: 'DJ', alpha3: 'DJI' }, + { alpha2: 'DK', alpha3: 'DNK' }, + { alpha2: 'DM', alpha3: 'DMA' }, + { alpha2: 'DO', alpha3: 'DOM' }, + { alpha2: 'DZ', alpha3: 'DZA' }, + { alpha2: 'EC', alpha3: 'ECU' }, + { alpha2: 'EE', alpha3: 'EST' }, + { alpha2: 'EG', alpha3: 'EGY' }, + { alpha2: 'EH', alpha3: 'ESH' }, + { alpha2: 'ER', alpha3: 'ERI' }, + { alpha2: 'ES', alpha3: 'ESP' }, + { alpha2: 'ET', alpha3: 'ETH' }, + { alpha2: 'FI', alpha3: 'FIN' }, + { alpha2: 'FJ', alpha3: 'FJI' }, + { alpha2: 'FK', alpha3: 'FLK' }, + { alpha2: 'FM', alpha3: 'FSM' }, + { alpha2: 'FO', alpha3: 'FRO' }, + { alpha2: 'FR', alpha3: 'FRA' }, + { alpha2: 'GA', alpha3: 'GAB' }, + { alpha2: 'GB', alpha3: 'GBR' }, + { alpha2: 'GD', alpha3: 'GRD' }, + { alpha2: 'GE', alpha3: 'GEO' }, + { alpha2: 'GF', alpha3: 'GUF' }, + { alpha2: 'GG', alpha3: 'GGY' }, + { alpha2: 'GH', alpha3: 'GHA' }, + { alpha2: 'GI', alpha3: 'GIB' }, + { alpha2: 'GL', alpha3: 'GRL' }, + { alpha2: 'GM', alpha3: 'GMB' }, + { alpha2: 'GN', alpha3: 'GIN' }, + { alpha2: 'GP', alpha3: 'GLP' }, + { alpha2: 'GQ', alpha3: 'GNQ' }, + { alpha2: 'GR', alpha3: 'GRC' }, + { alpha2: 'GS', alpha3: 'SGS' }, + { alpha2: 'GT', alpha3: 'GTM' }, + { alpha2: 'GU', alpha3: 'GUM' }, + { alpha2: 'GW', alpha3: 'GNB' }, + { alpha2: 'GY', alpha3: 'GUY' }, + { alpha2: 'HK', alpha3: 'HKG' }, + { alpha2: 'HM', alpha3: 'HMD' }, + { alpha2: 'HN', alpha3: 'HND' }, + { alpha2: 'HR', alpha3: 'HRV' }, + { alpha2: 'HT', alpha3: 'HTI' }, + { alpha2: 'HU', alpha3: 'HUN' }, + { alpha2: 'ID', alpha3: 'IDN' }, + { alpha2: 'IE', alpha3: 'IRL' }, + { alpha2: 'IL', alpha3: 'ISR' }, + { alpha2: 'IM', alpha3: 'IMN' }, + { alpha2: 'IN', alpha3: 'IND' }, + { alpha2: 'IO', alpha3: 'IOT' }, + { alpha2: 'IQ', alpha3: 'IRQ' }, + { alpha2: 'IR', alpha3: 'IRN' }, + { alpha2: 'IS', alpha3: 'ISL' }, + { alpha2: 'IT', alpha3: 'ITA' }, + { alpha2: 'JE', alpha3: 'JEY' }, + { alpha2: 'JM', alpha3: 'JAM' }, + { alpha2: 'JO', alpha3: 'JOR' }, + { alpha2: 'JP', alpha3: 'JPN' }, + { alpha2: 'KE', alpha3: 'KEN' }, + { alpha2: 'KG', alpha3: 'KGZ' }, + { alpha2: 'KH', alpha3: 'KHM' }, + { alpha2: 'KI', alpha3: 'KIR' }, + { alpha2: 'KM', alpha3: 'COM' }, + { alpha2: 'KN', alpha3: 'KNA' }, + { alpha2: 'KP', alpha3: 'PRK' }, + { alpha2: 'KR', alpha3: 'KOR' }, + { alpha2: 'KW', alpha3: 'KWT' }, + { alpha2: 'KY', alpha3: 'CYM' }, + { alpha2: 'KZ', alpha3: 'KAZ' }, + { alpha2: 'LA', alpha3: 'LAO' }, + { alpha2: 'LB', alpha3: 'LBN' }, + { alpha2: 'LC', alpha3: 'LCA' }, + { alpha2: 'LI', alpha3: 'LIE' }, + { alpha2: 'LK', alpha3: 'LKA' }, + { alpha2: 'LR', alpha3: 'LBR' }, + { alpha2: 'LS', alpha3: 'LSO' }, + { alpha2: 'LT', alpha3: 'LTU' }, + { alpha2: 'LU', alpha3: 'LUX' }, + { alpha2: 'LV', alpha3: 'LVA' }, + { alpha2: 'LY', alpha3: 'LBY' }, + { alpha2: 'MA', alpha3: 'MAR' }, + { alpha2: 'MC', alpha3: 'MCO' }, + { alpha2: 'MD', alpha3: 'MDA' }, + { alpha2: 'ME', alpha3: 'MNE' }, + { alpha2: 'MF', alpha3: 'MAF' }, + { alpha2: 'MG', alpha3: 'MDG' }, + { alpha2: 'MH', alpha3: 'MHL' }, + { alpha2: 'MK', alpha3: 'MKD' }, + { alpha2: 'ML', alpha3: 'MLI' }, + { alpha2: 'MM', alpha3: 'MMR' }, + { alpha2: 'MN', alpha3: 'MNG' }, + { alpha2: 'MO', alpha3: 'MAC' }, + { alpha2: 'MP', alpha3: 'MNP' }, + { alpha2: 'MQ', alpha3: 'MTQ' }, + { alpha2: 'MR', alpha3: 'MRT' }, + { alpha2: 'MS', alpha3: 'MSR' }, + { alpha2: 'MT', alpha3: 'MLT' }, + { alpha2: 'MU', alpha3: 'MUS' }, + { alpha2: 'MV', alpha3: 'MDV' }, + { alpha2: 'MW', alpha3: 'MWI' }, + { alpha2: 'MX', alpha3: 'MEX' }, + { alpha2: 'MY', alpha3: 'MYS' }, + { alpha2: 'MZ', alpha3: 'MOZ' }, + { alpha2: 'NA', alpha3: 'NAM' }, + { alpha2: 'NC', alpha3: 'NCL' }, + { alpha2: 'NE', alpha3: 'NER' }, + { alpha2: 'NF', alpha3: 'NFK' }, + { alpha2: 'NG', alpha3: 'NGA' }, + { alpha2: 'NI', alpha3: 'NIC' }, + { alpha2: 'NL', alpha3: 'NLD' }, + { alpha2: 'NO', alpha3: 'NOR' }, + { alpha2: 'NP', alpha3: 'NPL' }, + { alpha2: 'NR', alpha3: 'NRU' }, + { alpha2: 'NU', alpha3: 'NIU' }, + { alpha2: 'NZ', alpha3: 'NZL' }, + { alpha2: 'OM', alpha3: 'OMN' }, + { alpha2: 'PA', alpha3: 'PAN' }, + { alpha2: 'PE', alpha3: 'PER' }, + { alpha2: 'PF', alpha3: 'PYF' }, + { alpha2: 'PG', alpha3: 'PNG' }, + { alpha2: 'PH', alpha3: 'PHL' }, + { alpha2: 'PK', alpha3: 'PAK' }, + { alpha2: 'PL', alpha3: 'POL' }, + { alpha2: 'PM', alpha3: 'SPM' }, + { alpha2: 'PN', alpha3: 'PCN' }, + { alpha2: 'PR', alpha3: 'PRI' }, + { alpha2: 'PS', alpha3: 'PSE' }, + { alpha2: 'PT', alpha3: 'PRT' }, + { alpha2: 'PW', alpha3: 'PLW' }, + { alpha2: 'PY', alpha3: 'PRY' }, + { alpha2: 'QA', alpha3: 'QAT' }, + { alpha2: 'RE', alpha3: 'REU' }, + { alpha2: 'RO', alpha3: 'ROU' }, + { alpha2: 'RS', alpha3: 'SRB' }, + { alpha2: 'RU', alpha3: 'RUS' }, + { alpha2: 'RW', alpha3: 'RWA' }, + { alpha2: 'SA', alpha3: 'SAU' }, + { alpha2: 'SB', alpha3: 'SLB' }, + { alpha2: 'SC', alpha3: 'SYC' }, + { alpha2: 'SD', alpha3: 'SDN' }, + { alpha2: 'SE', alpha3: 'SWE' }, + { alpha2: 'SG', alpha3: 'SGP' }, + { alpha2: 'SH', alpha3: 'SHN' }, + { alpha2: 'SI', alpha3: 'SVN' }, + { alpha2: 'SJ', alpha3: 'SJM' }, + { alpha2: 'SK', alpha3: 'SVK' }, + { alpha2: 'SL', alpha3: 'SLE' }, + { alpha2: 'SM', alpha3: 'SMR' }, + { alpha2: 'SN', alpha3: 'SEN' }, + { alpha2: 'SO', alpha3: 'SOM' }, + { alpha2: 'SR', alpha3: 'SUR' }, + { alpha2: 'SS', alpha3: 'SSD' }, + { alpha2: 'ST', alpha3: 'STP' }, + { alpha2: 'SV', alpha3: 'SLV' }, + { alpha2: 'SX', alpha3: 'SXM' }, + { alpha2: 'SY', alpha3: 'SYR' }, + { alpha2: 'SZ', alpha3: 'SWZ' }, + { alpha2: 'TC', alpha3: 'TCA' }, + { alpha2: 'TD', alpha3: 'TCD' }, + { alpha2: 'TF', alpha3: 'ATF' }, + { alpha2: 'TG', alpha3: 'TGO' }, + { alpha2: 'TH', alpha3: 'THA' }, + { alpha2: 'TJ', alpha3: 'TJK' }, + { alpha2: 'TK', alpha3: 'TKL' }, + { alpha2: 'TL', alpha3: 'TLS' }, + { alpha2: 'TM', alpha3: 'TKM' }, + { alpha2: 'TN', alpha3: 'TUN' }, + { alpha2: 'TO', alpha3: 'TON' }, + { alpha2: 'TR', alpha3: 'TUR' }, + { alpha2: 'TT', alpha3: 'TTO' }, + { alpha2: 'TV', alpha3: 'TUV' }, + { alpha2: 'TW', alpha3: 'TWN' }, + { alpha2: 'TZ', alpha3: 'TZA' }, + { alpha2: 'UA', alpha3: 'UKR' }, + { alpha2: 'UG', alpha3: 'UGA' }, + { alpha2: 'UM', alpha3: 'UMI' }, + { alpha2: 'US', alpha3: 'USA' }, + { alpha2: 'UY', alpha3: 'URY' }, + { alpha2: 'UZ', alpha3: 'UZB' }, + { alpha2: 'VA', alpha3: 'VAT' }, + { alpha2: 'VC', alpha3: 'VCT' }, + { alpha2: 'VE', alpha3: 'VEN' }, + { alpha2: 'VG', alpha3: 'VGB' }, + { alpha2: 'VI', alpha3: 'VIR' }, + { alpha2: 'VN', alpha3: 'VNM' }, + { alpha2: 'VU', alpha3: 'VUT' }, + { alpha2: 'WF', alpha3: 'WLF' }, + { alpha2: 'WS', alpha3: 'WSM' }, + { alpha2: 'YE', alpha3: 'YEM' }, + { alpha2: 'YT', alpha3: 'MYT' }, + { alpha2: 'ZA', alpha3: 'ZAF' }, + { alpha2: 'ZM', alpha3: 'ZMB' }, + { alpha2: 'ZW', alpha3: 'ZWE' }, ]; diff --git a/src/locales/en/location/country_code_alpha_3.ts b/src/locales/en/location/country_code_alpha_3.ts deleted file mode 100644 index 20708d640bd..00000000000 --- a/src/locales/en/location/country_code_alpha_3.ts +++ /dev/null @@ -1,252 +0,0 @@ -export default [ - 'BGD', - 'BEL', - 'BFA', - 'BGR', - 'BIH', - 'BRB', - 'WLF', - 'BLM', - 'BMU', - 'BRN', - 'BOL', - 'BHR', - 'BDI', - 'BEN', - 'BTN', - 'JAM', - 'BVT', - 'BWA', - 'WSM', - 'BES', - 'BRA', - 'BHS', - 'JEY', - 'BLR', - 'BLZ', - 'RUS', - 'RWA', - 'SRB', - 'TLS', - 'REU', - 'TKM', - 'TJK', - 'ROU', - 'TKL', - 'GNB', - 'GUM', - 'GTM', - 'SGS', - 'GRC', - 'GNQ', - 'GLP', - 'JPN', - 'GUY', - 'GGY', - 'GUF', - 'GEO', - 'GRD', - 'GBR', - 'GAB', - 'SLV', - 'GIN', - 'GMB', - 'GRL', - 'GIB', - 'GHA', - 'OMN', - 'TUN', - 'JOR', - 'HRV', - 'HTI', - 'HUN', - 'HKG', - 'HND', - 'HMD', - 'VEN', - 'PRI', - 'PSE', - 'PLW', - 'PRT', - 'SJM', - 'PRY', - 'IRQ', - 'PAN', - 'PYF', - 'PNG', - 'PER', - 'PAK', - 'PHL', - 'PCN', - 'POL', - 'SPM', - 'ZMB', - 'ESH', - 'EST', - 'EGY', - 'ZAF', - 'ECU', - 'ITA', - 'VNM', - 'SLB', - 'ETH', - 'SOM', - 'ZWE', - 'SAU', - 'ESP', - 'ERI', - 'MNE', - 'MDA', - 'MDG', - 'MAF', - 'MAR', - 'MCO', - 'UZB', - 'MMR', - 'MLI', - 'MAC', - 'MNG', - 'MHL', - 'MKD', - 'MUS', - 'MLT', - 'MWI', - 'MDV', - 'MTQ', - 'MNP', - 'MSR', - 'MRT', - 'IMN', - 'UGA', - 'TZA', - 'MYS', - 'MEX', - 'ISR', - 'FRA', - 'IOT', - 'SHN', - 'FIN', - 'FJI', - 'FLK', - 'FSM', - 'FRO', - 'NIC', - 'NLD', - 'NOR', - 'NAM', - 'VUT', - 'NCL', - 'NER', - 'NFK', - 'NGA', - 'NZL', - 'NPL', - 'NRU', - 'NIU', - 'COK', - 'XKX', - 'CIV', - 'CHE', - 'COL', - 'CHN', - 'CMR', - 'CHL', - 'CCK', - 'CAN', - 'COG', - 'CAF', - 'COD', - 'CZE', - 'CYP', - 'CXR', - 'CRI', - 'CUW', - 'CPV', - 'CUB', - 'SWZ', - 'SYR', - 'SXM', - 'KGZ', - 'KEN', - 'SSD', - 'SUR', - 'KIR', - 'KHM', - 'KNA', - 'COM', - 'STP', - 'SVK', - 'KOR', - 'SVN', - 'PRK', - 'KWT', - 'SEN', - 'SMR', - 'SLE', - 'SYC', - 'KAZ', - 'CYM', - 'SGP', - 'SWE', - 'SDN', - 'DOM', - 'DMA', - 'DJI', - 'DNK', - 'VGB', - 'DEU', - 'YEM', - 'DZA', - 'USA', - 'URY', - 'MYT', - 'UMI', - 'LBN', - 'LCA', - 'LAO', - 'TUV', - 'TWN', - 'TTO', - 'TUR', - 'LKA', - 'LIE', - 'LVA', - 'TON', - 'LTU', - 'LUX', - 'LBR', - 'LSO', - 'THA', - 'ATF', - 'TGO', - 'TCD', - 'TCA', - 'LBY', - 'VAT', - 'VCT', - 'ARE', - 'AND', - 'ATG', - 'AFG', - 'AIA', - 'VIR', - 'ISL', - 'IRN', - 'ARM', - 'ALB', - 'AGO', - 'ATA', - 'ASM', - 'ARG', - 'AUS', - 'AUT', - 'ABW', - 'IND', - 'ALA', - 'AZE', - 'IRL', - 'IDN', - 'UKR', - 'QAT', - 'MOZ', -]; diff --git a/src/locales/en/location/index.ts b/src/locales/en/location/index.ts index 5fd8af21c1e..e1f68cf9530 100644 --- a/src/locales/en/location/index.ts +++ b/src/locales/en/location/index.ts @@ -10,7 +10,6 @@ import city_prefix from './city_prefix'; import city_suffix from './city_suffix'; import country from './country'; import country_code from './country_code'; -import country_code_alpha_3 from './country_code_alpha_3'; import county from './county'; import default_country from './default_country'; import direction from './direction'; @@ -32,7 +31,6 @@ const location: LocationDefinitions = { city_suffix, country, country_code, - country_code_alpha_3, county, default_country, direction, diff --git a/src/locales/fr_CH/location/country_code.ts b/src/locales/fr_CH/location/country_code.ts index ce14a4eda24..c92988f14ba 100644 --- a/src/locales/fr_CH/location/country_code.ts +++ b/src/locales/fr_CH/location/country_code.ts @@ -1 +1,2 @@ -export default ['CH']; +// [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) +export default [{ alpha2: 'CH', alpha3: 'CHE' }]; diff --git a/src/modules/location/index.ts b/src/modules/location/index.ts index 4ce28bcf7b1..2025beaccf5 100644 --- a/src/modules/location/index.ts +++ b/src/modules/location/index.ts @@ -256,10 +256,10 @@ export class LocationModule { } /** - * Returns a random country code. + * Returns a random [ISO_3166-1](https://en.wikipedia.org/wiki/ISO_3166-1) country code. * * @param options The code to return or an options object. Defaults to `{}`. - * @param options.variant The variant to return. Can be either `'alpha-2'` (2 letter code) + * @param options.variant The variant to return. Can be either `'alpha-2'` (two letter code) * or `'alpha-3'` (three letter code). Defaults to `'alpha-2'`. * * @example @@ -276,7 +276,7 @@ export class LocationModule { | { /** * The code to return. - * Can be either `'alpha-2'` (2 letter code) + * Can be either `'alpha-2'` (two letter code) * or `'alpha-3'` (three letter code). * * @default 'alpha-2' @@ -289,11 +289,11 @@ export class LocationModule { } const { variant = 'alpha-2' } = options; - const key = variant === 'alpha-3' ? 'country_code_alpha_3' : 'country_code'; + const key = variant === 'alpha-3' ? 'alpha3' : 'alpha2'; return this.faker.helpers.arrayElement( - this.faker.definitions.location[key] - ); + this.faker.definitions.location.country_code + )[key]; } /** diff --git a/test/__snapshots__/location.spec.ts.snap b/test/__snapshots__/location.spec.ts.snap index 8b67230402f..e6dc8876dd2 100644 --- a/test/__snapshots__/location.spec.ts.snap +++ b/test/__snapshots__/location.spec.ts.snap @@ -16,7 +16,7 @@ exports[`location > 42 > country 1`] = `"Guinea"`; exports[`location > 42 > countryCode > noArgs 1`] = `"GY"`; -exports[`location > 42 > countryCode > with alphaCode option 1`] = `"SAU"`; +exports[`location > 42 > countryCode > with alphaCode option 1`] = `"GUY"`; exports[`location > 42 > countryCode > with string 1`] = `"GY"`; @@ -174,7 +174,7 @@ exports[`location > 1211 > country 1`] = `"Uganda"`; exports[`location > 1211 > countryCode > noArgs 1`] = `"UM"`; -exports[`location > 1211 > countryCode > with alphaCode option 1`] = `"IRN"`; +exports[`location > 1211 > countryCode > with alphaCode option 1`] = `"UMI"`; exports[`location > 1211 > countryCode > with string 1`] = `"UM"`; @@ -332,7 +332,7 @@ exports[`location > 1337 > country 1`] = `"Egypt"`; exports[`location > 1337 > countryCode > noArgs 1`] = `"EH"`; -exports[`location > 1337 > countryCode > with alphaCode option 1`] = `"PRI"`; +exports[`location > 1337 > countryCode > with alphaCode option 1`] = `"ESH"`; exports[`location > 1337 > countryCode > with string 1`] = `"EH"`;