Modul:Protection banner: Unterschied zwischen den Versionen

use cfg.explanationBlurbs to fetch the explanation blurbs rather than hard-coding the message keys here
(add explanation blurb for semi-protection)
(use cfg.explanationBlurbs to fetch the explanation blurbs rather than hard-coding the message keys here)
Zeile 469: Zeile 469:


function Blurb:_makeExplanationBlurbParameter()
function Blurb:_makeExplanationBlurbParameter()
-- Cover special cases first.
if self._protectionObj.title.namespace == 8 then
-- MediaWiki namespace
return self:_getExpandedMessage('explanation-blurb-nounprotect')
end
-- Get explanation blurb table keys
local action = self._protectionObj.action
local action = self._protectionObj.action
local level = self._protectionObj.level
local level = self._protectionObj.level
local namespace = self._protectionObj.title.namespace
local talkKey = self._protectionObj.title.isTalkPage and 'talk' or 'subject'
local isTalk = self._protectionObj.title.isTalkPage


-- @TODO: add pending changes
-- Find the message in the explanation blurb table and substitute any
local key
-- parameters.
if namespace == 8 then
local explanations = self._cfg.explanationBlurbs
-- MediaWiki namespace
local msg
key = 'explanation-blurb-full-nounprotect'
if explanations[action][level] and explanations[action][level][talkKey] then
elseif action == 'edit' and level == 'sysop' and not isTalk then
msg = explanations[action][level][talkKey]
key = 'explanation-blurb-full-subject'
elseif explanations[action][level] and explanations[action][level].default then
elseif action == 'edit' and level == 'autoconfirmed' then
msg = explanations[action][level].default
if isTalk then
elseif explanations[action].default and explanations[action].default[talkKey] then
key = 'explanation-blurb-semi-talk'
msg = explanations[action].default[talkKey]
else
elseif explanations[action].default and explanations[action].default.default then
key = 'explanation-blurb-semi-subject'
msg = explanations[action].default.default
end
elseif action == 'move' then
if isTalk then
key = 'explanation-blurb-move-talk'
else
key = 'explanation-blurb-move-subject'
end
else
else
key = 'explanation-blurb-default'
error(string.format(
'could not find explanation blurb for action "%s", level "%s" and talk key "%s"',
action,
level,
talkKey
))
end
end
return self:_getExpandedMessage(key)
return self:_substituteParameters(msg)
end
end


Anonymer Benutzer