Module:bg-translit

local export = {} local tt = { ["А"]='A', ["а"]='a', ["Б"]='B', ["б"]='b', ["В"]='V', ["в"]='v', ["Г"]='G', ["г"]='g', ["Д"]='D', ["д"]='d', ["Е"]='E', ["е"]='e', ["Ж"]='Ž', ["ж"]='ž', ["З"]='Z', ["з"]='z', ["И"]='I', ["и"]='i', ["Й"]='J', ["й"]='j', ["К"]='K', ["к"]='k', ["Л"]='L', ["л"]='l', ["М"]='M', ["м"]='m', ["Н"]='N', ["н"]='n', ["О"]='O', ["о"]='o', ["П"]='P', ["п"]='p', ["Р"]='R', ["р"]='r', ["С"]='S', ["с"]='s', ["Т"]='T', ["т"]='t', ["У"]='U', ["у"]='u', ["Ф"]='F', ["ф"]='f', ["Х"]='H', ["х"]='h', ["Ц"]='C', ["ц"]='c', ["Ч"]='Č', ["ч"]='č', ["Ш"]='Š', ["ш"]='š', ["Щ"]='Št', ["щ"]='št', ["Ъ"]='Ǎ', ["ъ"]='ǎ', ["Ю"]='Ju', ["ю"]='ju', ["Я"]='Ja', ["я"]='ja', ["Ѐ"] = "È", ["ѐ"] = "è", ["Ѝ"] = "Ì", ["ѝ"]='ì',

-- Pre-reform ["Ѫ"]='Ǫ', ["ѫ"]='ǫ', ["Ѣ"]='Ě', ["ѣ"]='ě', ["Ь"]='ʹ', ["ь"]='ʹ', --?? used in old texts ["Ы"]='Y', ["ы"]='y', ["Ѧ"]='Ę', ["ѧ"]='ę', ["Ѩ"]='Ję', ["ѩ"]='ję', ["Ѭ"]='Jǫ', ["ѭ"]='jǫ', ["Ꙗ"]='Ja', ["ꙗ"]='ja', -- Quotes ['«']='“', ['»']='”',	};

function export.tr(text, lang, sc) if mw.ustring.find(text, "[̀ЀѐЍѝ]") then require("Module:debug").track("bg-translit/grave") end text = mw.ustring.gsub(text, '(%w)[Ъъ]$', '%1') :gsub("Ъ%-$", "\1") :gsub("ъ%-$", "\2") text = mw.ustring.gsub(text, '(%w)[Ъъ]%f[%c%p%s]', '%1') :gsub(".", {["\1"] = "Ъ-", ["\2"] = "ъ-"}) text = mw.ustring.gsub(text, '[Ьь]%f[ЕеОоЪъ]', { ["Ь"]='J', ["ь"]='j' }) text = mw.ustring.gsub(text, '.', tt) return text end

return export