local export = {}
local tab = {
["А"]='A', ["а"]='a', ["Б"]='B', ["б"]='b', ["Г"]='G', ["г"]='g', ["Ҕ"]='Ğ', ["ҕ"]='ğ',
["Д"]='D', ["д"]='d', ["И"]='İ', ["и"]='i', ["Й"]='Y', ["й"]='y', ["К"]='K', ["к"]='k',
["Л"]='L', ["л"]='l', ["М"]='M', ["м"]='m', ["Н"]='N', ["н"]='n', ["Ҥ"]='Ñ', ["ҥ"]='ñ',
["О"]='O', ["о"]='o', ["Ө"]='Ö', ["ө"]='ö', ["П"]='P', ["п"]='p', ["Р"]='R', ["р"]='r',
["С"]='S', ["с"]='s', ["Һ"]='H', ["һ"]='h', ["Т"]='T', ["т"]='t', ["У"]='U', ["у"]='u',
["Ү"]='Ü', ["ү"]='ü', ["Х"]='Q', ["х"]='q', ["Ч"]='C', ["ч"]='c', ["Ы"]='I', ["ы"]='ı',
["Э"]='E', ["э"]='e',
-- non-native letters
["В"]='V', ["в"]='v', ["Е"]='E', ["е"]='e', ["Ё"]='O', ["ё"]='o', ["Ж"]='Zh', ["ж"]='zh',
["З"]='Z', ["з"]='z', ["Ф"]='F', ["ф"]='f', ["Ц"]='Ts', ["ц"]='ts', ["Ш"]='Sh', ["ш"]='sh',
["Щ"]='Shc', ["щ"]='shc', ['Ъ']='', ['ъ']='', ["Ь"]="", ["ь"]="", ["Ю"]='U', ["ю"]='u',
["Я"]='A', ["я"]='a',
}
function export.tr(text, lang, sc)
text = mw.ustring.gsub(text, 'Дь', 'J')
text = mw.ustring.gsub(text, 'дь', 'j')
text = mw.ustring.gsub(text, 'НЬ', 'NY')
text = mw.ustring.gsub(text, 'Нь', 'Ny')
text = mw.ustring.gsub(text, 'нь', 'ny')
-- soft vowels after a vowel or at the beginning of a word become j-
text = mw.ustring.gsub(text, "([АОӨУҮЫЭЕЯЁЮИЕЪаоöуүыэяёюиеъ%A][\204\129\204\128]?)([еёюя])", "%1y%2")
text = mw.ustring.gsub(text, "^([ЕЁЮЯ])", "Y%1")
text = mw.ustring.gsub(text, "^([еёюя])", "y%1")
return (mw.ustring.gsub(text,'.',tab))
end
return export