Module:ks-Deva-translit

Hello, you have come here looking for the meaning of the word Module:ks-Deva-translit. In DICTIOUS you will not only get to know all the dictionary meanings for the word Module:ks-Deva-translit, but we will also tell you about its etymology, its characteristics and you will know how to say Module:ks-Deva-translit in singular and plural. Everything you need to know about the word Module:ks-Deva-translit you have here. The definition of the word Module:ks-Deva-translit will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofModule:ks-Deva-translit, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

This module needs documentation.
Please document this module by describing its purpose and usage on the documentation page.

local export = {}

local consonants = {
	 = 'k',  = 'kh',  = 'g',  = 'ṅ',
	 = 'c',  = 'ch',  = 'j',  = 'ñ',
	 = 'ṭ',  = 'ṭh',  = 'ḍ',  = 'ṇ',
	 = 't',  = 'th',  = 'd',  = 'n',
	 = 'p',  = 'ph',  = 'b',  = 'm',
	 = 'y',  = 'r',  = 'l',  = 'w',
	 = 'ś',  = 'ṣ',  = 's',  = 'h',
	 = 'ċ',  = 'ċh',  = 'z',='f',
	 = 'q',  = 'x',  = 'ġ',
	 = 'bh', --found ocassionally in some Sanskrit loanwords
}

local diacritics = {
	 = 'ā',  = 'ạ',  = 'ạ̄',  = 'ụ',  = 'ụ̄',  = 'i',  = 'ī',  = 'u',  = 'ū',  = 'ṛ',
	 = 'e',  = 'ē',  = 'ai',  = 'o',  = 'ō',  = 'ô',  = 'au',  = '', = 'ạ', ='ạ̄'
}

local tt = {
	-- vowels
	 = 'a',  = 'ā',  = 'ạ',  = 'ạ̄',  = 'ụ',  = 'ụ̄',  = 'i',  = 'ī',  = 'u',  = 'ū',  = 'ṛ',
	 = 'e',  = 'ē',  = 'ai',  = 'o',  = 'ō',  = 'ô',  = 'au',  = 'ạ',	=  'ạ̄',
	--chandrabindu
	 = 'm̐', --until a better method is found
	-- anusvara
	 = 'ṃ', --until a better method is found
	-- visarga
	 = 'ḥ',
	-- avagraha
	 = '’',
	--numerals
	 = '0',  = '1',  = '2',  = '3',  = '4',  = '5',  = '6',  = '7',  = '8',  = '9',
	--punctuation
	 = '.', --danda
	 = '.', --double danda
	 = 'om',
}

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(text, '(.?.?)$', '%1्')
	text = mw.ustring.gsub(text,
		'(़?)' .. --tbd later
				'(?)',
		function(c, d)
			if d == "" then
				return consonants .. 'a'
			else
				return consonants .. diacritics
			end
		end)
	
	text = mw.ustring.gsub(text, '.', tt)
	text = mw.ustring.gsub(text, '्$', '')
	
	return text
end

return export