Module:gon-Gong-translit

local export = {} local gsub = mw.ustring.gsub 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', ['𑶎'] = 'ū', ['𑶐'] = 'ē', ['𑶑'] = 'ai', ['𑶓'] = 'ō', ['𑶔'] = 'au', ['𑶗'] = '', } local tt = { -- vowels ['𑵠'] = 'a', ['𑵡'] ='ā', ['𑵢'] ='i' , ['𑵣'] = 'ī' , ['𑵤'] = 'u' , ['𑵥'] = 'ū' , ['𑵧'] = 'ē', ['𑵨'] ='ai', ['𑵪'] ='ō', ['𑵫'] = 'au', -- other symbols ['𑶕'] = 'ṁ',-- anusvara ['𑶖'] = 'ḥ', -- visarga ['𑶘'] = 'ōm', -- om -- digits ['𑶠'] = '0', ['𑶡'] = '1', ['𑶢'] = '2', ['𑶣'] = '3', ['𑶤'] = '4',	['𑶥'] = '5', ['𑶦'] = '6', ['𑶧'] = '7', ['𑶨'] = '8', ['𑶩'] = '9', }

-- translit any words or phrases function export.tr(text, lang, sc) text = gsub(		text,		'([𑵬𑵭𑵮𑵯𑵰𑵱𑵲𑵳𑵴𑵵𑵶𑵷𑵸𑵹𑵺𑵻𑵼𑵽𑵾𑵿𑶀𑶁𑶂𑶃𑶄𑶅𑶆𑶇𑶈𑶉])'..		'([𑶊𑶋𑶌𑶍𑶎𑶐𑶑𑶓𑶔]?)',		function(c, d)			if d == "" then       				return consonants[c] ..'a'			else				return consonants[c] .. diacritics[d]			end		end) text = gsub(text,'.', tt) -- anusvara text = gsub(text,'ṁ([kgṅ])','ṅ%1') text = gsub(text,'ṁ([cjñ])','ñ%1') text = gsub(text,'ṁ([ṭḍṇ])','ṇ%1') text = gsub(text,'ṁ([tdn])','n%1') text = gsub(text,'ṁ([pbm])','m%1') return text end return export