Module:umu-translit

Revision as of 14:44, 25 July 2023 by wikt>Quantum10000
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation for this module may be created at Module:umu-translit/doc

local export = {}

local replacements = {
    ["aa"] = "ā", ["ee"] = "ē", ["ii"] = "ī", ["oo"] = "ō",
    ["ch"] = "č", ["sh"] = "š", ["zh"] = "ž"
}

function export.tr(text)
    local output = text
    
    -- Perform all replacements
    for key, value in pairs(replacements) do
        output = output:gsub(key, value)
    end
    
    return output
end

return export