Modul:Ceribandin
Belgekirina modulê[biafirîne]
local p = {}
function p.getMonthNames()
local month_names_t = {}
local langs = {'ar', 'ca', 'da', 'de', 'es', 'fi', 'fr', 'it', 'nb', 'pl', 'pt', 'ru', 'sv', 'tr'};
local lang_obj = mw.language.getContentLanguage() -- make a language object for the local language
for i = 1, 12 do
month_names_t[i] = lang_obj:formatDate('F', '2018-' .. i) -- get month names for each i
end
for _, lang in ipairs(langs) do
lang_obj = mw.language.new(lang) -- make a language object for the current language
for i, en_month in ipairs(month_names_t) do
local en_date = '2018-' .. i .. '-01' -- use a valid date format
local month_name = mw.ustring.lower(lang_obj:formatDate('F', en_date)) -- translate the English date '1 <en month>' to <month_name>
month_names_t[month_name] = en_month
month_name = mw.ustring.lower(lang_obj:formatDate('xg', en_date)) -- translate the English date '1 <en month>' to <month_name> (genitive form)
month_names_t[month_name] = en_month
end
end
return table.concat(month_names_t, ', ')
end
return p