Module:Modi-translit

local export = {}

local consonants = {
	['๐‘˜Ž']='k', ['๐‘˜']='kh', ['๐‘˜']='g', ['๐‘˜‘']='gh', ['๐‘˜’']='แน…',
	['๐‘˜“']='c', ['๐‘˜”']='ch', ['๐‘˜•']='j', ['๐‘˜–']='jh', ['๐‘˜—']='รฑ', 
	['๐‘˜˜']='แนญ', ['๐‘˜™']='แนญh', ['๐‘˜š']='แธ', ['๐‘˜›']='แธh', ['๐‘˜œ']='แน‡', 
	['๐‘˜']='t', ['๐‘˜ž']='th', ['๐‘˜Ÿ']='d', ['๐‘˜ ']='dh', ['๐‘˜ก']='n', 
	['๐‘˜ข']='p', ['๐‘˜ฃ']='ph', ['๐‘˜ค']='b', ['๐‘˜ฅ']='bh', ['๐‘˜ฆ']='m',
	['๐‘˜ง']='y', ['๐‘˜จ']='r', ['๐‘˜ฉ']='l', ['๐‘˜ช']='v', ['๐‘˜ฏ']='แธท',
	['๐‘˜ซ']='ล›', ['๐‘˜ฌ']='แนฃ', ['๐‘˜ญ']='s', ['๐‘˜ฎ']='h',
}

local diacritics = {
	['๐‘˜ฐ']='ฤ', ['๐‘˜ฑ']='i', ['๐‘˜ฒ']='ฤซ', ['๐‘˜ณ']='u', ['๐‘˜ด']='ลซ', ['๐‘˜ต']='แน›', ['๐‘˜ถ']='แน', 
	['๐‘˜ท']='แธท', ['๐‘˜ธ']='แธน', ['๐‘˜น']='e', ['๐‘˜บ']='ai', ['๐‘˜ป']='o', ['๐‘˜ผ']='au',
	-- virama
	['๐‘˜ฟ'] = '',
}

local tt = {
	-- vowel signs
	['๐‘˜€'] = 'a', ['๐‘˜‚'] = 'i', ['๐‘˜„'] = 'u', ['๐‘˜Š'] = 'e', ['๐‘˜Œ'] = 'o',
	['๐‘˜'] = 'ฤ', ['๐‘˜ƒ'] = 'ฤซ', ['๐‘˜…'] = 'ลซ', 
	['๐‘˜†'] = 'ล•', 
	['๐‘˜‹'] = 'ai', ['๐‘˜'] = 'au', 
	['๐‘˜๐‘™€'] = 'ล',
	['๐‘˜€๐‘™€'] = 'ฤ•', ['๐‘˜Š๐‘™€'] = 'ฤ•',
	-- anusvara
	['๐‘˜ฝ'] = 'แน',
	-- visarga
	['๐‘˜พ'] = 'แธฅ',
	-- numerals
	['๐‘™'] = '0', ['๐‘™‘'] = '1', ['๐‘™’'] = '2', ['๐‘™“'] = '3', ['๐‘™”'] = '4', ['๐‘™•'] = '5', ['๐‘™–'] = '6', ['๐‘™—'] = '7', ['๐‘™˜'] = '8', ['๐‘™™'] = '9',
	--punctuation        
	['๐‘™'] = '.', -- danda
	['๐‘™‚'] = '.', -- double danda
	['+'] = '', -- compound separator
	
	-- abbreviation sign
	['๐‘™ƒ'] = '.',
    --Om
    ['เฅ']='oแนƒ',
}

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(
		text,
		'([๐‘˜Ž๐‘˜๐‘˜๐‘˜‘๐‘˜’๐‘˜“๐‘˜”๐‘˜•๐‘˜–๐‘˜—๐‘˜˜๐‘˜™๐‘˜š๐‘˜›๐‘˜œ๐‘˜๐‘˜ž๐‘˜Ÿ๐‘˜ ๐‘˜ก๐‘˜ข๐‘˜ฃ๐‘˜ค๐‘˜ฅ๐‘˜ฆ๐‘˜ง๐‘˜จ๐‘˜ฉ๐‘˜ช๐‘˜ฏ๐‘˜ซ๐‘˜ฌ๐‘˜ญ๐‘˜ฎ])'..
		'([๐‘˜ฐ๐‘˜ฑ๐‘˜ฒ๐‘˜ณ๐‘˜ด๐‘˜ต๐‘˜ถ๐‘˜ท๐‘˜ธ๐‘˜น๐‘˜บ๐‘˜ป๐‘˜ผ๐‘˜ฟ]?)',
		function(c, d)
			if d == "" then        
				return consonants[c] .. 'a'
			else
				return consonants[c] .. diacritics[d]
			end
		end)

	text = mw.ustring.gsub(text, '.[๐‘™€]?', tt)
	
	return text
end
 
return export