Module:Deva-Tirh-translit
Jump to navigation
Jump to search
Documentation for this module may be created at Module:Deva-Tirh-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 Tirh = require("Module:scripts").getByCode("Tirh")
text = string.gsub(text, UTF8_char, char)
local reducedText = mw.ustring.gsub(mw.ustring.gsub(text, "<.->", ""), "[%s%p\n]+", "")
if (mw.ustring.len(reducedText) == Tirh:countCharacters(reducedText) and not mw.ustring.find(text, "๐๐")) or override then
return text
else
return nil
end
end
return export