Module:umu-translit

This module will transliterate Munsee language text. The module should preferably not be called directly from templates or other modules. To use it from a template, use {{xlit}}. Within a module, use Module:languages#Language:transliterate.

For testcases, see Module:umu-translit/testcases.

Functions

edit
tr(text, lang, sc)
Transliterates a given piece of text written in the script specified by the code sc, and language specified by the code lang.
When the transliteration fails, returns nil.

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