This module will transliterate Tsakhur 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:tkr-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 gsub = mw.ustring.gsub
local u = require("Module:string utilities").char
local export = {}
function export.tr(text, lang, sc)
if sc ~= "Cyrl" then
return nil
end
-- Convert capital to lowercase palochka. Lowercase is found in tables.
text = gsub(text, u(0x4C0), u(0x4CF))
-- Digraphs with soft and hard sign.
text = gsub(text, "()х()", "%1%2:")
text = gsub(text, "", {
="h", ="H",
="ʁ", ="ʁ",
="qӏ", ="Qӏ",
="q:", ="Q:",
="x", ="X",
="q", ="Q",
})
-- Дж and гӏ digraphs.
text = gsub(gsub(text, "дж", "ǯ"), "Дж", "Ǯ")
text = gsub(gsub(text, "гӏ", "ɣ"), "Гӏ", "Ɣ")
-- Geminate consonants.
text = gsub(text, "", {
="п:", ="П:",
="т:", ="Т:",
="ц:", ="Ц:",
="ч:", ="Ч:",
="к:", ="К:",
="с:", ="С:",
="х:", ="Х:",
})
-- General consonants.
text = gsub(text, "", {
="p", ="P",
="t", ="T",
="c", ="C",
="č", ="Č",
="k", ="K",
="s", ="S",
="š", ="Š",
="š:", ="Š:",
="ꭓ", ="Ꭓ",
="n", ="N",
="l", ="L",
="d", ="D",
="z", ="Z",
="ž", ="Ž",
="g", ="G",
="ʔ", ="ʔ",
="b", ="B",
="f", ="F",
="m", ="M",
="r", ="R",
="v", ="V",
})
-- Palatised consonants.
text = gsub(text, "(ӏ?)(:?)()", function (con, gem, vow)
return con .. "ʲ" .. gem .. (({ ="о", ="у", ="a" }) or vow)
end)
-- Rounded consonants.
text = gsub(text, "(ӏ?:?)v", "%1ʷ")
-- Iotated е.
text = gsub(text, "%fе", "je")
text = gsub(text, "%fЕ", "Je")
-- Ejective consonants.
text = gsub(text, "ӏ", {
="ṗ", ="Ṗ",
="ṭ", ="Ṭ",
="c̣", ="C̣",
="č̣", ="Č̣",
="ḳ", ="Ḳ",
="q̇", ="Q̇",
})
-- Umlaut vowels.
text = gsub(text, "ь", {
="ä", ="Ä",
="ö", ="Ö",
="ü", ="Ü",
})
-- Glottalised vowels.
text = gsub(text, "()ӏ", "%1ˤ")
-- Long и.
text = gsub(gsub(text, "ий", "ī"), "Ий", "Ī")
-- General vowels.
text = gsub(text, "", {
="j", ="J",
="i", ="I",
="e", ="E",
="e", ="E",
="a", ="A",
="ɨ", ="Ɨ",
="o", ="O",
="u", ="U",
="ju", ="Ju",
="ja", ="Ja",
="jo", ="Jo",
="ʲ",
})
return text
end
return export