convert ISO 3166-1 code to country names in i18n

convert ISO 3166-1 alpha-2 or alpha-3 or numeric contry/district code to country/district name in i18n

Este script no debería instalarse directamente. Es una biblioteca que utilizan otros scripts mediante la meta-directiva de inclusión // @require https://update.greasyfork.org/scripts/452413/1101204/convert%20ISO%203166-1%20code%20to%20country%20names%20in%20i18n.js

Autor
sitebucket
Versión
0.1
Creado
03/10/2022
Actualizado
05/10/2022
Licencia
Copyright sitebucket.net

usage

supported languages: ar, bn, de, en, es, fr, hi, it, jp, ko, pt, ru, zh-cn, zh-hk, zh-tw

alpha-2 code to country name a22country(a2, lang="en", codes=false)

alpha-3 code to country name a32country(a3, lang="en", codes=false)

numeric code to country name num2country(num, lang="en", codes=false)

test

console.log(a22country("AF"));
console.log(a22country("AF", "ar"));
console.log(a22country("AF", "bn"));
console.log(a22country("AF", "de"));
console.log(a22country("AF", "en"));
console.log(a22country("AF", "es"));
console.log(a22country("AF", "fr"));
console.log(a22country("AF", "hi"));
console.log(a22country("AF", "it"));
console.log(a22country("AF", "jp"));
console.log(a22country("AF", "ko"));
console.log(a22country("AF", "pt"));
console.log(a22country("AF", "ru"));
console.log(a22country("AF", "zh-cn"));
console.log(a22country("AF", "zh-hk"));
console.log(a22country("AF", "zh-tw"));
console.log(a22country("AF", "zh-tw", true));
console.log(a22country("AF", "zh-tw", false));
console.log("-----");
console.log(a32country("ALA"));
console.log(a32country("ALA", "ar"));
console.log(a32country("ALA", "bn"));
console.log(a32country("ALA", "de"));
console.log(a32country("ALA", "en"));
console.log(a32country("ALA", "es"));
console.log(a32country("ALA", "fr"));
console.log(a32country("ALA", "hi"));
console.log(a32country("ALA", "it"));
console.log(a32country("ALA", "jp"));
console.log(a32country("ALA", "ko"));
console.log(a32country("ALA", "pt"));
console.log(a32country("ALA", "ru"));
console.log(a32country("ALA", "zh-cn"));
console.log(a32country("ALA", "zh-hk"));
console.log(a32country("ALA", "zh-tw"));
console.log(a32country("ALA", "zh-tw", true));
console.log(a32country("ALA", "zh-tw", false));
console.log("-----");
console.log(num2country("008"));
console.log(num2country("008", "ar"));
console.log(num2country("008", "bn"));
console.log(num2country("008", "de"));
console.log(num2country("008", "en"));
console.log(num2country("008", "es"));
console.log(num2country("008", "fr"));
console.log(num2country("008", "hi"));
console.log(num2country("008", "it"));
console.log(num2country("008", "jp"));
console.log(num2country("008", "ko"));
console.log(num2country("008", "pt"));
console.log(num2country("008", "ru"));
console.log(num2country("008", "zh-cn"));
console.log(num2country("008", "zh-hk"));
console.log(num2country("008", "zh-tw"));
console.log(num2country("008", "zh-tw", true));
console.log(num2country("008", "zh-tw", false));

output

Afghanistan
أفغانستان
আফগানিস্তান
Afghanistan
Afghanistan
Afganistán
AFGHANISTAN
अफगानिस्तान
Afghanistan
アフガニスタン
아프가니스탄
Afeganistão
Афганистан
阿富汗
阿富汗
阿富汗
[ '阿富汗', 'AF', 'AFG', '004' ]
阿富汗
-----
Åland Islands
جزر أولاند
অলান্দ দ্বীপপুঞ্জ
Åland
Åland Islands
Åland
ÅLAND, ÎLES
Åland Islands
Isole Åland
オーランド諸島
올란드 제도
Aland, Ilhas
Аландские острова
奥兰
奧蘭
奧蘭
[ '奧蘭', 'AX', 'ALA', '248' ]
奧蘭
-----
Albania
ألبانيا
আলবেনিয়া
Albanien
Albania
Albania
ALBANIE
अल्बानिया
Albania
アルバニア
알바니아
Albânia
Албания
阿尔巴尼亚
阿爾巴尼亞
阿爾巴尼亞
阿爾巴尼亞
阿爾巴尼亞
[ '阿爾巴尼亞', 'AL', 'ALB', '008' ]
阿爾巴尼亞

data source