Zum Inhalt springen

Modul:av-translit

Vun Wiktionary

This module will transliterate Avar text per WT:AV TR through the function tr.


--[[
Transliteration for the Avar language.
]]
local M={}
 
local tt={
 
    ["б"]="b", ["п"]="p", ["ф"]="f", ["в"]="w", ["м"]="m",
    ["д"]="d", ["т"]="t", ["й"]="j", ["н"]="n", ["з"]="z", ["ц"]="c",
    ["с"]="s", ["ж"]="ž", ["ш"]="š", ["щ"]="š̄", 
    ["л"]="l", ["ч"]="č", ["р"]="r", ["г"]="g", ["к"]="k", ["х"]="χ", 
    ["ъ"]="ʾ", ["а"]="a", ["е"]="e", ["ы"]="ə", ["и"]="i", ["о"]="o", ["у"]="u", 
    ["ё"]="ë", ["ь"]="’", ["э"]="è", ["ю"]="ju", ["я"]="ja",
    ["Б"]="B", ["П"]="P", ["Ф"]="F", ["В"]="W", ["М"]="M",
    ["Д"]="D", ["Т"]="T", ["Й"]="J", ["Н"]="N", ["З"]="Z", ["Ц"]="C",
    ["С"]="S", ["Ж"]="Ž", ["Ш"]="Š", ["Щ"]="Š̄", 
    ["Л"]="L", ["Ч"]="Č", ["Р"]="R", ["Г"]="G", ["К"]="K", ["Х"]="Χ", 
    ["Ъ"]="ʾ", ["А"]="A", ["Е"]="E", ["Ы"]="Ə", ["И"]="I", ["О"]="O", ["У"]="U", 
    ["Ё"]="Ë", ["Ь"]="’", ["Э"]="È", ["Ю"]="Ju", ["Я"]="Ja"};
 
function M.tr(f)--translit any words or phrases
    if type(f) == 'table' then f = f.args[1] end
    f = mw.ustring.gsub(f, 'цӏцӏ', 'c̣̄')
    f = mw.ustring.gsub(f, 'чӏчӏ', 'č̣̄')
    f = mw.ustring.gsub(f, 'кӏкӏ', 'ḳ̄')
    f = mw.ustring.gsub(f, 'лълъ', 'ł̄')
    f = mw.ustring.gsub(f, 'Цӏцӏ', 'C̣̄')
    f = mw.ustring.gsub(f, 'Чӏчӏ', 'Č̣̄')
    f = mw.ustring.gsub(f, 'Кӏкӏ', 'Ḳ̄')
    f = mw.ustring.gsub(f, 'Лълъ', 'Ł̄')
    f = mw.ustring.gsub(f, 'цӏ', 'c̣')
    f = mw.ustring.gsub(f, 'цц', 'c̄')
    f = mw.ustring.gsub(f, 'тӏ', 'ṭ')
    f = mw.ustring.gsub(f, 'лӏ', 'kl')
    f = mw.ustring.gsub(f, 'сс', 's̄')
    f = mw.ustring.gsub(f, 'лъ', 'ł')
    f = mw.ustring.gsub(f, 'чч', 'č̄')
    f = mw.ustring.gsub(f, 'чӏ', 'č̣')
    f = mw.ustring.gsub(f, 'кь', 'kḷ')
    f = mw.ustring.gsub(f, 'кк', 'k̄')
    f = mw.ustring.gsub(f, 'кӏ', 'ḳ')
    f = mw.ustring.gsub(f, 'хь', 'x')
    f = mw.ustring.gsub(f, 'хъ', 'q̄')
    f = mw.ustring.gsub(f, 'къ', 'q̇̄')
    f = mw.ustring.gsub(f, 'гъ', 'ġ')
    f = mw.ustring.gsub(f, 'хх', 'χ̄')
    f = mw.ustring.gsub(f, 'гӏ', 'ʿ')
    f = mw.ustring.gsub(f, 'хӏ', 'ḥ')
    f = mw.ustring.gsub(f, 'гь', 'h')
    f = mw.ustring.gsub(f, 'Цӏ', 'C̣')
    f = mw.ustring.gsub(f, 'Цц', 'C̄')
    f = mw.ustring.gsub(f, 'Тӏ', 'Ṭ')
    f = mw.ustring.gsub(f, 'Лӏ', 'Kl')
    f = mw.ustring.gsub(f, 'Сс', 'S̄')
    f = mw.ustring.gsub(f, 'Лъ', 'Ł')
    f = mw.ustring.gsub(f, 'Чч', 'Č̄')
    f = mw.ustring.gsub(f, 'Чӏ', 'Č̣')
    f = mw.ustring.gsub(f, 'Кь', 'Kḷ')
    f = mw.ustring.gsub(f, 'Кк', 'K̄')
    f = mw.ustring.gsub(f, 'Кӏ', 'Ḳ')
    f = mw.ustring.gsub(f, 'Хь', 'X')
    f = mw.ustring.gsub(f, 'Хъ', 'Q̄')
    f = mw.ustring.gsub(f, 'Къ', 'Q̇̄')
    f = mw.ustring.gsub(f, 'Гъ', 'Ġ')
    f = mw.ustring.gsub(f, 'Хх', 'Χ̄')
    f = mw.ustring.gsub(f, 'Гӏ', 'ʿ')
    f = mw.ustring.gsub(f, 'Хӏ', 'Ḥ')
    f = mw.ustring.gsub(f, 'Гь', 'H')
    f = mw.ustring.gsub(f, '.', tt)
    return f
end
return M