Module:User:SodhakSH/Deva-Knda

This is a private module sandbox of SodhakSH, for his own experimentation. Items in this module may be added and removed at SodhakSH's discretion; do not rely on this module's stability.


local export = {}
local gsub = mw.ustring.gsub
local match = mw.ustring.match
local sub = mw.ustring.sub

local conv = {
	["क"] = "ಕ", ["ख"] = "ಖ", ["ग"] = "ಗ", ["घ"] = "ಘ", ["ङ"] = "ಙ", 
	["च"] = "ಚ", ["छ"] = "ಛ", ["ज"] = "ಜ", ["झ"] = "ಝ", ["ञ"] = "ಞ", 
	["ट"] = "ಟ", ["ठ"] = "ಠ", ["ड"] = "ಡ", ["ढ"] = "ಢ", ["ण"] = "ಣ", 
	["त"] = "ತ", ["थ"] = "ಥ", ["द"] = "ದ", ["ध"] = "ಧ", ["न"] = "ನ", 
	["प"] = "ಪ", ["फ"] = "ಫ", ["ब"] = "ಬ", ["भ"] = "ಭ", ["म"] = "ಮ", 
	["य"] = "ಯ", ["र"] = "ರ", ["ल"] = "ಲ", ["व"] = "ವ", ["ळ"] = "ಳ", 
	["श"] = "ಶ", ["ष"] ="ಷ", ["स"] = "ಸ", ["ह"] = "ಹ",
	["य़"] = "ಯ಼",

	["ा"] = "ಾ", ["ि"] = "ಿ", ["ी"] = "ೀ", ["ु"] = "ು", ["ू"] = "ೂ", ["ृ"] = "ೃ", ["ॄ"] = "ೄ", 
	["ॢ"] = "ೢ", ["ॣ"] = "ೣ", ["ॆ"] = "ೆ", ["े"] = "ೇ", ["ै"] = "ೈ", ["ॊ"] = "ೊ", ["ो"] = "ೋ", ["ौ"] = "ೌ",  ["्"] = "್",
	
	-- vowels
	["अ"] = "ಅ", ["आ"] = "ಆ", ["इ"] = "ಇ", ["ई"] = "ಈ", ["उ"] = "ಉ", ["ऊ"] = "ಊ", ["ऋ"] = "ಋ", ["ॠ"] = "ೠ",
	["ऌ"] = "ಌ", ["ॡ"] = "ೡ", ["ऎ"] = "ಎ", ["ए"] = "ಏ", ["ऐ"] = "ಐ", ["ओ"] = "ಓ", ["ऒ"] = "ಒ", ["औ"] = "ಔ",
	
	-- chandrabindu 
	["ँ"] = "ঁ", 
	-- anusvara 
	["ं"] = "ಂ", 
	-- visarga 
	["ः"] = "ಃ", 
	-- avagraha
	["ऽ"] = "ಽ",
	--punctuation
	["॥"] = "॥", 
	["।"] = "।",
	["ॐ"] = "ಓಂ",
	["*"] = "*",

 	--Vedic extensions
	["ᳵ"] = "ೱ", ["ᳶ"] = "ೲ",

		["०"] = "೦", ["१"] = "೧", ["२"] = "೨", ["३"] = "೩", ["४"] = "೪", ["५"] = "೫", ["६"] = "೬", ["७"] = "೭", ["८"] = "೮", ["९"] = "೯",

}

function export.tr(text, lang, sc)
	text = mw.ustring.gsub(
		text,
		".़?",
		function(c)
			return conv[c]
		end)
        --text = mw.ustring.gsub(text, '𑑄$', "𑑈")
	return text
end
 
return export