--[[ Copyright 2025 datenlabor Readme: https://gitlabor.ru/Datenlabor/translit This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. --]] local utf8 = require('lua-utf8') local _M = {} local function replace(str,data) for k,v in pairs(data) do str = utf8.gsub(str,k,v) end return str end function _M.en(input) local gost = { ['а']='a',['б']='b',['в']='v',['г']='g',['д']='d',['е']='e', ['ё']='yo',['ж']='j',['з']='z',['и']='i',['й']='i',['к']='k', ['л']='l',['м']='m',['н']='n',['о']='o',['п']='p',['р']='r', ['с']='s',['т']='t',['у']='y',['ф']='f',['х']='h',['ц']='c', ['ч']='ch',['ш']='sh',['щ']='sh',['ы']='i',['э']='e',['ю']='u', ['я']='ya',['А']='A',['Б']='B',['В']='V',['Г']='G',['Д']='D', ['Е']='E',['Ё']='Yo',['Ж']='J',['З']='Z',['И']='I',['Й']='I', ['К']='K',['Л']='L',['М']='M',['Н']='N',['О']='O',['П']='P', ['Р']='R',['С']='S',['Т']='T',['У']='Y',['Ф']='F',['Х']='H', ['Ц']='C',['Ч']='Ch',['Ш']='Sh',['Щ']='Sh',['Ы']='I',['Э']='E', ['Ю']='U',['Я']='Ya',['ь']='',['Ь']='',['ъ']='',['Ъ']='',['ї']='j', ['і']='i',['ґ']='g',['є']='ye',['Ї']='J',['І']='I',['Ґ']='G',['Є']='YE' } return replace(input, gost) end function _M.cy(input) local gost = { ['ch']='ч',['sh']='ш',['sh']='щ',['YS']='ЫС',['Yo']='Ё',['yo']='ё', ['YE']='Е',['SH']='Щ',['YA']='Я',['CH']='Ч',['SH']='Ш', ['Ch']='Ч',['Sh']='Ш',['Sh']='Щ',['Ya']='Я',['JA']='Я', ['JS']='ЙС',['ZH']='Ж',['ya']='я',['ye']='э',['a']='а', ['b']='б',['v']='в',['g']='г',['d']='д',['e']='е',['j']='ж', ['z']='з',['i']='и',['i']='й',['k']='к',['l']='л',['m']='м', ['n']='н',['o']='о',['p']='п',['r']='р',['s']='с',['t']='т', ['y']='у',['f']='ф',['h']='х',['c']='ц',['i']='ы',['e']='е', ['u']='у',['A']='А',['B']='Б',['V']='В',['G']='Г',['D']='Д', ['E']='Е',['J']='Ж',['Z']='З',['I']='И',['K']='К',['L']='Л', ['M']='М',['N']='Н',['O']='О',['P']='П',['R']='Р',['S']='С', ['T']='Т',['Y']='Ы',['F']='Ф',['H']='Х',['C']='Ц',['E']='Е', ['U']='У',["'"]='ь',["'"]='Ь',["''"]='ъ',["''"]='Ъ',['j']='ї', ['i']='и',['g']='ґ',['G']='Г' } return replace(input, gost) end return _M