Modul:inh-translit

Vun Wiktionary

This module will transliterate Ingush text per WT:INH TR through the function tr.


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