Documentation icon دستاویز [تخلیق]
-- 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'] = '0',
   ['1'] = '1',
   ['2'] = '2',
   ['3'] = '3',
   ['4'] = '4',
   ['5'] = '5',
   ['6'] = '6',
   ['7'] = '7',
   ['8'] = '8',
   ['9'] = '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, ur, 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 -->}}.