Module:tg-Latn-Cyrl-translit

local export = {text}

local tt = { ["t"] = "т", ["r"] = "р", ["f"] = "ф", ["š"] = "ш", ["h"] = "ҳ", ["ʾ"] = "ъ", ["n"] = "н", ["p"] = "п", ["y"] = "й", ["l"] = "л", ["z"] = "з", ["e"] = "е", ["g"] = "г", ["b"] = "б", ["u"] = "у", ["ü"] = "ӯ", ["s"] = "с", ["x"] = "х", ["č"] = "ч", ["m"] = "м", ["o"] = "о", ["i"] = "и", ["ī"] = "ӣ", ["ž"] = "ж", ["k"] = "к", ["d"] = "д", ["v"] = "в", ["a"] = "а", ["j"] = "ҷ", ["q"] = "қ", ["ġ"] = "ғ", --capital letters -- fa-IPA doesnt support letter case. -- these are here as a precaution ["T"] = "Т", ["R"] = "Р", ["F"] = "Ф", ["Š"] = "Ш", ["H"] = "Ҳ", ["N"] = "Н", ["P"] = "П", ["Y"] = "Й", ["L"] = "Л", ["Z"] = "З", ["E"] = "Е", ["G"] = "Г", ["B"] = "Б", ["U"] = "У", ["Ü"] = "Ӯ", ["S"] = "С", ["X"] = "Х", ["Č"] = "Ч", ["M"] = "М", ["O"] = "О", ["I"] = "И", ["Ī"] = "Ӣ", ["Ž"] = "Ж", ["K"] = "К", ["D"] = "Д", ["V"] = "В", ["A"] = "А", ["J"] = "Ҷ", ["Q"] = "Қ", ["Ġ"] = "Ғ", -- ["ʾ"] = "Ъ" - this cant be uppercase in latin ["ye"] = "e", ["yi"] = "i", ["yī"] = "ī", ["yo"] = "ё", ["yu"] = "ю", ["ya"] = "я", -- uppercase (fa-IPA doesnt support letter case, these are	-- precautionary) ["Ye"] = "Е", ["Yi"] = "I", ["Yī"] = "Ī", ["Yo"] = "Ё", ["Yu"] = "Ю", ["Ya"] = "Я", }

local allchar = "AaBbVvGgĠġDdEeŽžZzIiĪīYyKkQqLlMmNnOoPpCcTtUuÜüFfXxHhČčJjŠšʾ"

function export.tr(text, lang, sc) if type(text) == "table" then options = {} text, script = text.args[1], text.args[2] end

if not sc then sc = require("Module:languages").getByCode("tg"):findBestScript(text):getCode end

if sc ~= "Latn" then return nil end

--initial "e" forms text = mw.ustring.gsub(text, "([^" .. allchar .. "])" .. "e", "%1э") text = mw.ustring.gsub(text, "([^" .. allchar .. "])" .. "E", "%1Э") --tajik orthography uses dashes but NOT the way fa-IPA does --so they need to be removed text = mw.ustring.gsub(text, "%-", "") text = mw.ustring.gsub(text, "[Yy][eiīoua]", tt) text = mw.ustring.gsub(text, ".", tt)

return text end

return export