Module:Sandbox/trappist the monk/i18n dates

require('strict');

--[[--------------------------< M A I N >----------------------------------------------------------------------

use this from the debug console:

=p.main ('')

where:

is a language tag know to MediaWiki

]]

local function main (lang_tag)

local long_names_from_lang_object_t = {};

local short_names_from_lang_object_t = {};

local lang_obj = mw.language.new (lang_tag); -- make a new language object for the language supplied in

for i=1, 12 do -- loop 12x and

long_names_from_lang_object_t[i] = lang_obj:formatDate ('F', '2018-' .. i .. '-1'); -- get long month name for each i

short_names_from_lang_object_t[i] = lang_obj:formatDate ('M', '2018-' .. i .. '-1'); -- get short month name for each i

end

return table.concat (short_names_from_lang_object_t, ' | ') .. '\n' .. table.concat (long_names_from_lang_object_t, ' | ')

end

--[[--------------------------< E X P O R T S >----------------------------------------------------------------

]]

return {

main = main,

}