Modul:Month translator/data
Bu modul uchun Modul:Month translator/data/doc nomli hujjat sahifasini yaratishingiz mumkin
local langs = {'ca', 'da', 'de', 'es', 'fi', 'fr', 'it', 'nb', 'pl', 'pt', 'ru', 'sv', 'tr'};
local en_months_t = {};
local patterns = {
{'^(%d%d?) +(%a+) +(%d%d%d%d%a?)$', 'd', 'm', 'y'}, -- dd Mmm yyyy
{'^(%d%d?)%. +(%a+) +(%d%d%d%d%a?)$', 'd', 'm', 'y'}, -- dd. Mmm yyyy
{'^(%d%d?) +de +(%a+) +de +(%d%d%d%d%a?)$', 'd', 'm', 'y'}, -- dd de Mmm de yyyy
{'^(%a+) +(%d%d%d%d%a?)$', 'm', 'y'}, -- Mmm yyyy
{'^(%a+) +de +(%d%d%d%d%a?)$', 'm', 'y'}, -- Mmm de yyyy
{'^(%a+) +(%d%d?) *, +(%d%d%d%d%a?)$', 'm', 'd', 'y'}, -- Mmm dd, yyyy
{'^(%a+)$', 'm'}, -- faqat oy
};
local override_names = {
[''] = '',
}
local function month_names_get ()
local month_names_t = {};
local lang_obj = mw.language.getContentLanguage();
for i=1, 12 do
en_months_t[i] = lang_obj:formatDate('F', '2018-' .. i);
end
for _, lang in ipairs (langs) do
lang_obj = mw.getLanguage (lang);
for i, en_month in ipairs (en_months_t) do
local en_date = '1 ' .. en_month;
local month_name = mw.ustring.lower (lang_obj:formatDate('F', en_date));
month_names_t[month_name] = en_month;
month_name = mw.ustring.lower (lang_obj:formatDate('xg', en_date));
month_names_t[month_name] = en_month;
end
end
return month_names_t;
end
return {
month_names_t = month_names_get (),
override_names = override_names,
patterns = patterns,
}