Modul:ady-translit

Vun Wiktionary

This module will transliterate Adyghe text per WT:ADY TR through the function tr.


--[[
Transliteration for the Adyghe language.
]]
local M={}
 
local tt={
 
    ["а"]="ā", ["б"]="b", ["в"]="v", ["г"]="γ", ["д"]="d", ["е"]="e", ["ё"]="ë", ["ж"]="ž",
    ["з"]="z", ["и"]="i", ["й"]="j", ["к"]="k", ["л"]="l", ["м"]="m", ["н"]="n", ["о"]="o", 
    ["п"]="p", ["р"]="r", ["с"]="s", ["т"]="t", ["у"]="w", ["ф"]="f", ["х"]="x", ["ц"]="c", 
    ["ч"]="č", ["ш"]="š", ["щ"]="š̍", ["ъ"]="”", ["ы"]="ə", ["ь"]="’", ["э"]="ă", ["ю"]="ju",
    ["я"]="jā", ["ӏ"]="ʾ", ["А"]="Ā", ["Б"]="B", ["В"]="V", ["Г"]="Γ", ["Д"]="D", ["Е"]="E", 
    ["Ё"]="Ë", ["Ж"]="Ž", ["З"]="Z", ["И"]="I", ["Й"]="J", ["К"]="K", ["Л"]="L", ["М"]="M", 
    ["Н"]="N", ["О"]="O", ["П"]="P", ["Р"]="R", ["С"]="S", ["Т"]="T", ["У"]="W", ["Ф"]="F", 
    ["Х"]="X", ["Ц"]="C", ["Ч"]="Č", ["Ш"]="Š", ["Щ"]="Š̍", ["Ъ"]="”", ["Ы"]="Ə", ["Ь"]="’",
    ["Э"]="Ă", ["Ю"]="Ju", ["Я"]="Jā", ["Ӏ"]="ʾ"};
 
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, 'гъу', 'ġ°')
    f = mw.ustring.gsub(f, 'дзу', 'ʒ°')
    f = mw.ustring.gsub(f, 'жъу', 'ẑ°')
    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, 'шъу', 'ŝ°')
    f = mw.ustring.gsub(f, 'шӏу', 'ṣ̂°')
    f = mw.ustring.gsub(f, 'гу', 'g°')
    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, 'ку', 'k°')
    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, 'сӏ', 'ṣ̣')
    f = mw.ustring.gsub(f, 'тӏ', 'ṭ')
    f = mw.ustring.gsub(f, 'фӏ', 'f̣')
    f = mw.ustring.gsub(f, 'ху', 'x°')
    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, 'чу', 'č̍°')
    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, 'Къу', '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, 'Шъу', 'Ŝ°')
    f = mw.ustring.gsub(f, 'Шӏу', 'Ṣ̂°')
    f = mw.ustring.gsub(f, 'Гу', 'G°')
    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, 'Ку', 'K°')
    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, 'Сӏ', 'Ṣ̣')
    f = mw.ustring.gsub(f, 'Тӏ', 'Ṭ')
    f = mw.ustring.gsub(f, 'Фӏ', 'F̣')
    f = mw.ustring.gsub(f, 'Ху', 'X°')
    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, 'Чу', 'Č̍°')
    f = mw.ustring.gsub(f, 'Чъ', 'Č')
    f = mw.ustring.gsub(f, 'Шъ', 'Ŝ')
    f = mw.ustring.gsub(f, 'Шӏ', 'Ṣ̂')
    f = mw.ustring.gsub(f, '.', tt)
    return f
end
return M