Modul:Copt-translit

Modul ini akan mentransliterasi teks dalam Tulisan Qibti. Ia digunakan untuk mentransliterasi Coptic, Nobiin, and Old Nubian. The module should preferably not be called directly from templates or other modules. To use it from a template, use {{xlit}}. Within a module, use Module:languages#Language:transliterate.

For testcases, see Module:Copt-translit/testcases.

Functions

sunting
tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

local export = {}

local chars = {
	["Ⲁ"] = "A", ["ⲁ"] = "a",
	["Ⲃ"] = "B", ["ⲃ"] = "b",
	["Ⲅ"] = "G", ["ⲅ"] = "g",
	["Ⲇ"] = "D", ["ⲇ"] = "d",
	["Ⲉ"] = "E", ["ⲉ"] = "e",
	["Ⲍ"] = "Z", ["ⲍ"] = "z",
	["Ⲏ"] = "Ḗ", ["ⲏ"] = "ē",
	["Ⲑ"] = "Th", ["ⲑ"] = "th",
	["Ⲓ"] = "I", ["ⲓ"] = "i",
	["Ⲕ"] = "K", ["ⲕ"] = "k",
	["Ⲗ"] = "L", ["ⲗ"] = "l",
	["Ⲙ"] = "M", ["ⲙ"] = "m",
	["Ⲛ"] = "N", ["ⲛ"] = "n",
	["Ⲝ"] = "Ks", ["ⲝ"] = "ks",
	["Ⲟ"] = "O", ["ⲟ"] = "o",
	["Ⲡ"] = "P", ["ⲡ"] = "p",
	["Ⲣ"] = "R", ["ⲣ"] = "r",
	["Ⲥ"] = "S", ["ⲥ"] = "s",
	["Ⲧ"] = "T", ["ⲧ"] = "t",
	["Ⲩ"] = "U", ["ⲩ"] = "u",
	["Ⲫ"] = "Ph", ["ⲫ"] = "ph",
	["Ⲭ"] = "Kh", ["ⲭ"] = "kh",
	["Ⲯ"] = "Ps", ["ⲯ"] = "ps",
	["Ⲱ"] = "Ō", ["ⲱ"] = "ō",
	["Ϣ"] = "Sh", ["ϣ"] = "sh",
	["Ϥ"] = "F", ["ϥ"] = "f",
	["Ϧ"] = "X", ["ϧ"] = "x", ["Ⳉ"] = "X", ["ⳉ"] = "x",
	["Ϩ"] = "H", ["ϩ"] = "h",
	["Ϫ"] = "J", ["ϫ"] = "j",
	["Ϭ"] = "Q", ["ϭ"] = "q",
	["Ϯ"] = "Ti", ["ϯ"] = "ti",
}

function export.tr(text, lang, sc)
	return (mw.ustring.gsub(text, '.', chars))
end

return export