ମଡ୍ୟୁଲ:ConvertTime

ଉଇକିପିଡ଼ିଆ‌ରୁ

Documentation for this module may be created at ମଡ୍ୟୁଲ: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 odia, en in pairs(conversionTable) do -- This converts every string found in the table.
        s = mw.ustring.gsub(s, odia, 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 -->}}.