This module will convert Serbo-Croatian Cyrillic text into the Roman (Latin) form through the function tr.


--[[
Transliteration/conversion for Serbo-Croatian in Cyrillic into Roman (Latin).
]]
local M={}
 
local tt={
    ["А"]='A', ["а"]='a', ["Б"]='B', ["б"]='b', ["В"]='V', ["в"]='v', ["Г"]='G', ["г"]='g', ["Д"]='D', ["д"]='d', 
    ["Ђ"]='Đ', ["ђ"]='đ', ["Е"]='E', ["е"]='e', ["Ж"]='Ž', ["ж"]='ž', ["З"]='Z', ["з"]='z', ["И"]='I', ["и"]='i', 
    ["Ј"]='J', ["ј"]='j', ["К"]='K', ["к"]='k', ["Л"]='L', ["л"]='l', ["Љ"]='Lj', ["љ"]='lj', ["М"]='M', ["м"]='m', 
    ["Н"]='N', ["н"]='n', ["Њ"]='Nj', ["њ"]='nj', ["О"]='O', ["о"]='o', ["П"]='P', ["п"]='p', ["Р"]='R', ["р"]='r', 
    ["С"]='S', ["с"]='s', ["Т"]='T', ["т"]='t', ["Ћ"]='Ć', ["ћ"]='ć', ["У"]='U', ["у"]='u', ["Ф"]='F', ["ф"]='f', 
    ["Х"]='H', ["х"]='h', ["Ц"]='C', ["ц"]='c', ["Ч"]='Č', ["ч"]='č', ["Џ"]='Dž', ["џ"]='dž', ["Ш"]='Š', ["ш"]='š', 
    -- letters with diacritics
    ["ѐ"]='è', ["Ѐ"]='È', ["ѝ"]='ì', ["Ѝ"]='Ì', ["ӣ"]='ī', ["Ӣ"]='Ī', ["ӯ"]='ū', ["Ӯ"]='Ū',
    ["а́"]='á', ["А́"]='Á', ["а̀"]='à', ["А̀"]='À', ["а̄"]='ā', ["А̄"]='Ā', ["а̏"]='ȁ', ["А̏"]='Ȁ', 
    ["а̑"]='ȃ', ["А̑"]='Ȃ', ["е́"]='é', ["Е́"]='É', ["е̄"]='ē', ["Е̄"]='Ē', ["е̏"]='ȅ', ["Е̏"]='Ȅ', 
    ["е̑"]='ȇ', ["Е̑"]='Ȇ', ["и́"]='í', ["И́"]='Í', ["и̏"]='ȉ', ["И̏"]='Ȉ', ["и̑"]='ȋ', ["И̑"]='Ȋ', 
    ["о́"]='ó', ["О́"]='Ó', ["о̀"]='ò', ["О̀"]='Ò', ["о̄"]='ō', ["О̄"]='Ō', ["о̏"]='ȍ', ["О̏"]='Ȍ', 
    ["о̑"]='ȏ', ["О̑"]='Ȏ', ["р́"]='ŕ', ["Р́"]='Ŕ', ["р̀"]='r̀', ["Р̀"]='R̀', ["р̄"]='r̄', ["Р̄"]='R̄', 
    ["р̏"]='ȑ', ["Р̏"]='Ȑ', ["р̑"]='ȓ', ["Р̑"]='Ȓ', ["у́"]='ú', ["У́"]='Ú', ["у̀"]='ù', ["У̀"]='Ù', 
    ["у̏"]='ȕ', ["У̏"]='Ȕ', ["у̑"]='ȗ', ["У̑"]='Ȗ', 
    -- proposed Montenegrin letters
    ["З́"]='Ź', ["з́"]='ź', ["Ć"]='Ś', ["ć"]='ś'
};
function M.tr(f)--translit any words or phrases
    if type(f) == 'table' then f = f.args[1] end
    return (mw.ustring.gsub(f, '.', tt))
end
return M