模組:Deva-Tirh-translit


This module will transliterate text in the 天城文. The module should preferably not be called directly from templates or other modules. To use it from a template, use {{xlit}}. Within a module, use Module:languages#Language:transliterate.

For testcases, see Module:Deva-Tirh-translit/testcases.

Functions

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

local export = {}

local conv = {
	['क']='𑒏', ['ख']='𑒐', ['ग']='𑒑', ['घ']='𑒒', ['ङ']='𑒓',
	['च']='𑒔', ['छ']='𑒕', ['ज']='𑒖', ['झ']='𑒗', ['ञ']='𑒘', 
	['ट']='𑒙', ['ठ']='𑒚', ['ड']='𑒛', ['ढ']='𑒜', ['ण']='𑒝',
	['त']='𑒞', ['थ']='𑒟', ['द']='𑒠', ['ध']='𑒡', ['न']='𑒢', 
	['प']='𑒣', ['फ']='𑒤', ['ब']='𑒥', ['भ']='𑒦', ['म']='𑒧',
	['य']='𑒨', ['र']='𑒩', ['ल']='𑒪', ['व']='𑒫', ['ळ']='𑒪𑓃',
	['श']='𑒬', ['ष']='𑒭', ['स']='𑒮', ['ह']='𑒯',

	['ा']='𑒰', ['ि']='𑒱', ['ी']='𑒱', ['ु']='𑒳', ['ू']='𑒴', ['ृ']='𑒵', ['ॄ']='𑒶',
	['ॢ']='𑒷', ['ॣ']='𑒸', ['े']='𑒹', ['ै']='𑒻', ['ो']='𑒼', ['ौ']='𑒾',  ['्']='𑓂', ['़']='𑓃',

	-- vowels
	['अ']='𑒁', ['आ']='𑒂', ['इ']='𑒃', ['ई']='𑒄', ['उ']='𑒅', ['ऊ']='𑒆', ['ऋ']='𑒇', ['ॠ']='𑒈',
	['ऌ']='𑒉', ['ॡ']='𑒊', ['ए']='𑒋', ['ऐ']='𑒌', ['ओ']='𑒍', ['औ']='𑒎', 
	-- chandrabindu    
	['ँ']='𑒿',
	-- anusvara    
	['ं']='𑓀',
	-- visarga    
	['ः']='𑓁',
	-- avagraha
	['']='𑓄',
	--punctuation
	['॰']='𑓆'      ,
    ['॥']='॥',
	['।']='।',
	['ॐ']='𑓇'
}

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(
		text,
		".",
		function(c)
			return conv[c]
		end)

	return text
end
 
return export