Module:Documentation: Difference between revisions

mNo edit summary
mNo edit summary
Line 4: Line 4:


local i18n = {
local i18n = {
commonInternalLink = '[[%s]]',
commonInternalLinkPipe = '[[%s|%s]]',
commonExternalLink = '[%s]',
commonExternalLinkWithName = '[%s %s]',
commonCategory = 'Category:%s',
pageType_template = 'template',
pageType_template = 'template',
pageType_module = 'module',
pageType_module = 'module',
Line 20: Line 25:
createOutputFormat = '%s%s',
createOutputFormat = '%s%s',
createSplitDocPagePrompt = '\n<!-- Put categories/interwikis on the documentation page -->',
createSplitDocPagePrompt = '\n<!-- Put categories/interwikis on the documentation page -->',
createNoSubstCategory = 'Category:Pages with templates requiring substitution',
createNoSubstCategory = 'Pages with templates requiring substitution',
docPagePrompt = 'This is the documentation page. It %s be transcluded into the main %s page. See [[Template:Documentation]] for more information.',
docPagePrompt = 'This is the documentation page. It %s be transcluded into the main %s page. See [[Template:Documentation]] for more information.',
docPagePromptWill = 'will',
docPagePromptWill = 'will',
docPagePromptShould = 'should',
docPagePromptShould = 'should',
docPageBadDocPrompt = "<br>'''This %s's documentation needs improving or additional information.'''",
docPageBadDocPrompt = "<br>'''This %s's documentation needs improving or additional information.'''",
docPageCategory = 'Category:Documentation pages',
docPageCategory = 'Documentation pages',
pageNoDocPrompt = "'''This %s has no documentation. If you know how to use this %s, please create it.'''",
pageNoDocCategory = '%ss with no documentation',
pageNoDocCategoryDefault = 'Pages with no documentation',
}
}


Line 75: Line 83:
out = f:preprocess( out )
out = f:preprocess( out )
if not args.nocat then
if not args.nocat then
out = out .. '[[' .. i18n.createNoSubstCategory .. ']]'
out = out .. i18n.commonInternalLink:format( i18n.commonCategory:format( i18n.createNoSubstCategory ) )
end
end
end
end
Line 120: Line 128:
end
end
if not ( args.nocat or namespace == 'User' ) then
if not ( args.nocat or namespace == 'User' ) then
body:wikitext( '[[' .. i18n.docPageCategory .. ']]' )
body:wikitext( i18n.commonInternalLink:format( i18n.commonCategory:format( i18n.docPageCategory ) ) )
end
end


Line 177: Line 185:
if noDoc then
if noDoc then
docClass = 'documentation-noDoc'
docClass = 'documentation-noDoc'
message = "'''This " .. pageType .. " has no documentation. " ..
message = i18n.pageNoDocPrompt:format( pageType, pageType )
"If you know how to use this " .. pageType .. ", please create it.'''"
if not ( args.nocat or namespace == 'User' ) then
if not ( args.nocat or namespace == 'User' ) then
category = pageType .. 's with no documentation'
category = i18n.pageNoDocCategory:format( pageType )
if not mw.title.new( 'Category:' .. category ).exists then
if not mw.title.new( 'Category:' .. category ).exists then
category = 'Pages with no documentation'
category = i18n.pageNoDocCategoryDefault
end
end
end
end