Module:tg-translit: difference between revisions

From Wiktionary, the free dictionary
Jump to navigation Jump to search
Content deleted Content added
not needed for Tajik
Dijan (talk | contribs)
mNo edit summary
Line 12: Line 12:
["м"]="m",['М']='M', ["о"]="o",['О']='O', ["и"]="i",['И']='I', ["ё"]="yo",['Ё']='Yo', ["ж"]="ž",['Ж']='Ž',
["м"]="m",['М']='M', ["о"]="o",['О']='O', ["и"]="i",['И']='I', ["ё"]="yo",['Ё']='Yo', ["ж"]="ž",['Ж']='Ž',
["к"]="k",['К']='K', ["д"]="d",['Д']='D', ["в"]="v",['В']='V', ["ц"]="ts",['Ц']='Ts', ["а"]="a",['А']='A',
["к"]="k",['К']='K', ["д"]="d",['Д']='D', ["в"]="v",['В']='V', ["ц"]="ts",['Ц']='Ts', ["а"]="a",['А']='A',
["ҷ"]="j",['Ҷ']='J', ["ӯ"]="ū",['Ӯ']='Ū', ["э"]="e",['Э']='E', ["ӣ"]="ī",['Ӣ']='Ī', ["қ"]="q",['Қ']="Q",
["ҷ"]="j",['Ҷ']='J', ["ӯ"]="ü",['Ӯ']='Ü', ["э"]="e",['Э']='E', ["ӣ"]="ī",['Ӣ']='Ī', ["қ"]="q",['Қ']="Q",
["ғ"]="ġ",['Ғ']='Ġ', ["і"]="i",['І']='I'
["ғ"]="ġ",['Ғ']='Ġ', ["і"]="i",['І']='I'
};
};

Revision as of 20:35, 17 April 2013

This module will transliterate Tajik language text per WT:TG TR. It is also used to transliterate Wakhi and Yagnobi. 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:tg-translit/testcases.

Functions

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

--[[
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', ["ц"]="ts",['Ц']='Ts', ["а"]="a",['А']='A',
    ["ҷ"]="j",['Ҷ']='J',   ["ӯ"]="ü",['Ӯ']='Ü', ["э"]="e",['Э']='E', ["ӣ"]="ī",['Ӣ']='Ī', ["қ"]="q",['Қ']="Q",
    ["ғ"]="ġ",['Ғ']='Ġ',   ["і"]="i",['І']='I'
};
function M.tr(f)--translit any words or phrases
    return (mw.ustring.gsub(f.args[1], '.', tt))
end
return M