Module:Tg-translit
Appearance
--[[
Transliteration for Tajik.
]]
local M={}
local tt={
["т"]="t",['Т']='T', ["р"]="r",['Р']='R', ["ф"]="f",['Ф']='F',
["ю"]="yu",['Ю']='Yu', ["ш"]="š",['Ш']='Š', ["ҳ"]="h",['Ҳ']='H', ["ъ"]="ʾ",['Ъ']='ʾ', ["н"]="n",['Н']='N',
["п"]="p",['П']='P', ["й"]="y",['Й']='Y', ["л"]="l",['Л']='L', ["з"]="z",['З']='Z', ["е"]="e",['Е']='E',
["г"]="g",['Г']='G', ["б"]="b",['Б']='B', ["у"]="u",['У']='U', ["с"]="s",['С']='S', ["х"]="x",['Х']='X',
["ч"]="č",['Ч']='Č', ["я"]="ya",['Я']='Ya',
["м"]="m",['М']='M', ["о"]="o",['О']='O', ["и"]="i",['И']='I', ["ё"]="yo",['Ё']='Yo', ["ж"]="ž",['Ж']='Ž',
["к"]="k",['К']='K', ["д"]="d",['Д']='D', ["в"]="v",['В']='V', ["а"]="a",['А']='A', ["ҷ"]="j",['Ҷ']='J',
["ӯ"]="ü",['Ӯ']='Ü', ["э"]="e",['Э']='E', ["ӣ"]="ī",['Ӣ']='Ī', ["қ"]="q",['Қ']="Q", ["ғ"]="ġ",['Ғ']='Ġ',
["і"]="i",['І']='I'
};
function M.tr(f)--translit any words or phrases
if type(f) == 'table' then f= f.args[1] end
f = mw.ustring.gsub(
f, "([АОУЕЯЁЮИӢЕЪаоуэяёюиӣе][́̀]?)([ЕеИиӢӣ])", function(a, e)
if e == 'е' then e = 'ye' end
if e == 'Е' then e = 'Ye' end
if e == 'и' then e = 'yi' end
if e == 'И' then e = 'Yi' end
if e == 'ӣ' then e = 'yī' end
if e == 'Ӣ' then e = 'Yī' end
return a .. e
end
):gsub("^Е",'Ye'):gsub("^е",'ye');
return (mw.ustring.gsub(f, '.', tt))
end
return M