Module:User:Crom daba/sh-translit

local export = {}

local tt = {} tt["Cyrl"] = { ["А"]='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ž', ["Ш"]='Š', ["ш"]='š', -- proposed Montenegrin letters ["З́"]='Ź', ["з́"]='ź', ["Ć"]='Ś', ["ć"]='ś' };

tt["Latn"] = { --Digraphs need to go first ["Lj"]='Љ', ["lj"]='љ', ["Nj"]='Њ', ["nj"]='њ', ["Dž"]='Џ', ["dž"]='џ', ["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"]='ц', ["Č"]='Ч', ["č"]='ч', ["Š"]='Ш', ["š"]='ш',

-- proposed Montenegrin letters ["Ź"]='З́', ["ź"]='з́', ["Ś"]='Ć', ["ś"]='ć', -- backtick needs to be removed so that "nad`živeti" returns "надживети" -- ["`"]="" };

function export.tr(text, lang, sc) text = mw.ustring.gsub(text, '.[jž]', tt[sc]) return (mw.ustring.gsub(text, '.', tt[sc])) end

return export