Module:Month translator: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 1:
require ('Module:No globals')
local getArgs = require ('Module:Arguments').getArgs;
 
local data = mw.loadData ('Module:month translator/data');
 
 
--[[--------------------------< _ M O N T H _ X L A T E >--------------------------------------------------------
 
{{#invoke:Sandbox/trappist the monk/monthMonth translator|month_xlate|<date>}}
 
]]
 
local function month_xlate_month_xlate (frameargs_t)
local t = {};
local day, month, year;
if 'dump' == frame.argsargs_t[1] then -- frame.argsargs_t[1] = 'dump' to dump month_names table;
return mw.dumpObject (data.month_names);
end
Line 21 ⟶ 22:
local c1, c2, c3; -- captures in the 'pattern' from the pattern table go here
 
c1, c2, c3 = mw.ustring.match (mw.text.trim (frame.argsargs_t[1]), pattern[1]); -- one or more captures set if source matches patterns[i][1])
if c1 then -- c1 always set on match
 
Line 50 ⟶ 51:
end
end
return frame.argsargs_t[1]; -- if here, couldn't translate so return the original date
end
 
 
--[[--------------------------< M O N T H _ X L A T E >--------------------------------------------------------
 
{{#invoke:Month translator|month_xlate|<date>}}
 
]]
 
local function month_xlate (frame)
return _month_xlate (getArgs (frame));
end