Zum Inhalt springen

Modul:tab-translit

Vun Wiktionary

This module will transliterate Tabassaran text per WT:TAB TR through the function tr.


--[[
Transliteration for the Tabassaran language.
]]
local M={}
 
local tt={
 
    ["б"]="b", ["п"]="p", ["ф"]="f", ["в"]="v", ["м"]="m",
    ["д"]="d", ["т"]="t", ["й"]="j", ["н"]="n", ["з"]="z", ["ц"]="c",
    ["с"]="s", ["ж"]="ž", ["ш"]="š", ["щ"]="šč", 
    ["л"]="l", ["ч"]="č", ["р"]="r", ["г"]="g", ["к"]="k", ["х"]="χ", 
    ["ъ"]="ʾ", ["а"]="a", ["е"]="e", ["ы"]="y", ["и"]="i", ["о"]="o", ["у"]="u", 
    ["ё"]="ë", ["ь"]="’", ["э"]="e", ["ю"]="ju", ["я"]="ja",
    ["Б"]="B", ["П"]="P", ["Ф"]="F", ["В"]="V", ["М"]="M",
    ["Д"]="D", ["Т"]="T", ["Й"]="J", ["Н"]="N", ["З"]="Z", ["Ц"]="C",
    ["С"]="S", ["Ж"]="Ž", ["Ш"]="Š", ["Щ"]="Šč", 
    ["Л"]="L", ["Ч"]="Č", ["Р"]="R", ["Г"]="G", ["К"]="K", ["Х"]="Χ", 
    ["Ъ"]="ʾ", ["А"]="A", ["Е"]="E", ["Ы"]="Y", ["И"]="I", ["О"]="O", ["У"]="U", 
    ["Ё"]="Ë", ["Ь"]="’", ["Э"]="E", ["Ю"]="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, 'хъв', 'q°')
    f = mw.ustring.gsub(f, 'Хъв', 'Q°')
    f = mw.ustring.gsub(f, 'къв', 'q̄°')
    f = mw.ustring.gsub(f, 'Къв', 'Q̄°')
    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, 'ккв', 'k̄°')
    f = mw.ustring.gsub(f, 'Ккв', 'K̄°')
    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, 'жъ', 'č̄°')
    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, 'Шв', 'Š°')
    f = mw.ustring.gsub(f, 'хв', 'χ°')
    f = mw.ustring.gsub(f, 'Хв', 'Χ°')
    f = mw.ustring.gsub(f, 'пп', 'p̄')
    f = mw.ustring.gsub(f, 'пӏ', 'ṗ')
    f = mw.ustring.gsub(f, 'тт', 't̄') 
    f = mw.ustring.gsub(f, 'Пп', 'P̄')
    f = mw.ustring.gsub(f, 'Пӏ', 'Ṗ')
    f = mw.ustring.gsub(f, 'Тт', 'T̄')
    f = mw.ustring.gsub(f, 'цӏ', 'c̣')
    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, 'кь', 'q̇')
    f = mw.ustring.gsub(f, 'кк', 'k̄')
    f = mw.ustring.gsub(f, 'кӏ', 'ḳ')
    f = mw.ustring.gsub(f, 'хъ', 'q')
    f = mw.ustring.gsub(f, 'къ', 'q̄')
    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, 'Чч', 'Č̄')
    f = mw.ustring.gsub(f, 'Чӏ', 'Č̣')
    f = mw.ustring.gsub(f, 'Кь', 'Q̇')
    f = mw.ustring.gsub(f, 'Кк', 'K̄')
    f = mw.ustring.gsub(f, 'Кӏ', 'Ḳ')
    f = mw.ustring.gsub(f, 'Хъ', 'Q')
    f = mw.ustring.gsub(f, 'Къ', 'Q̄')
    f = mw.ustring.gsub(f, 'Гъ', 'Ġ')
    f = mw.ustring.gsub(f, 'Гь', 'H')
    f = mw.ustring.gsub(f, 'уь', 'u̱')
    f = mw.ustring.gsub(f, 'Уь', 'U̱')
    f = mw.ustring.gsub(f, 'хь', 'x')
    f = mw.ustring.gsub(f, 'Хь', 'X')
    f = mw.ustring.gsub(f, 'гв', 'g°')
    f = mw.ustring.gsub(f, 'Гв', 'G°')
    f = mw.ustring.gsub(f, 'кв', 'k°')
    f = mw.ustring.gsub(f, 'Кв', 'K°')
    f = mw.ustring.gsub(f, 'аь', 'a̱')
    f = mw.ustring.gsub(f, 'Аь', 'A̱')
    f = mw.ustring.gsub(f, '.', tt)
    return f
end
return M