မာတိကာသို့ ခုန်သွားရန်

မဝ်ဂျူ:Mult-translit

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:Mult-translit/doc

local export = {}
 
local consonants = {
	['𑊄']='k', ['𑊅']='kh', ['𑊆']='g', ['𑊈']='gh', 
	['𑊊']='c', ['𑊋']='ch', ['𑊌']='j', ['𑊏']='ñ', 
	['𑊐']='ṭ', ['𑊑']='ṭh', ['𑊒']='ḍ', ['𑊔']='ḍh', ['𑊕']='ṇ', 
	['𑊖']='t', ['𑊗']='th', ['𑊘']='d', ['𑊙']='dh', ['𑊚']='n', 
	['𑊛']='p', ['𑊜']='ph', ['𑊝']='b', ['𑊟']='bh', ['𑊠']='m', 
	['𑊡']='y', ['𑊢']='r', ['𑊣']='l', ['𑊤']='v',
	['𑊥']='s', ['𑊦']='h', 
	['𑊍']='ǰ', ['𑊓']='ḏ', ['𑊧'] = 'ṛ', ['𑊨'] = 'ṛh', 
}

local nonconsonants = {
	-- vowels
	['𑊀']='a', ['𑊁']='i', ['𑊂']='u', ['𑊃']='e', 

	-- other symbols
	['𑊩']='.', -- section mark

	-- digits
	['੦'] = '0', ['੧'] = '1', ['੨'] = '2', ['੩'] = '3', ['੪'] = '4',
	['੫'] = '5', ['੬'] = '6', ['੭'] = '7', ['੮'] = '8', ['੯'] = '9',
}

-- translit any words or phrases
function export.tr(text, lang, sc)
	text = mw.ustring.gsub(
		text,
		'([𑊄𑊅𑊆𑊈𑊊𑊋𑊌𑊏𑊐𑊑𑊒𑊔𑊕𑊖𑊗𑊘𑊙𑊚𑊛𑊜𑊝𑊟𑊠𑊡𑊢𑊣𑊤𑊥𑊦𑊍𑊓𑊧𑊨])',
		function(c, d)
			-- mw.log('match', c, d)
			return (consonants[c] or c)
		end)
	
	text = mw.ustring.gsub(text, '.', nonconsonants)
	
	return text
end
 
return export