Jump to content

Модул:scripts/print

Аз Wiktionary

Инро барои навсозӣ кардани Module:scripts/by name ва Module:scripts/code to canonical name истифода баред.

return {
	["Adlam"] = "Adlm",
	["Afaka"] = "Afak",
	["Ahom"] = "Ahom",
	["Anatolian Hieroglyphs"] = "Hluw",
	["Arabic"] = "Arab",
	["Armenian"] = "Armn",
	["Assamese"] = "as-Beng",
	["Avestan"] = "Avst",
	["Balinese"] = "Bali",
	["Bamum"] = "Bamu",
	["Bassa"] = "Bass",
	["Batak"] = "Batk",
	["Baybayin"] = "Tglg",
	["Bengali"] = "Beng",
	["Bhaiksuki"] = "Bhks",
	["Blissymbols"] = "Blis",
	["Book Pahlavi"] = "Phlv",
	["Brahmi"] = "Brah",
	["Braille"] = "Brai",
	["Buhid"] = "Buhd",
	["Burmese"] = "Mymr",
	["Canadian syllabics"] = "Cans",
	["Carian"] = "Cari",
	["Caucasian Albanian"] = "Aghb",
	["Chakma"] = "Cakm",
	["Cham"] = "Cham",
	["Cherokee"] = "Cher",
	["Chisoi"] = "Chis",
	["Chorasmian"] = "Chrs",
	["Clear Script"] = "xwo-Mong",
	["Coptic"] = "Copt",
	["Cuneiform"] = "Xsux",
	["Cypriot"] = "Cprt",
	["Cypro-Minoan"] = "Cpmn",
	["Cyrillic"] = "Cyrl",
	["Demotic"] = "Egyd",
	["Deseret"] = "Dsrt",
	["Devanagari"] = "Deva",
	["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",
	["Greek"] = "Grek",
	["Gujarati"] = "Gujr",
	["Gunjala Gondi"] = "Gong",
	["Gurmukhi"] = "Guru",
	["Han"] = "Hani",
	["Hangul"] = "Hang",
	["Hanifi Rohingya"] = "Rohg",
	["Hanunoo"] = "Hano",
	["Hatran"] = "Hatr",
	["Hebrew"] = "Hebr",
	["Hieratic"] = "Egyh",
	["Hiragana"] = "Hira",
	["Image-rendered"] = "Image",
	["Imperial Aramaic"] = "Armi",
	["Indus"] = "Inds",
	["Inscriptional Pahlavi"] = "Phli",
	["Inscriptional Parthian"] = "Prti",
	["International Phonetic Alphabet"] = "Ipach",
	["Japanese"] = "Jpan",
	["Javanese"] = "Java",
	["Jurchen"] = "Jurc",
	["Kaithi"] = "Kthi",
	["Kana"] = "Hrkt",
	["Kannada"] = "Knda",
	["Katakana"] = "Kana",
	["Kawi"] = "Kawi",
	["Kayah Li"] = "Kali",
	["Kharoshthi"] = "Khar",
	["Khema"] = "Gukh",
	["Khitan Large"] = "Kitl",
	["Khitan Small"] = "Kits",
	["Khmer"] = "Khmr",
	["Khojki"] = "Khoj",
	["Khudawadi"] = "Sind",
	["Khutsuri"] = "Geok",
	["Kirat Rai"] = "Krai",
	["Korean"] = "Kore",
	["Kpelle"] = "Kpel",
	["Lai Tay"] = "Tayo",
	["Lao"] = "Laoo",
	["Latin"] = "Latn",
	["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",
	["Mro"] = "Mroo",
	["Multani"] = "Mult",
	["Musical notation"] = "Music",
	["N'Ko"] = "Nkoo",
	["Nabataean"] = "Nbat",
	["Nag Mundari"] = "Nagm",
	["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 North Arabian"] = "Narb",
	["Old Permic"] = "Perm",
	["Old Persian"] = "Xpeo",
	["Old Sogdian"] = "Sogo",
	["Old South Arabian"] = "Sarb",
	["Old Uyghur"] = "Ougr",
	["Orkhon runes"] = "Orkh",
	["Osage"] = "Osge",
	["Osmanya"] = "Osma",
	["Pahawh Hmong"] = "Hmng",
	["Palmyrene"] = "Palm",
	["Pau Cin Hau"] = "Pauc",
	["Pazend"] = "pal-Avst",
	["Phags-pa"] = "Phag",
	["Phoenician"] = "Phnx",
	["Pollard"] = "Plrd",
	["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",
	["Sinhalese"] = "Sinh",
	["Sogdian"] = "Sogd",
	["Sorang Sompeng"] = "Sora",
	["Southeastern Iberian"] = "Ibrns",
	["Soyombo"] = "Soyo",
	["Sui"] = "Shui",
	["Sundanese"] = "Sund",
	["Sunuwar"] = "Sunu",
	["Syloti Nagri"] = "Sylo",
	["Syriac"] = "Syrc",
	["Tagbanwa"] = "Tagb",
	["Tai Nüa"] = "Tale",
	["Tai Tham"] = "Lana",
	["Tai Viet"] = "Tavt",
	["Takri"] = "Takr",
	["Tamil"] = "Taml",
	["Tamyig"] = "sit-tam-Tibt",
	["Tangsa"] = "Tnsa",
	["Tangut"] = "Tang",
	["Telugu"] = "Telu",
	["Tengwar"] = "Teng",
	["Thaana"] = "Thaa",
	["Thai"] = "Thai",
	["Tibetan"] = "Tibt",
	["Tifinagh"] = "Tfng",
	["Tigalari"] = "Tutg",
	["Tirhuta"] = "Tirh",
	["Todhri"] = "Todr",
	["Tolong Siki"] = "Tols",
	["Toto"] = "Toto",
	["Traditional Han"] = "Hant",
	["Ugaritic"] = "Ugar",
	["Unspecified"] = "None",
	["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",
	["symbol"] = "Zsym",
	["uncoded"] = "Zzzz",
	["undetermined"] = "Zyyy",
}
return {
	["Adlm"] = "Adlam",
	["Afak"] = "Afaka",
	["Aghb"] = "Caucasian Albanian",
	["Ahom"] = "Ahom",
	["Arab"] = "Arabic",
	["Armi"] = "Imperial Aramaic",
	["Armn"] = "Armenian",
	["Avst"] = "Avestan",
	["Bali"] = "Balinese",
	["Bamu"] = "Bamum",
	["Bass"] = "Bassa",
	["Batk"] = "Batak",
	["Beng"] = "Bengali",
	["Bhks"] = "Bhaiksuki",
	["Blis"] = "Blissymbols",
	["Bopo"] = "Zhuyin",
	["Brah"] = "Brahmi",
	["Brai"] = "Braille",
	["Bugi"] = "Lontara",
	["Buhd"] = "Buhid",
	["Cakm"] = "Chakma",
	["Cans"] = "Canadian syllabics",
	["Cari"] = "Carian",
	["Cham"] = "Cham",
	["Cher"] = "Cherokee",
	["Chis"] = "Chisoi",
	["Chrs"] = "Chorasmian",
	["Copt"] = "Coptic",
	["Cpmn"] = "Cypro-Minoan",
	["Cprt"] = "Cypriot",
	["Cyrl"] = "Cyrillic",
	["Cyrs"] = "Old Cyrillic",
	["Deva"] = "Devanagari",
	["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"] = "Greek",
	["Gujr"] = "Gujarati",
	["Gukh"] = "Khema",
	["Guru"] = "Gurmukhi",
	["Hang"] = "Hangul",
	["Hani"] = "Han",
	["Hano"] = "Hanunoo",
	["Hans"] = "Simplified Han",
	["Hant"] = "Traditional Han",
	["Hatr"] = "Hatran",
	["Hebr"] = "Hebrew",
	["Hira"] = "Hiragana",
	["Hluw"] = "Anatolian Hieroglyphs",
	["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"] = "Japanese",
	["Jurc"] = "Jurchen",
	["Kali"] = "Kayah Li",
	["Kana"] = "Katakana",
	["Kawi"] = "Kawi",
	["Khar"] = "Kharoshthi",
	["Khmr"] = "Khmer",
	["Khoj"] = "Khojki",
	["Kitl"] = "Khitan Large",
	["Kits"] = "Khitan Small",
	["Knda"] = "Kannada",
	["Kore"] = "Korean",
	["Kpel"] = "Kpelle",
	["Krai"] = "Kirat Rai",
	["Kthi"] = "Kaithi",
	["Lana"] = "Tai Tham",
	["Laoo"] = "Lao",
	["Latf"] = "Fraktur",
	["Latg"] = "Gaelic",
	["Latn"] = "Latin",
	["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"] = "Mro",
	["Mtei"] = "Meitei Mayek",
	["Mult"] = "Multani",
	["Music"] = "Musical notation",
	["Mymr"] = "Burmese",
	["Nagm"] = "Nag Mundari",
	["Nand"] = "Nandinagari",
	["Narb"] = "Old 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"] = "Orkhon runes",
	["Orya"] = "Odia",
	["Osge"] = "Osage",
	["Osma"] = "Osmanya",
	["Ougr"] = "Old Uyghur",
	["Palm"] = "Palmyrene",
	["Pauc"] = "Pau Cin Hau",
	["Perm"] = "Old Permic",
	["Phag"] = "Phags-pa",
	["Phli"] = "Inscriptional Pahlavi",
	["Phlp"] = "Psalter Pahlavi",
	["Phlv"] = "Book Pahlavi",
	["Phnx"] = "Phoenician",
	["Plrd"] = "Pollard",
	["Polyt"] = "Greek",
	["Prti"] = "Inscriptional Parthian",
	["Ranj"] = "Ranjana",
	["Rjng"] = "Rejang",
	["Rohg"] = "Hanifi Rohingya",
	["Roro"] = "Rongorongo",
	["Rumin"] = "Rumi numerals",
	["Runr"] = "Runic",
	["Samr"] = "Samaritan",
	["Sarb"] = "Old South Arabian",
	["Saur"] = "Saurashtra",
	["Semap"] = "flag semaphore",
	["Sgnw"] = "SignWriting",
	["Shaw"] = "Shavian",
	["Shrd"] = "Sharada",
	["Shui"] = "Sui",
	["Sidd"] = "Siddham",
	["Sidt"] = "Sidetic",
	["Sind"] = "Khudawadi",
	["Sinh"] = "Sinhalese",
	["Sogd"] = "Sogdian",
	["Sogo"] = "Old Sogdian",
	["Sora"] = "Sorang Sompeng",
	["Soyo"] = "Soyombo",
	["Sund"] = "Sundanese",
	["Sunu"] = "Sunuwar",
	["Sylo"] = "Syloti Nagri",
	["Syrc"] = "Syriac",
	["Tagb"] = "Tagbanwa",
	["Takr"] = "Takri",
	["Tale"] = "Tai Nüa",
	["Talu"] = "New Tai Lue",
	["Taml"] = "Tamil",
	["Tang"] = "Tangut",
	["Tavt"] = "Tai Viet",
	["Tayo"] = "Lai Tay",
	["Telu"] = "Telugu",
	["Teng"] = "Tengwar",
	["Tfng"] = "Tifinagh",
	["Tglg"] = "Baybayin",
	["Thaa"] = "Thaana",
	["Thai"] = "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"] = "symbol",
	["Zyyy"] = "undetermined",
	["Zzzz"] = "uncoded",
	["as-Beng"] = "Assamese",
	["fa-Arab"] = "Arabic",
	["kk-Arab"] = "Arabic",
	["ks-Arab"] = "Arabic",
	["ku-Arab"] = "Arabic",
	["mnc-Mong"] = "Manchu",
	["ms-Arab"] = "Arabic",
	["mzn-Arab"] = "Arabic",
	["ota-Arab"] = "Arabic",
	["pa-Arab"] = "Shahmukhi",
	["pal-Avst"] = "Pazend",
	["pjt-Latn"] = "Latin",
	["ps-Arab"] = "Arabic",
	["sd-Arab"] = "Arabic",
	["sit-tam-Tibt"] = "Tamyig",
	["sjo-Mong"] = "Xibe",
	["tt-Arab"] = "Arabic",
	["ug-Arab"] = "Arabic",
	["ur-Arab"] = "Arabic",
	["xwo-Mong"] = "Clear Script",
}

local export = {}

local function generate_table(name_to_code)
	local result = {}
	local script_data = mw.loadData("Module:scripts/data")
	
	local iterate
	if name_to_code then
		for code, data in pairs(script_data) do
			if not result[data[1]] or #code == 4 then
				-- Sometimes, multiple scripts have the same name, e.g. 'Arab',
				-- 'fa-Arab', 'ur-Arab' and several others are called "Arabic".
				-- Prefer the one with four characters 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, name_to_code)
	local output = { "return {" }
	local i = 1
	local sorted_pairs = require "Module:table".sortedPairs
	
	for k, v in sorted_pairs(data) do
		i = i + 1
		output[i] = ('\t[%q] = %q,'):format(k, v)
	end
	
	table.insert(output, "}")
	
	return table.concat(output, "\n")
end

function export.code_to_name(frame)
	return require "Module:debug".highlight(dump(generate_table(false), false))
end

function export.name_to_code(frame)
	return require "Module:debug".highlight(dump(generate_table(true), true))
end

return export