This module will transliterate Uzbek 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:uz-Latn-Cyrl-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 tt = {
= "т",
= "Т",
= "р",
= "Р",
= "ф",
= "Ф",
= "ў",
= "Ў",
= "ю",
= "Ю",
= "ш",
= "Ш",
= "н",
= "Н",
= "п",
= "П",
= "у",
= "У",
= "л",
= "Л",
= "з",
= "З",
= "е",
= "Э",
= "Е",
= "г",
= "Г",
= "б",
= "Б",
= "с",
= "С",
= "х",
= "Х",
= "ч",
= "Ч",
= "я",
= "Я",
= "ҳ",
= "Ҳ",
= "Э",
= "м",
= "М",
= "و",
= "و",
= "и",
= "И",
= "ё",
= "Ё",
= "ж",
= "Ж",
= "к",
= "К",
= "д",
= "Д",
= "в",
= "В",
= "с",
= "С",
= "а",
= "А",
= "нг",
= "Нг",
= "қ",
= "Қ",
= "ғ",
= "Ғ"
}
local vowels = "AaEeIiOoUuOʻoʻ"
local consonants = "BbChchDdGgGʻgʻHhJjKkLlMmNnNgngPpRrSsShshTtVvХхYyZz"
function export.tr(text, lang, sc)
if type(text) == "table" then
options = {}
text, script = text.args, text.args
end
if not sc then
sc = require("Module:languages").getByCode("ky"):findBestScript(text):getCode()
end
if sc ~= "Cyrl" then
return nil
end
text =
mw.ustring.gsub(
text,
"(?)()",
function(a, e)
return a .. (e == "е" and "йе" or "Йе")
end
):gsub("^Е", "Йе"):gsub("^е", "йе")
text = mw.ustring.gsub(text, "^()и()()", "%1И%2%3")
text = mw.ustring.gsub(text, "()()и", "%1%2И")
text = mw.ustring.gsub(text, "^и()()", "И%1%2")
text = mw.ustring.gsub(text, "()()()и", "%1%2%3И")
return (mw.ustring.gsub(text, ".", tt))
end
return export