This module will transliterate Karata 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:kpt-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 u = require("Module:string/char")
local export = {}
local mapping1 = {
= "p", = "b",
= "t", = "d",
= "k", = "g",
= "c", = "č",
= "s", = "z",
= "š", = "ž",
= "x", = "šš",
= "m", = "n",
= "r", = "l",
= "v", = "j",
= "i", = "e",
= "e", = "a",
= "o", = "u",
= "ʾ", = "ʾ",
= "̃", = "ʾ",
}
local mapping2 = {
= "ṗ", = "ṭ",
= "ḳ", = "qq",
= "ǯ", = "c̣",
= "ƛ", = "ƛ̣ƛ̣",
= "č̣", = "q̇q̇",
= "λ", = "ġ",
= "ḥ", = "ʕ",
= "h", = "ç",
= "ƛ̣",
= "ã", = "ẽ",
= "ĩ", = "õ",
= "ũ",
= "aa", = "ee",
= "ii", = "oo",
= "uu",
= "ãã", = "ẽẽ",
}
function export.tr(text, lang, sc)
local str_gsub = string.gsub
local UTF8_char = "*"
-- Convert capital to lowercase palochka.
text = str_gsub(text, u(0x4C0), u(0x4CF))
for pat, repl in pairs(mapping2) do
text = str_gsub(text, pat, repl)
end
text = str_gsub(text, UTF8_char, mapping1)
return text
end
return export