Use this to update Module:scripts/by name and Module:scripts/code to canonical name.

return {
	["Adlam"] = "Adlm",
	["Afaka"] = "Afak",
	["Ahom"] = "Ahom",
	["Anatolian hieroglyphic"] = "Hluw",
	["Ancient North Arabian"] = "Narb",
	["Ancient South Arabian"] = "Sarb",
	["Assamese"] = "as-Beng",
	["Avestan"] = "Avst",
	["Balinese"] = "Bali",
	["Bamum"] = "Bamu",
	["Bassa"] = "Bass",
	["Batak"] = "Batk",
	["Baybayin"] = "Tglg",
	["Bengali"] = "Beng",
	["Bhaiksuki"] = "Bhks",
	["Blissymbolic"] = "Blis",
	["Book Pahlavi"] = "Phlv",
	["Buhid"] = "Buhd",
	["Burmese"] = "Mymr",
	["Canadian syllabic"] = "Cans",
	["Carian"] = "Cari",
	["Caucasian Albanian"] = "Aghb",
	["Chakma"] = "Cakm",
	["Cham"] = "Cham",
	["Cherokee"] = "Cher",
	["Chisoi"] = "Chis",
	["Clear Script"] = "xwo-Mong",
	["Cuneiform"] = "Xsux",
	["Cypriot"] = "Cprt",
	["Cypro-Minoan"] = "Cpmn",
	["Cyrillic"] = "Cyrl",
	["Demotic"] = "Egyd",
	["Deseret"] = "Dsrt",
	["Dhives Akuru"] = "Diak",
	["Dogra"] = "Dogr",
	["Dongba"] = "Nkdb",
	["Duployan"] = "Dupl",
	["Egyptian hieroglyphic"] = "Egyp",
	["Elbasan"] = "Elba",
	["Elymaic"] = "Elym",
	["Ethiopic"] = "Ethi",
	["Fraktur"] = "Latf",
	["Fraser"] = "Lisu",
	["Gaelic"] = "Latg",
	["Garay"] = "Gara",
	["Geba"] = "Nkgb",
	["Georgian"] = "Geor",
	["Glagolitic"] = "Glag",
	["Gothic"] = "Goth",
	["Grantha"] = "Gran",
	["Gujarati"] = "Gujr",
	["Gunjala Gondi"] = "Gong",
	["Gurmukhi"] = "Guru",
	["Hangul"] = "Hang",
	["Hanifi Rohingya"] = "Rohg",
	["Hanunoo"] = "Hano",
	["Hatran"] = "Hatr",
	["Hieratic"] = "Egyh",
	["Image-rendered"] = "Image",
	["Imperial Aramaic"] = "Armi",
	["Indus"] = "Inds",
	["Inscriptional Pahlavi"] = "Phli",
	["Inscriptional Parthian"] = "Prti",
	["International Phonetic Alphabet"] = "Ipach",
	["Javanese"] = "Java",
	["Jurchen"] = "Jurc",
	["Kaithi"] = "Kthi",
	["Kana"] = "Hrkt",
	["Kannada"] = "Knda",
	["Kawi"] = "Kawi",
	["Kayah Li"] = "Kali",
	["Kharoshthi"] = "Khar",
	["Khema"] = "Gukh",
	["Khitan large"] = "Kitl",
	["Khitan small"] = "Kits",
	["Khmer"] = "Khmr",
	["Khojki"] = "Khoj",
	["Khudabadi"] = "Sind",
	["Khutsuri"] = "Geok",
	["Khwarezmian"] = "Chrs",
	["Kirat Rai"] = "Krai",
	["Kpelle"] = "Kpel",
	["Lai Tay"] = "Tayo",
	["Lao"] = "Laoo",
	["Leke"] = "Leke",
	["Lepcha"] = "Lepc",
	["Limbu"] = "Limb",
	["Linear A"] = "Lina",
	["Linear B"] = "Linb",
	["Loma"] = "Loma",
	["Lontara"] = "Bugi",
	["Lycian"] = "Lyci",
	["Lydian"] = "Lydi",
	["Mahajani"] = "Mahj",
	["Makasar"] = "Maka",
	["Malayalam"] = "Mlym",
	["Manchu"] = "mnc-Mong",
	["Mandaic"] = "Mand",
	["Manichaean"] = "Mani",
	["Marchen"] = "Marc",
	["Masaram Gondi"] = "Gonm",
	["Maya"] = "Maya",
	["Medefaidrin"] = "Medf",
	["Meitei Mayek"] = "Mtei",
	["Mende"] = "Mend",
	["Meroitic cursive"] = "Merc",
	["Meroitic hieroglyphic"] = "Mero",
	["Modi"] = "Modi",
	["Mongolian"] = "Mong",
	["Moon"] = "Moon",
	["Morse code"] = "Morse",
	["Mru"] = "Mroo",
	["Multani"] = "Mult",
	["Mundari Bani"] = "Nagm",
	["N'Ko"] = "Nkoo",
	["Nabataean"] = "Nbat",
	["Nandinagari"] = "Nand",
	["New Tai Lue"] = "Talu",
	["Newa"] = "Newa",
	["Northeastern Iberian"] = "Ibrnn",
	["Nyiakeng Puachue Hmong"] = "Hmnp",
	["Nüshu"] = "Nshu",
	["Odia"] = "Orya",
	["Ogham"] = "Ogam",
	["Ol Chiki"] = "Olck",
	["Ol Onal"] = "Onao",
	["Old Cyrillic"] = "Cyrs",
	["Old Hungarian"] = "Hung",
	["Old Italic"] = "Ital",
	["Old Permic"] = "Perm",
	["Old Persian"] = "Xpeo",
	["Old Sogdian"] = "Sogo",
	["Old Turkic"] = "Orkh",
	["Old Uyghur"] = "Ougr",
	["Osage"] = "Osge",
	["Osmanya"] = "Osma",
	["Pahawh Hmong"] = "Hmng",
	["Palmyrene"] = "Palm",
	["Pau Cin Hau"] = "Pauc",
	["Pazend"] = "pal-Avst",
	["Phags-pa"] = "Phag",
	["Phoenician"] = "Phnx",
	["Pollard"] = "Plrd",
	["Proto-Cuneiform"] = "Pcun",
	["Proto-Elamite"] = "Pelm",
	["Proto-Sinaitic"] = "Psin",
	["Psalter Pahlavi"] = "Phlp",
	["Ranjana"] = "Ranj",
	["Rejang"] = "Rjng",
	["Rongorongo"] = "Roro",
	["Rumi numerals"] = "Rumin",
	["Runic"] = "Runr",
	["Samaritan"] = "Samr",
	["Saurashtra"] = "Saur",
	["Shahmukhi"] = "pa-Arab",
	["Sharada"] = "Shrd",
	["Shavian"] = "Shaw",
	["Siddham"] = "Sidd",
	["Sidetic"] = "Sidt",
	["SignWriting"] = "Sgnw",
	["Simplified Han"] = "Hans",
	["Sogdian"] = "Sogd",
	["Sorang Sompeng"] = "Sora",
	["Southeastern Iberian"] = "Ibrns",
	["Soyombo"] = "Soyo",
	["Sui"] = "Shui",
	["Sundanese"] = "Sund",
	["Sunuwar"] = "Sunu",
	["Sylheti Nagri"] = "Sylo",
	["Syriac"] = "Syrc",
	["Tagbanwa"] = "Tagb",
	["Tai Nüa"] = "Tale",
	["Tai Tham"] = "Lana",
	["Tai Viet"] = "Tavt",
	["Takri"] = "Takr",
	["Tamyig"] = "sit-tam-Tibt",
	["Tangsa"] = "Tnsa",
	["Tangut"] = "Tang",
	["Telugu"] = "Telu",
	["Tengwar"] = "Teng",
	["Thaana"] = "Thaa",
	["Tibetan"] = "Tibt",
	["Tifinagh"] = "Tfng",
	["Tigalari"] = "Tutg",
	["Tirhuta"] = "Tirh",
	["Todhri"] = "Todr",
	["Tolong Siki"] = "Tols",
	["Toto"] = "Toto",
	["Traditional Han"] = "Hant",
	["Ugaritic"] = "Ugar",
	["Vai"] = "Vaii",
	["Varang Kshiti"] = "Wara",
	["Visible Speech"] = "Visp",
	["Vithkuqi"] = "Vith",
	["Wancho"] = "Wcho",
	["Woleai"] = "Wole",
	["Xibe"] = "sjo-Mong",
	["Yezidi"] = "Yezi",
	["Yi"] = "Yiii",
	["Zanabazar Square"] = "Zanb",
	["Zhuyin"] = "Bopo",
	["flag semaphore"] = "Semap",
	["mathematical notation"] = "Zmth",
	["musical notation"] = "Music",
	["symbolic"] = "Zsym",
	["uncoded"] = "Zzzz",
	["undetermined"] = "Zyyy",
	["unspecified"] = "None",
	["අරාබි"] = "Arab",
	["ආමේනියානු"] = "Armn",
	["කතකනා"] = "Kana",
	["කොප්ටික්"] = "Copt",
	["කොරියානු"] = "Kore",
	["ග්‍රීක"] = "Grek",
	["ජපන්"] = "Jpan",
	["තායි"] = "Thai",
	["දෙමළ"] = "Taml",
	["දේවනාගරි"] = "Deva",
	["බ්‍රාහ්මී"] = "Brah",
	["බ්‍රේල්"] = "Brai",
	["ලතින්"] = "Latn",
	["සිංහල"] = "Sinh",
	["හන්"] = "Hani",
	["හිරගනා"] = "Hira",
	["හීබෲ"] = "Hebr",
}
return {
	["Adlm"] = "Adlam",
	["Afak"] = "Afaka",
	["Aghb"] = "Caucasian Albanian",
	["Ahom"] = "Ahom",
	["Arab"] = "අරාබි",
	["Armi"] = "Imperial Aramaic",
	["Armn"] = "ආමේනියානු",
	["Avst"] = "Avestan",
	["Bali"] = "Balinese",
	["Bamu"] = "Bamum",
	["Bass"] = "Bassa",
	["Batk"] = "Batak",
	["Beng"] = "Bengali",
	["Bhks"] = "Bhaiksuki",
	["Blis"] = "Blissymbolic",
	["Bopo"] = "Zhuyin",
	["Brah"] = "බ්‍රාහ්මී",
	["Brai"] = "බ්‍රේල්",
	["Bugi"] = "Lontara",
	["Buhd"] = "Buhid",
	["Cakm"] = "Chakma",
	["Cans"] = "Canadian syllabic",
	["Cari"] = "Carian",
	["Cham"] = "Cham",
	["Cher"] = "Cherokee",
	["Chis"] = "Chisoi",
	["Chrs"] = "Khwarezmian",
	["Copt"] = "කොප්ටික්",
	["Cpmn"] = "Cypro-Minoan",
	["Cprt"] = "Cypriot",
	["Cyrl"] = "Cyrillic",
	["Cyrs"] = "Old Cyrillic",
	["Deva"] = "දේවනාගරි",
	["Diak"] = "Dhives Akuru",
	["Dogr"] = "Dogra",
	["Dsrt"] = "Deseret",
	["Dupl"] = "Duployan",
	["Egyd"] = "Demotic",
	["Egyh"] = "Hieratic",
	["Egyp"] = "Egyptian hieroglyphic",
	["Elba"] = "Elbasan",
	["Elym"] = "Elymaic",
	["Ethi"] = "Ethiopic",
	["Gara"] = "Garay",
	["Geok"] = "Khutsuri",
	["Geor"] = "Georgian",
	["Glag"] = "Glagolitic",
	["Gong"] = "Gunjala Gondi",
	["Gonm"] = "Masaram Gondi",
	["Goth"] = "Gothic",
	["Gran"] = "Grantha",
	["Grek"] = "ග්‍රීක",
	["Gujr"] = "Gujarati",
	["Gukh"] = "Khema",
	["Guru"] = "Gurmukhi",
	["Hang"] = "Hangul",
	["Hani"] = "හන්",
	["Hano"] = "Hanunoo",
	["Hans"] = "Simplified Han",
	["Hant"] = "Traditional Han",
	["Hatr"] = "Hatran",
	["Hebr"] = "හීබෲ",
	["Hira"] = "හිරගනා",
	["Hluw"] = "Anatolian hieroglyphic",
	["Hmng"] = "Pahawh Hmong",
	["Hmnp"] = "Nyiakeng Puachue Hmong",
	["Hrkt"] = "Kana",
	["Hung"] = "Old Hungarian",
	["Ibrnn"] = "Northeastern Iberian",
	["Ibrns"] = "Southeastern Iberian",
	["Image"] = "Image-rendered",
	["Inds"] = "Indus",
	["Ipach"] = "International Phonetic Alphabet",
	["Ital"] = "Old Italic",
	["Java"] = "Javanese",
	["Jpan"] = "ජපන්",
	["Jurc"] = "Jurchen",
	["Kali"] = "Kayah Li",
	["Kana"] = "කතකනා",
	["Kawi"] = "Kawi",
	["Khar"] = "Kharoshthi",
	["Khmr"] = "Khmer",
	["Khoj"] = "Khojki",
	["Kitl"] = "Khitan large",
	["Kits"] = "Khitan small",
	["Knda"] = "Kannada",
	["Kore"] = "කොරියානු",
	["Kpel"] = "Kpelle",
	["Krai"] = "Kirat Rai",
	["Kthi"] = "Kaithi",
	["Lana"] = "Tai Tham",
	["Laoo"] = "Lao",
	["Latf"] = "Fraktur",
	["Latg"] = "Gaelic",
	["Latn"] = "ලතින්",
	["Leke"] = "Leke",
	["Lepc"] = "Lepcha",
	["Limb"] = "Limbu",
	["Lina"] = "Linear A",
	["Linb"] = "Linear B",
	["Lisu"] = "Fraser",
	["Loma"] = "Loma",
	["Lyci"] = "Lycian",
	["Lydi"] = "Lydian",
	["Mahj"] = "Mahajani",
	["Maka"] = "Makasar",
	["Mand"] = "Mandaic",
	["Mani"] = "Manichaean",
	["Marc"] = "Marchen",
	["Maya"] = "Maya",
	["Medf"] = "Medefaidrin",
	["Mend"] = "Mende",
	["Merc"] = "Meroitic cursive",
	["Mero"] = "Meroitic hieroglyphic",
	["Mlym"] = "Malayalam",
	["Modi"] = "Modi",
	["Mong"] = "Mongolian",
	["Moon"] = "Moon",
	["Morse"] = "Morse code",
	["Mroo"] = "Mru",
	["Mtei"] = "Meitei Mayek",
	["Mult"] = "Multani",
	["Music"] = "musical notation",
	["Mymr"] = "Burmese",
	["Nagm"] = "Mundari Bani",
	["Nand"] = "Nandinagari",
	["Narb"] = "Ancient North Arabian",
	["Nbat"] = "Nabataean",
	["Newa"] = "Newa",
	["Nkdb"] = "Dongba",
	["Nkgb"] = "Geba",
	["Nkoo"] = "N'Ko",
	["None"] = "unspecified",
	["Nshu"] = "Nüshu",
	["Ogam"] = "Ogham",
	["Olck"] = "Ol Chiki",
	["Onao"] = "Ol Onal",
	["Orkh"] = "Old Turkic",
	["Orya"] = "Odia",
	["Osge"] = "Osage",
	["Osma"] = "Osmanya",
	["Ougr"] = "Old Uyghur",
	["Palm"] = "Palmyrene",
	["Pauc"] = "Pau Cin Hau",
	["Pcun"] = "Proto-Cuneiform",
	["Pelm"] = "Proto-Elamite",
	["Perm"] = "Old Permic",
	["Phag"] = "Phags-pa",
	["Phli"] = "Inscriptional Pahlavi",
	["Phlp"] = "Psalter Pahlavi",
	["Phlv"] = "Book Pahlavi",
	["Phnx"] = "Phoenician",
	["Plrd"] = "Pollard",
	["Polyt"] = "ග්‍රීක",
	["Prti"] = "Inscriptional Parthian",
	["Psin"] = "Proto-Sinaitic",
	["Ranj"] = "Ranjana",
	["Rjng"] = "Rejang",
	["Rohg"] = "Hanifi Rohingya",
	["Roro"] = "Rongorongo",
	["Rumin"] = "Rumi numerals",
	["Runr"] = "Runic",
	["Samr"] = "Samaritan",
	["Sarb"] = "Ancient South Arabian",
	["Saur"] = "Saurashtra",
	["Semap"] = "flag semaphore",
	["Sgnw"] = "SignWriting",
	["Shaw"] = "Shavian",
	["Shrd"] = "Sharada",
	["Shui"] = "Sui",
	["Sidd"] = "Siddham",
	["Sidt"] = "Sidetic",
	["Sind"] = "Khudabadi",
	["Sinh"] = "සිංහල",
	["Sogd"] = "Sogdian",
	["Sogo"] = "Old Sogdian",
	["Sora"] = "Sorang Sompeng",
	["Soyo"] = "Soyombo",
	["Sund"] = "Sundanese",
	["Sunu"] = "Sunuwar",
	["Sylo"] = "Sylheti Nagri",
	["Syrc"] = "Syriac",
	["Tagb"] = "Tagbanwa",
	["Takr"] = "Takri",
	["Tale"] = "Tai Nüa",
	["Talu"] = "New Tai Lue",
	["Taml"] = "දෙමළ",
	["Tang"] = "Tangut",
	["Tavt"] = "Tai Viet",
	["Tayo"] = "Lai Tay",
	["Telu"] = "Telugu",
	["Teng"] = "Tengwar",
	["Tfng"] = "Tifinagh",
	["Tglg"] = "Baybayin",
	["Thaa"] = "Thaana",
	["Thai"] = "තායි",
	["Tibt"] = "Tibetan",
	["Tirh"] = "Tirhuta",
	["Tnsa"] = "Tangsa",
	["Todr"] = "Todhri",
	["Tols"] = "Tolong Siki",
	["Toto"] = "Toto",
	["Tutg"] = "Tigalari",
	["Ugar"] = "Ugaritic",
	["Vaii"] = "Vai",
	["Visp"] = "Visible Speech",
	["Vith"] = "Vithkuqi",
	["Wara"] = "Varang Kshiti",
	["Wcho"] = "Wancho",
	["Wole"] = "Woleai",
	["Xpeo"] = "Old Persian",
	["Xsux"] = "Cuneiform",
	["Yezi"] = "Yezidi",
	["Yiii"] = "Yi",
	["Zanb"] = "Zanabazar Square",
	["Zmth"] = "mathematical notation",
	["Zsym"] = "symbolic",
	["Zyyy"] = "undetermined",
	["Zzzz"] = "uncoded",
	["as-Beng"] = "Assamese",
	["fa-Arab"] = "අරාබි",
	["kk-Arab"] = "අරාබි",
	["ks-Arab"] = "අරාබි",
	["ku-Arab"] = "අරාබි",
	["mnc-Mong"] = "Manchu",
	["ms-Arab"] = "අරාබි",
	["mzn-Arab"] = "අරාබි",
	["ota-Arab"] = "අරාබි",
	["pa-Arab"] = "Shahmukhi",
	["pal-Avst"] = "Pazend",
	["pjt-Latn"] = "ලතින්",
	["ps-Arab"] = "අරාබි",
	["sd-Arab"] = "අරාබි",
	["sit-tam-Tibt"] = "Tamyig",
	["sjo-Mong"] = "Xibe",
	["tt-Arab"] = "අරාබි",
	["ug-Arab"] = "අරාබි",
	["ur-Arab"] = "අරාබි",
	["xwo-Mong"] = "Clear Script",
}

local export = {}

local concat = table.concat
local highlight = require("Module:debug").highlight
local insert = table.insert
local sorted_pairs = require("Module:table").sortedPairs
local toJSON = require("Module:JSON").toJSON

local function generate_table(name_to_code)
	local result = {}
	local script_data = mw.loadData("Module:scripts/data")
	
	if name_to_code then
		for code, data in pairs(script_data) do
			local current = result[data[1]]
			if not current or #code < #current then
				-- Sometimes, multiple scripts have the same name, e.g. 'Arab',
				-- 'fa-Arab', 'ur-Arab' and several others are called "Arabic".
				-- Prefer the shorter code when disambiguating.
				result[data[1]] = code
			end
		end
	else
		for code, data in pairs(script_data) do
			result[code] = data[1]
		end
	end
	
	return result
end

local function dump(data)
	local output, i = {"return {"}, 1
	
	for k, v in sorted_pairs(data) do
		i = i + 1
		output[i] = ('\t[%q] = %q,'):format(k, v)
	end
	
	insert(output, "}")
	
	return concat(output, "\n")
end

local function print_data(name_to_code, args)
	local t = generate_table(name_to_code)
	if args[1] == "plain" then
		return dump(t)
	elseif args[1] == "json" then
		return toJSON(t, {compress = true, sort_keys = true})
	end
	return highlight(dump(t))
end

function export.code_to_name(frame)
	return print_data(false, frame.args)
end

function export.name_to_code(frame)
	return print_data(true, frame.args)
end

return export
"https://si.wiktionary.org/w/index.php?title=Module:scripts/print&oldid=196411" වෙතින් සම්ප්‍රවේශනය කෙරිණි