انتقل إلى المحتوى

وحدة:osc-translit

من ويكاموس، القاموس الحر
local export = {}

local tt = {
	--vowels
	["𐌀"] = "a",
	["𐌄"] = "e",
	["𐌉"] = "i",
	["𐌖"] = "u",
	["𐌞"] = "ú",
	["𐌝"] = "í",
	--consonants
	["𐌁"] = "b",
	["𐌂"] = "g",
	["𐌃"] = "d",
	["𐌅"] = "v",
	["𐌆"] = "z",
	["𐌇"] = "h",
	["𐌊"] = "k",
	["𐌋"] = "l",
	["𐌌"] = "m",
	["𐌍"] = "n",
	["𐌐"] = "p",
	["𐌓"] = "r",
	["𐌔"] = "s",
	["𐌕"] = "t",
	["𐌚"] = "f"
}

function export.tr(text, lang, sc)
	-- If the script is given as Latn, do not transliterate
	if sc == "Latn" then
		return text
	end
	
	for regex, repl in pairs(tt) do
		text = mw.ustring.gsub(text, regex, repl)
	end
	
	return text
end

return export