Content deleted Content added
No edit summary |
No edit summary |
||
Line 1:
--[[--------------------------< L A N G U A G E S >------------------------------------------------------------
Table of ISO 639 codes for languages supported by this module. List of MediaWiki supported languages and their
codes can be found at: Template:Citation_Style_documentation/language/doc
]]
local langs = {'ca', 'de', 'es', 'fi', 'fr', 'it', 'pl', 'pt', 'sv'};
--[[--------------------------< E N G L I S H M O N T H N A M E S >----------------------------------------
Table of local language month names filled by month_names_get()
]]
local en_months = {};
Line 14 ⟶ 29:
[3] - same as [2] for the second capture
[4] - same as [2] for the last (right-most) capture
ymd numeric dates have no hames so are not translated; use |df= parameter in the cs1|2 template for that.
Line 31 ⟶ 41:
{'^(%a+) +(%d%d?) *, +(%d%d%d%d%a?)$', 'm', 'd', 'y'}, -- Mmm dd, yyyy
{'^(%a+)$', 'm'}, -- month only; mostly for debug purposes
};
Line 46 ⟶ 49:
month_names_get(). Items in this list have the form:
['<non-English month name>'] = 'English month name',
'<non-English month name>' must be lowercase
]]
Line 51 ⟶ 55:
[''] = '',
}
--[[--------------------------< M O N T H _ N A M E S _ G E T >------------------------------------------------
creates a translation table of non-English month names listed in lang{} mapped to English month names listed in
en_months{}
]]
Line 62 ⟶ 67:
local month_names = {};
local lang_obj = mw.language.getContentLanguage(); -- make a language object for the local language
for i=1, 12 do -- loop 12x and
en_months[i] = lang_obj:formatDate('F', '2018-' .. i) -- get month names for each i
end
for _, lang in ipairs (langs) do -- spin through the languages table
for i, en_month in ipairs (en_months) do -- spin through the English month-names table
month_names[lang_obj:formatDate('F', en_month):lower()] = en_month; -- translate the English name to the current language and store in the translations table
|