Модуль:Wikidata1: відмінності між версіями
[неперевірена версія] | [неперевірена версія] |
Вилучено вміст Додано вміст
L50g (обговорення | внесок) Немає опису редагування |
L50g (обговорення | внесок) Немає опису редагування |
||
Рядок 80:
}
--require("Module:i18n").loadI18n("Module:Wikidata/i18n", i18n)
-- got idea from [[:w:Module:Wd]]
local module_title; if ... == nil then
module_title = mw.getCurrentFrame():getTitle()
for k,v in pairs(t2) do▼
module_title = ...
end▼
▲ else
end▼
end▼
return t1▼
end
require('Module:i18n').loadI18n(module_title..'/i18n', i18n)
end▼
-- this function needs to be internationalised along with the above:
Рядок 129 ⟶ 112:
return '<span class="error">' .. (i18n.errors[code] or code) .. '</span>'
end
local function parseDateFormat(f, timestamp, addon, prefix_addon, addon_sep)
▲ end
local function parseDateValue(timestamp, date_format, date_addon)
local prefix_addon = i18n["datetime"]["prefix-addon"]
Рядок 139 ⟶ 146:
timestamp = '+' .. string.sub(timestamp, 2)
addon = date_addon
▲ local year_suffix
▲ local tstr = ""
▲ local lang_obj = mw.language.new(wiki.langcode)
▲ local f_parts = mw.text.split(f, 'Y', true)
▲ year_suffix = ''
▲ if string.match(f_part, "x[mijkot]$") then
▲ -- for non-Gregorian year
▲ f_part = f_part .. 'Y'
▲ elseif idx < #f_parts then
▲ -- supress leading zeros in year
▲ year_suffix = lang_obj:formatDate('Y', timestamp)
▲ year_suffix = string.gsub(year_suffix, '^0+', '', 1)
▲ tstr = tstr .. lang_obj:formatDate(f_part, timestamp) .. year_suffix
▲ if addon ~= "" and prefix_addon then
▲ return addon .. addon_sep .. tstr
▲ elseif addon ~= "" then
▲ return tstr .. addon_sep .. addon
▲ else
end
local _date_format = i18n["datetime"]["format"][date_format]
if _date_format ~= nil then
return
else
return printError("unknown-datetime-format")
|