Content added Content deleted
(make 'string' the default message type in the message function to avoid having 'string' all over the place) |
(use hyphens for message names rather than camelCase, in line with MediaWiki) |
||
Line 29:
-- message are substituted with values from the table keys [1], [2] etc.
-- For example, if the message cfg.fooMessage had the value 'Foo $2 bar $1.',
-- message('
--]]
local msg = cfg[cfgKey]
Line 127:
-- so that we don't have to worry about unclosed tags.
.tag('div')
.attr('id', message('
.addClass(message('
.newline()
.wikitext(p._startBox(args, env))
Line 196:
title = mw.title.new(titleArg)
if not title then
error(message('
end
else
Line 208:
local title = env.title
local subpage = title.subpageText
if subpage == message('
return title.basePageTitle
else
Line 223:
docpage = docname
else
docpage = env.docpageRoot .. '/' .. message('
end
return mw.title.new(docpage)
Line 230:
function envFuncs.sandboxTitle()
-- Title object for the /sandbox subpage.
return mw.title.new(env.docpageRoot .. '/' .. message('
end
function envFuncs.testcasesTitle()
-- Title object for the /testcases subpage.
return mw.title.new(env.docpageRoot .. '/' .. message('
end
function envFuncs.printTitle()
-- Title object for the /Print subpage.
return env.templateTitle:subPageTitle(message('
end
Line 297:
local omargs = {} -- Args for {{ombox}}.
-- Get the image wikitext.
omargs.image = message('
-- Get the text. We start with the opening blurb, which is something like
-- "This is the template sandbox for [[Template:Foo]] (diff)."
Line 307:
if isPreviewing or not compareUrl then
-- 'This is the [[Wikipedia:Template test cases|template sandbox]] page for $1.'
text = text .. message('
else
-- 'This is the [[Wikipedia:Template test cases|template sandbox]] page for $1 ($2).'
local compareDisplay = message('
local compareLink = makeUrlLink(compareUrl, compareDisplay)
text = text .. message('
end
-- Get the test cases page blurb if the page exists.
local testcasesTitle = env.testcasesTitle
if testcasesTitle and testcasesTitle.exists then
local testcasesLinkDisplay = message('
local testcasesLink = makeWikilink(testcasesTitle.prefixedText, testcasesLinkDisplay)
text = text .. '<br />' .. message('
end
-- Add the page to [[Category:Template sandboxes]].
text = text .. makeCategoryLink(message('
omargs.text = text
return messageBox.main('ombox', omargs)
Line 329:
function p.protectionTemplate(env)
local title = env.title
local protectionTemplate = message('
if not (protectionTemplate and title.namespace == 10) then
-- Don't display the protection template if we are not in the template namespace.
Line 347:
if getProtectionLevel('move', prefixedTitle) == 'sysop' or getProtectionLevel('edit', prefixedTitle) then
-- The page is full-move protected, or full, template, or semi-protected.
return frame:expandTemplate{title = protectionTemplate, args = message('
end
return nil
Line 390:
data.docTitle = docTitle
-- View, display, edit, and purge links if /doc exists.
data.viewLinkDisplay = message('
data.editLinkDisplay = message('
data.historyLinkDisplay = message('
data.purgeLinkDisplay = message('
-- Create link if /doc doesn't exist.
local preload = args.preload
if not preload then
if env.subjectSpace == 6 then -- File namespace
preload = message('
else
preload = message('
end
end
data.preload = preload
data.createLinkDisplay = message('
return data
end
Line 445:
data.heading = heading
elseif subjectSpace == 10 then -- Template namespace
data.heading = message('
elseif subjectSpace == 828 then -- Module namespace
data.heading = message('
elseif subjectSpace == 6 then -- File namespace
data.heading = message('
else
data.heading = message('
end
Line 468:
-- [view][edit][history][purge] or [create] links.
if links then
data.linksClass = message('
data.linksId = message('
data.links = links
end
Line 549:
-- Assemble the arguments for {{fmbox}}.
local fmargs = {}
fmargs.id = message('
fmargs.image = message('
fmargs.style = message('
fmargs.textstyle = message('
-- Assemble the fmbox text field.
Line 597:
local ret
if printTitle.exists then
local printLink = makeWikilink(printTitle.prefixedText, message('
ret = message('
local displayPrintCategory = message('
if displayPrintCategory then
ret = ret .. makeCategoryLink(message('
end
end
Line 617:
local pagetype
if subjectSpace == 10 then
pagetype = message('
elseif subjectSpace == 828 then
pagetype = message('
else
pagetype = message('
end
return makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
message('
)
end
Line 636:
end
-- Make the blurb.
local docPathLink = makeWikilink(docTitle.prefixedText, message('
return message('
end
Line 652:
local docLink = makeWikilink(docTitle.prefixedText)
local editUrl = docTitle:fullUrl{action = 'edit'}
local editDisplay = message('
local editLink = makeUrlLink(editUrl, editDisplay)
local historyUrl = docTitle:fullUrl{action = 'history'}
local historyDisplay = message('
local historyLink = makeUrlLink(historyUrl, historyDisplay)
ret = message('
.. ' '
.. makeToolbar(editLink, historyLink)
Line 663:
elseif env.subjectSpace == 828 then
-- /doc does not exist; ask to create it.
local createUrl = docTitle:fullUrl{action = 'edit', preload = message('
local createDisplay = message('
local createLink = makeUrlLink(createUrl, createDisplay)
ret = message('
.. '<br />'
end
Line 687:
if sandboxTitle.exists then
local sandboxPage = sandboxTitle.prefixedText
local sandboxDisplay = message('
local sandboxLink = makeWikilink(sandboxPage, sandboxDisplay)
local sandboxEditUrl = sandboxTitle:fullUrl{action = 'edit'}
local sandboxEditDisplay = message('
local sandboxEditLink = makeUrlLink(sandboxEditUrl, sandboxEditDisplay)
local compareUrl = env.compareUrl
local compareLink
if compareUrl then
local compareDisplay = message('
compareLink = makeUrlLink(compareUrl, compareDisplay)
end
Line 702:
local sandboxPreload
if subjectSpace == 828 then
sandboxPreload = message('
else
sandboxPreload = message('
end
local sandboxCreateUrl = sandboxTitle:fullUrl{action = 'edit', preload = sandboxPreload}
local sandboxCreateDisplay = message('
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('
local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, summary = mirrorSummary}
local mirrorDisplay = message('
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
sandboxLinks = message('
end
if testcasesTitle.exists then
local testcasesPage = testcasesTitle.prefixedText
local testcasesDisplay = message('
local testcasesLink = makeWikilink(testcasesPage, testcasesDisplay)
local testcasesEditUrl = testcasesTitle:fullUrl{action = 'edit'}
local testcasesEditDisplay = message('
local testcasesEditLink = makeUrlLink(testcasesEditUrl, testcasesEditDisplay)
testcasesLinks = testcasesLink .. ' ' .. makeToolbar(testcasesEditLink)
Line 726:
local testcasesPreload
if subjectSpace == 828 then
testcasesPreload = message('
else
testcasesPreload = message('
end
local testcasesCreateUrl = testcasesTitle:fullUrl{action = 'edit', preload = testcasesPreload}
local testcasesCreateDisplay = message('
local testcasesCreateLink = makeUrlLink(testcasesCreateUrl, testcasesCreateDisplay)
testcasesLinks = message('
end
local messageName
Line 753:
local ret = ''
local subpage = title.subpageText
if message('
local sort = (title.namespace == 0 and message('
ret = ret .. makeCategoryLink(message('
end
return ret
|