বিষয়বস্তুতে চলুন

মডিউল:te-translit

উইকিঅভিধান, মুক্ত অভিধান থেকে

এই মডিউলের জন্য মডিউল:te-translit/নথি-এ নথিপত্র তৈরি করা হয়ে থাকতে পারে

local export = {}
 
local consonants = {
	['క']='ক' , ['ఖ']='খ' , ['గ']='গ' , ['ఘ']='ঘ' , ['ఙ']='ঙ' , 
	['చ']='চ' , ['ఛ']='ছ' , ['జ']='জ' , ['ఝ']='ঝ' , ['ఞ']='ঞ' , 
	['ట']='ট' , ['ఠ']='ঠ' , ['డ']='ড' , ['ఢ']='ঢ' , ['ణ']='ণ' , 
	['త']='ত' ,  ['థ']='থ' , ['ద']='দ' , ['ధ']='ধ' , ['న']='ন' ,
	['ప']='প' , ['ఫ']='ফ' , ['బ']='ব' , ['భ']='ভ' , ['మ']='ম' , 
	['య']='য়' , ['ర']='র' , ['ల']='ল' , ['వ']='ৱ' ,  ['ళ']='ল়' ,
	['శ']='শ' , ['ష']='ষ' , ['స']='স' , ['హ']='হ' , ['ఱ']='র়' ,
	['ఴ']='ল়়' , ['ౘ']='ৎস' , ['ౙ']='দ্জ়' , ['ౚ']='ড়' ,
}

local diacritics = {
	['ా']= 'া' , ['ి']='ি' , ['ీ']='ী' , ['ు']='ু' , ['ూ']='ূ' , ['ృ']='ৃ' , ['ౄ']='ৄ' ,
	['ౢ']='ৢ' , ['ౣ']='ৣ' , ['ె']='ে' , ['ే']='ে' , ['ై']='ৈ' , ['ొ']='ো' , ['ో']='ো' ,
	['ౌ']='ৌ'  , ['్']='্' ,
}
local tt = {
	-- vowels
	['అ']='অ' , ['ఆ']='আ' , ['ఇ']='ই' , ['ఈ']='ঈ' , ['ఉ']='উ' , ['ఊ']='ঊ' , 
	['ఋ']='ঋ' , ['ౠ']='ৠ' , ['ఌ']='ঌ' , ['ౡ']='ৡ', ['ఎ']='এ' , ['ఏ']='এ়' ,
	['ఐ']='ঐ' , ['ఒ']='ও' , ['ఓ']='ও়' , ['ఔ']='ঔ' ,
	-- other symbols
	['ం']='ং',-- anusvara
	['ః']='ঃ' ,  -- visarga
	['ఁ']='ঁ' , -- candrabindu/arthanusvāra/aranusa
	['ఀ']='ঁ' , -- combining candrabindu
	['ఽ']='ঽ' , -- avagraha
-- digits
	['౦'] = '০', ['౧'] = '১', ['౨'] = '২', ['౩'] = '৩', ['౪'] = '৪',
	['౫'] = '৫', ['౬'] = '৬', ['౭'] = '৭', ['౮'] = '৮', ['౯']= '৯',
	['౸']='০/৪', ['౹']='১/৪', ['౺']='২/৪', ['౻']='৩/৪', 
	['౦']='০/১৬', ['౼']='১/১৬', ['౽']='২/১৬', ['౾']='৩/১৬' ,
}

-- translit any words or phrases
function export.tr(text, lang, sc)
	text = mw.ustring.gsub(
		text,
		'([కఖగఘఙచఛజఝఞటఠడఢణతథదధనపఫబభమయరలవళశషసహఱఴౘౙౚ])'..
		'([ాిీుూృ̥ౄ̥̄ెేైొోౌ్]?)',
		function(c, d)
			if d == "" then        
				return consonants[c]
			else
				return consonants[c] .. diacritics[d]
			end
		end)
	
	text = mw.ustring.gsub(text, '.', tt)

	text = mw.ustring.gsub(text, 'ত্$', 'ৎ')
	
	-- anusvara
	text = mw.ustring.gsub(text, 'ং([কখগঘঙ])', 'ঙ্%1')
	text = mw.ustring.gsub(text, 'ং([চছজঝঞ])', 'ঞ্%1')
	text = mw.ustring.gsub(text, 'ং([টঠডঢণ])', 'ণ্%1')
	text = mw.ustring.gsub(text, 'ং([তথদধন])', 'ন্%1')
	text = mw.ustring.gsub(text, 'ং([পফবভম])', 'ম্%1')
	
	return text
end
 
return export