Module:pine-translit

Revision as of 14:07, 21 November 2025 by Sware (talk | contribs)


local export = {}

local tt = {}

-- from Teulgi to Tuġvut font
tt = {
	["-t"] = '_0', ["-"] = '_',
	
	-- Synthetic diphthongs
	["uo"]='aa-', ["ay"]='aa--',
	
	-- Short vowels
	["o"]='u-', ["e"]='i-',
	["y"]='a-', ["ů"]='u--',
	
	-- Geminate vowels
	["ả"]='aa', ["ủ"]='uu',
	["ỏ"]='u-u-', ["ỉ"]='ii',
	["ẻ"]='i-i-', ["ỷ"]='a-a-',
	
	-- m-series
	["bm"]='pm', ["ṃṃ"]='m-m', ["ṃ"]='m-', 
	
	-- n-series
	["ng"]='N-', ["dn"]='t-n', ["tṇ"]='t-n-',
	["nnį"]='n--', ["ṇṇį"]='N',
	["nį"]='n--', ["ṇį"]='N',
	["ṇṇ"]='n-n',
	
	-- v-series
	["v"]='f', -- synthetic <p> has to be manual
	
	-- p-series
	["bb"]='p-p', ["b"]='p-',
	
	-- t-series
	["ḍḍ"]='t--t', ["dd"]='t-t',
	["ḍ"]='t--', ["d"]='t-',
	
	-- ġ-series
	["ḥḥ"]='h--h', ["ġġ"]='g-g',
	["ḥ"]='h--', ["ġ"]='g-',
	["ġf"]='hf',
	["tġv"]='hf--', ["tġ"]='hf-',
	
	-- h-series
	["hhį"]='h-h', ["hį"]='h-',
	
	-- s-series
	["ttṡ"]='c--c', ["tts"]='c-c',
	["tṡ"]='c--', ["ts"]='c-',
	["ṡ"]='c',
	
	-- r-series
	["ṛṛ"]='r-r', ["ṛ"]='r-',
	
	-- l-series
	
	["ḷḷį"]='L--L', ["llį"]='L-L',
	["ḷį"]='L--', ["lį"]='L-',
	["ḷ"]='L', ["ƛ"]='T',

	-- į-series
	["į"]='j',
};

function export.tr(text, lang, sc)
	text = mw.ustring.lower(text)
	
	for pat, repl in pairs(tt) do
        text = mw.ustring.gsub(text, pat, repl)
	end

    return text
end

return export