Module:Month translator/data: Difference between revisions

Content deleted Content added
+override data table;
No edit summary
Line 2:
 
local en_months = {'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'};
 
 
--[[--------------------------< P A T T E R N S >--------------------------------------------------------------
 
table of tables that hold pattern and other information used to extract date parts for translation and reconstrution
 
Tables have the form:
[1] - pattern for a particular date format; must include captures for the requiste date components:
day, month, year which ever are included in the date format
[2] - a letter 'd', 'm', or 'y' that identified the content of the first (left-most) capture
[3] - same as [2] for the second capture
[4] - same as [2] for the last (right-most) capture
[5] - string identifier that specified the format of the matching date:
'dmy' - day month year
'm' - month only (mostly for debug)
'mdy' - month day, year
'my' - month year
 
ymd numeric dates have no hames so are not translated; use |df= parameter in the cs1|2 template for that.
 
]]
 
local patterns = {
{'^(%d%d?) +(%a+) +(%d%d%d%d%a?)$', 'd', 'm', 'y', 'dmy'}, -- dd Mmm yyyy
{'^(%d%d?) +de +(%a+) +de +(%d%d%d%d%a?)$', 'd', 'm', 'y', 'dmy'}, -- dd de Mmm de yyyy
{'^(%a+) +(%d%d%d%d%a?)$', 'm', 'y', nil, 'my'}, -- Mmm yyyy
{'^(%a+) +de +(%d%d%d%d%a?)$', 'm', 'y', nil, 'my'}, -- Mmm de yyyy
{'^(%a+) +(%d%d?) *, +(%d%d%d%d%a?)$', 'm', 'd', 'y'}, -- Mmm dd, yyyy
{'^(%a+)$', 'm'}, -- month only; mostly for debug purposes
 
-- {'^(%d%d?) +(%a+) +(%d%d%d%d%a?)$', 'd', 'm', 'y', 'dmy'}, -- dd Mmm yyyy
-- {'^(%d%d?) +de +(%a+) +de +(%d%d%d%d%a?)$', 'd', 'm', 'y', 'dmy'}, -- dd de Mmm de yyyy
-- {'^(%a+) +(%d%d%d%d%a?)$', 'm', 'y', nil, 'my'}, -- Mmm yyyy
-- {'^(%a+) +de +(%d%d%d%d%a?)$', 'm', 'y', nil, 'my'}, -- Mmm de yyyy
-- {'^(%a+) +(%d%d?) *, +(%d%d%d%d%a?)$', 'm', 'd', 'y', 'mdy'}, -- Mmm dd, yyyy
-- {'^(%a+)$', 'm', nil, nil, 'm'}, -- month only; mostly for debug purposes
};