Module:ConvertTime

ꯋꯤꯀꯤꯄꯦꯗꯤꯌꯥ ꯗꯒꯤ

Documentation for this module may be created at Module:ConvertTime/doc

-- First, define a table of text to search for, and what to convert it to.

local conversionTable = {
   ['ꯖꯥꯅꯨꯋꯥꯔꯤ'] = 'January',
   ['ꯐꯦꯕꯔꯨꯋꯥꯔꯤ'] = 'February',
   ['ꯃꯥꯔꯆ'] = 'March',
   ['ꯑꯦꯄ꯭ꯔꯤꯜ'] = 'April',
   ['ꯃꯦ'] = 'May',
   ['ꯖꯨꯟ'] = 'June',
   ['ꯖꯨꯂꯥꯏ'] = 'July',
   ['ꯑꯒꯨꯁꯠ'] = 'August',
   ['ꯁꯦꯞꯇꯦꯝꯕꯔ'] = 'September',
   ['ꯑꯣꯛꯇꯣꯕꯔ'] = 'October',
   ['ꯅꯣꯚꯦꯝꯕꯔ'] = 'November',
   ['ꯗꯤꯁꯦꯝꯕꯔ'] = 'December',
   ['꯰'] = '0',
   ['꯱'] = '1',
   ['꯲'] = '2',
   ['꯳'] = '3',
   ['꯴'] = '4',
   ['꯵'] = '5',
   ['꯶'] = '6',
   ['꯷'] = '7',
   ['꯸'] = '8',
   ['꯹'] = '9',
}

-- Then we define a table to hold our function
local p = {}

-- Then we define a function that converts strings using conversionTable.
function p.main(frame)
    local s = frame.args[1] -- This gets the first positional argument.
    for bn, en in pairs(conversionTable) do -- This converts every string found in the table.
        s = mw.ustring.gsub(s, bn, en)
    end
    return s -- Get the result of the function.
end

return p -- Pass our table containing our function back to Lua.
-- Now we can call our function using {{#invoke:ConvertTime|main|<!-- your text here -->}}.
"https://mni.wikipedia.org/w/index.php?title=Module:ConvertTime&oldid=4021" ꯃꯐꯝꯗꯨꯗꯒꯤ ꯂꯧꯈꯠꯂꯛꯄꯥ