Modul:dar-translit

Vun Wiktionary

This module will transliterate Dargwa text per WT:DAR TR through the function tr.


--[[
Transliteration for the Dargwa 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", ["я"]="ə",
    ["Б"]="B", ["П"]="P", ["Ф"]="F", ["В"]="V", ["М"]="M",
    ["Д"]="D", ["Т"]="T", ["Й"]="J", ["Н"]="N", ["З"]="Z", ["Ц"]="C",
    ["С"]="S", ["Ж"]="Ž", ["Ш"]="Š", ["Щ"]="Šč",
    ["Л"]="L", ["Ч"]="Č", ["Р"]="R", ["Г"]="G", ["К"]="K", ["Х"]="Χ", 
    ["Ъ"]="ʾ", ["А"]="A", ["Е"]="E", ["Ы"]="Y", ["И"]="I", ["О"]="O", ["У"]="U", 
    ["Ё"]="Ë", ["Ь"]="’", ["Э"]="E", ["Ю"]="Ju", ["Я"]="Ə"};
 
function M.tr(f)--translit any words or phrases
    if type(f) == 'table' then f = f.args[1] end
    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, 'цӏ', 'c̣')
    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, 'хь', 'x')
    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, 'Тӏ', 'Ṭ')
    f = mw.ustring.gsub(f, 'Сс', 'S̄')
    f = mw.ustring.gsub(f, 'Чӏ', 'Č̣')
    f = mw.ustring.gsub(f, 'Кь', 'Q̇')
    f = mw.ustring.gsub(f, 'Кӏ', 'Ḳ')
    f = mw.ustring.gsub(f, 'Хь', 'X')
    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