Modul:ab-translit

Vun Wiktionary

This module will transliterate Abkhaz text per WT:AB TR through the function tr.


--[[
Transliteration for Abkhaz.
]]
local M={}
 
local tt={
 
    ["А"]='Ā', ["а"]='ā', ["Б"]='B', ["б"]='b', ["В"]='V', ["в"]='v', ["Г"]='G', ["г"]='g', 
    ["Ӷ"]='Γ', ["ӷ"]='γ', ["Д"]='D', ["д"]='d', ["Џ"]='Ǯ', ["џ"]='ǯ', ["Е"]='E', ["е"]='e',
    ["Ҽ"]='Č', ["ҽ"]='č', ["Ҿ"]='Č̣', ["ҿ"]='č̣',  ["Ж"]='Ž', ["ж"]='ž', ["З"]='Z', ["з"]='z',
    ["Ӡ"]='Ʒ', ["ӡ"]='ʒ', ["И"]='I', ["и"]='i', ["К"]='Ḳ', ["к"]='ḳ', ["Қ"]='K', ["қ"]='k',
    ["Ҟ"]='Q̇', ["ҟ"]='q̇', ["Л"]='L', ["л"]='l', ["М"]='M', ["м"]='m', ["Н"]='N', ["н"]='n',
    ["О"]='O', ["о"]='o', ["Ҩ"]='ʿ°', ["ҩ"]='ʿ°', ["П"]='Ṗ', ["п"]='ṗ', ["Ԥ"]='P', ["ԥ"]='p',
    ["Р"]='R', ["р"]='r', ["С"]='S', ["с"]='s', ["Т"]='Ṭ', ["т"]='ṭ', ["Ҭ"]='T', ["ҭ"]='t', 
    ["У"]='U', ["у"]='u', ["Ф"]='F', ["ф"]='f', ["Х"]='X', ["х"]='x', ["Ҳ"]='Ḥ', ["ҳ"]='ḥ', 
    ["Ц"]='C', ["ц"]='c', ["Ҵ"]='C̣', ["ҵ"]='c̣',  ["Ч"]='Č̍', ["ч"]='č̍', ["Ҷ"]='Č̣̍', ["ҷ"]='č̣̍', 
    ["Ш"]='Š', ["ш"]='š', ["Ы"]='Ə', ["ы"]='ə', ["Ь"]='’', ["ь"]='’', ["Ә"]='W', ["ә"]='w',     
    -- obsolete letters, still in use
    ["Ҕ"]='Γ', ["ҕ"]='γ', ["Ҧ"]='P', ["ҧ"]='p',
    -- in borrowings from Russian and other languages
    ["Ё"]="Ë", ['ё']='ë', ["Й"]='J', ["й"]='j', ["Ъ"]="ʺ", ['ъ']='ʺ', ["Э"]="È", ['э']='è',
    ["Ю"]='Ju', ["ю"]='ju', ["Я"]='Ja', ["я"]='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, 'дә', 'd°')
    f = mw.ustring.gsub(f, 'Дә', 'D°')
    f = mw.ustring.gsub(f, 'ҭә', 't°')
    f = mw.ustring.gsub(f, 'Ҭә', 'T°')
    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, 'цә', 'c°')
    f = mw.ustring.gsub(f, 'Цә', 'C°')
    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, 'Жь', 'Ž̍')
    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, 'гь', 'g̍')
    f = mw.ustring.gsub(f, 'Гь', 'G̍')
    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, 'хь', '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, 'ку', 'ḳ°')
    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, 'ху', 'x°')
    f = mw.ustring.gsub(f, 'Ху', 'X°')
    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, 'ҳу', 'h°̍')
    f = mw.ustring.gsub(f, 'Ҳу', 'H°')
    f = mw.ustring.gsub(f, '.', tt)
    return f
end
return M