Modul:lbe-translit

Vun Wiktionary

This module will transliterate Lak text per WT:LBE TR through the function tr.


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