This module will transliterate Khitan language text.
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:zkt-translit/testcases.
tr(text, lang, sc)
text
written in the script specified by the code sc
, and language specified by the code lang
.nil
.local export = {}
local data = mw.loadData("Module:zkt-translit/data")
function export.tr(text, lang, sc)
-- Remove text formatting.
text = text:gsub("\244", "")
local trtab = {}
i = 0
for char in mw.ustring.gmatch(text, ".") do
i = i + 1
if char == "𘬀" and i > 1 then
table.insert(trtab, trtab)
else
table.insert(trtab, data or "?")
end
end
local check = table.concat(trtab)
_, count = mw.ustring.gsub(check, "?", "")
if count == mw.ustring.len(check) then
return nil
else
return "*" .. table.concat(trtab, " ")
end
end
return export