Module:kdr-translit

This module will transliterate Karaim language text per WT:KDR TR. The module should preferably not be called directly from templates or other modules. To use it from a template, use {{xlit}}. Within a module, use Module:languages#Language:transliterate.

For testcases, see Module:kdr-translit/testcases.

Functions

tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

local export = {}

local tab = {
    ["А"]="A", ["Б"]="B", ["В"]="V", ["Г"]="G", ["Д"]="D", ["Е"]="Ye", ["Ж"]="J",    
["З"]="Z", 
    ["И"]="I", ["Й"]="Y", ["К"]="K", ["Л"]="L", ["М"]="M", ["Н"]="N",  ["О"]="O",  
["Ӧ"]="Ö", 
    ["П"]="P", ["Р"]="R", ["С"]="S",  ["Т"]="T", ["У"]="U", ["Ӱ"]="Ü", ["Ф"]="F", 
["Х"]="H", 
    ["Ц"]="Ts", ["Ч"]="Ç", ["Ш"]="Ş", ["Щ"]="Şç", ["Ъ"]="ʺ", ["Ы"]="İ",
["Ь"]="ʹ", 
    ["Э"]="E", ["Ю"]="Yu", ["Я"]="Ya",
    ['а']='a', ['б']='b', ['в']='v', ['г']='g', ['д']='d', ['е']='ye', ['ж']='j', ['з']='z', 
    ['и']='i', ['й']='y', ['к']='k', ['л']='l', ['м']='m', ['н']='n', ['о']='o', 
['ӧ']='ö',  
    ['п']='p', ['р']='r', ['с']='s', ['т']='t', ['у']='u', ['ӱ']='ü', ['ф']='f', ['х']='h',  
    ['ц']='ts', ['ч']='ç', ['ш']='ş', ['щ']='şç',['ъ']='ʺ', ['ы']='ı', ['ь']='ʹ', 
    ['э']='e',
    ['ю']='yu', ['я']='ya', ['дж']='c', ['Дж']='C', ['къ']='q', ['Къ']='Q', 
    ['нъ']='ñ', 
    ['Нъ']='Ñ', ['хъ' ]='x', ['Хъ']='X', ['гъ']='ğ', ['Гъ']='Ğ'
}

function export.tr(text, lang, sc)

	return (mw.ustring.gsub(text,'.',tab))
end

return export