Modul:ce-translit

Vun Wiktionary

This module will transliterate Chechen text per WT:CE TR through the function tr.


--[[
Transliteration for the Chechen 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", ["ч"]="č", ["ш"]="š", ["щ"]="šč", ["ъ"]="ʾ", ["ы"]="y",
    ["ь"]="’", ["э"]="e", ["ю"]="ju", ["я"]="ja", ["ӏ"]="ʿ", ["А"]="A", ["Б"]="B", 
    ["В"]="W", ["Г"]="G", ["Д"]="D", ["Е"]="Ie", ["Ё"]="Ë", ["Ж"]="Ž", ["З"]="Z", 
    ["И"]="I", ["Й"]="J", ["К"]="K", ["Л"]="L", ["М"]="M", ["Н"]="N", ["О"]="O", 
    ["П"]="P", ["Р"]="R", ["С"]="S", ["Т"]="T", ["У"]="U", ["Ф"]="F", ["Х"]="Χ", 
    ["Ц"]="C", ["Ч"]="Č", ["Ш"]="Š", ["Щ"]="Šč", ["Ъ"]="ʾ", ["Ы"]="Y", ["Ь"]="’", ["Э"]="E", 
    ["Ю"]="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, 'ий', 'ī')
    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, 'хӏ', 'h')
    f = mw.ustring.gsub(f, 'цӏ', 'c̣')
    f = mw.ustring.gsub(f, 'чӏ', 'č̣')
    f = mw.ustring.gsub(f, 'юь', 'jü')
    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, 'Дз', 'Ʒ')
    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, 'Тӏ', 'Ṭ')
    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, 'Юь', 'Jü')
    f = mw.ustring.gsub(f, 'Яь', 'Jä')
    f = mw.ustring.gsub(f, '.', tt)
    return f
end
 return M