Module:Month translator: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 23:
c1, c2, c3 = mw.ustring.match (mw.text.trim(frame.args[1]), pattern[1]); -- one or more captures set if source matches patterns[i][1])
if c1 then -- c1 always set on match
 
t = {
[pattern[2] or 'x'] = c1, -- fill the table of captures with the captures
Line 34 ⟶ 35:
 
if month then
local df = table.concat ({pattern[2], ''pattern[3], 2pattern[4]}, ''); -- extract date format from pattern table (pattern[2], pattern[3], pattern[4])
 
-- if 'dmy' == pattern[5] then -- for dmy dates
if 'dmy' == df then -- for dmy dates
return table.concat ({day, month, year}, ' '); -- assemble an English language dmy date
-- elseif 'my' == pattern[5]df then -- for month year dates
elseif 'my' == df then -- for month year dates
return table.concat ({month, year}, ' '); -- assemble an English language dmy date
-- ifelseif 'dmymdy' == pattern[5]df then -- for dmymdy dates
return string.format ('%s %s, %s', month, day, year); -- assemble an English language mdy date
elseif 'mym' == df then -- formust be month year(only valid option datesremaining)
return month; -- none of the above, return the translated month;
end
end