မာတိကာသို့ ခုန်သွားရန်

မဝ်ဂျူ:Deva-Brah-translit

နူ ဝိက်ရှေန်နရဳ

Documentation for this module may be created at မဝ်ဂျူ:Deva-Brah-translit/doc

local export = {}

local char = {
	["क"] = "𑀓", ["ख"] = "𑀔", ["ग"] = "𑀕", ["घ"] = "𑀖", ["ङ"] = "𑀗", ["च"] = "𑀘", ["छ"] = "𑀙", ["ज"] = "𑀚", ["झ"] = "𑀛", ["ञ"] = "𑀜", ["ट"] = "𑀝", ["ठ"] = "𑀞", ["ड"] = "𑀟", ["ढ"] = "𑀠", ["ण"] = "𑀡", ["त"] = "𑀢", ["थ"] = "𑀣", ["द"] = "𑀤", ["ध"] = "𑀥", ["न"] = "𑀦", ["ऩ"] = "𑀷", ["प"] = "𑀧", ["फ"] = "𑀨", ["ब"] = "𑀩", ["भ"] = "𑀪", ["म"] = "𑀫", ["य"] = "𑀬", ["र"] = "𑀭", ["ऱ"] = "𑀶", ["ल"] = "𑀮", ["ळ"] = "𑀴", ["ऴ"] = "𑀵", ["व"] = "𑀯", ["श"] = "𑀰", ["ष"] = "𑀱", ["स"] = "𑀲", ["ह"] = "𑀳",
	["अ"] = "𑀅", ["आ"] = "𑀆", ["इ"] = "𑀇", ["ई"] = "𑀈", ["उ"] = "𑀉", ["ऊ"] = "𑀊", ["ऋ"] = "𑀋", ["ॠ"] = "𑀌", ["ऌ"] = "𑀍", ["ॡ"] = "𑀎", ["ऎ"] = "𑁱", ["ए"] = "𑀏", ["ऐ"] = "𑀐", ["ऒ"] = "𑁲", ["ओ"] = "𑀑", ["औ"] = "𑀒",
	["ा"] = "𑀸", ["ि"] = "𑀺", ["ी"] = "𑀻", ["ु"] = "𑀼", ["ू"] = "𑀽", ["ृ"] = "𑀾", ["ॄ"] = "𑀿", ["ॢ"] = "𑁀", ["ॣ"] = "𑁁", ["ॆ"] = "𑁳", ["े"] = "𑁂", ["ै"] = "𑁃", ["ॊ"] = "𑁴", ["ो"] = "𑁄", ["ौ"] = "𑁅", ["्"] = "𑁆",
	["ं"] = "𑀁", ["ः"] = "𑀂", ["ँ"] = "𑀀", ["ᳵ"] = "𑀃", ["ᳶ"] = "𑀄", ["ऽ"] = "", ["ॐ"] = "𑀑𑀁", ["।"] = "𑁇", ["॥"] = "𑁈",
	["०"] = "𑁦", ["१"] = "𑁧", ["२"] = "𑁨", ["३"] = "𑁩", ["४"] = "𑁪", ["५"] = "𑁫", ["६"] = "𑁬", ["७"] = "𑁭", ["८"] = "𑁮", ["९"] = "𑁯"
}

-- Override returns text even if some characters cannot be transliterated.
function export.tr(text, lang, sc, override)
	local UTF8_char = "[%z\1-\127\194-\244][\128-\191]*"
	local Brah = require("Module:scripts").getByCode("Brah")
	
	text = string.gsub(text, UTF8_char, char)
	
	local reducedText = mw.ustring.gsub(mw.ustring.gsub(text, "<.->", ""), "[%s%p\n]+", "")
	if mw.ustring.len(reducedText) == Brah:countCharacters(reducedText) or override then
		return text
	else
		return nil
	end
end

return export