ಮೋಡ್ಯೂಲ್: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 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 -->}}.