پودمان:Documentation: تفاوت میان نسخه‌ها

۶۱۰ بایت اضافه‌شده ،  ‏۲۵ ژوئن ۲۰۱۶
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
بدون خلاصۀ ویرایش
خط ۱: خط ۱:
-- برای فارسی‌سازی بهتر، بعضی از قسمت‌های این پودمان تغییر کرده‌است. لطفاً هنگام به‌روزرسانی به توضیحات پودمان توجه کنید.
-- This module implements {{documentation}}.
-- This module implements {{documentation}}.


خط ۳۳: خط ۳۴:
expectType = expectType or 'string'
expectType = expectType or 'string'
if type(msg) ~= expectType then
if type(msg) ~= expectType then
error('message: type error in message cfg.' .. cfgKey .. ' (' .. expectType .. ' expected, got ' .. type(msg) .. ')', 2)
error('پیام: خطای نوع در متن cfg.' .. cfgKey .. ' (' .. expectType .. ' انتظار می‌رفت، ' .. type(msg) .. ' بدست آمد)', 2)
end
end
if not valArray then
if not valArray then
خط ۴۱: خط ۴۲:
local function getMessageVal(match)
local function getMessageVal(match)
match = tonumber(match)
match = tonumber(match)
return valArray[match] or error('message: no value found for key $' .. match .. ' in message cfg.' .. cfgKey, 4)
-- برای فارسی‌سازی بهتر، ساختار خطای نمایشی خط زیر تغییر کرده‌است
return valArray[match] or error('پیام: هیچ مقداری برای کلید $' .. match .. ' در متن cfg.' .. cfgKey .. ' یافت نشد', 4)
end
end


خط ۱۳۶: خط ۱۳۸:
:attr('id', message('main-div-id'))
:attr('id', message('main-div-id'))
:addClass(message('main-div-classes'))
:addClass(message('main-div-classes'))
:css('padding', '12px')
:newline()
:newline()
:wikitext(p._startBox(args, env))
:wikitext(p._startBox(args, env))
خط ۳۰۹: خط ۳۱۰:
if templateTitle.exists and sandboxTitle.exists then
if templateTitle.exists and sandboxTitle.exists then
local compareUrl = mw.uri.fullUrl(
local compareUrl = mw.uri.fullUrl(
'Special:ComparePages',
'ویژه:مقایسهٔ صفحات',
{page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
{page1 = templateTitle.prefixedText, page2 = sandboxTitle.prefixedText}
)
)
خط ۴۰۵: خط ۴۰۶:
-- 'protection-template' --> 'pp-template'
-- 'protection-template' --> 'pp-template'
-- 'protection-template-args' --> {docusage = 'yes'}
-- 'protection-template-args' --> {docusage = 'yes'}
local protectionLevels, mProtectionBanner
local title = env.title
local title = env.title
local protectionLevels
if title.namespace ~= 10 and title.namespace ~= 828 then
local protectionTemplate = message('protection-template')
local namespace = title.namespace
if not (protectionTemplate and (namespace == 10 or namespace == 828)) then
-- Don't display the protection template if we are not in the template or module namespaces.
-- Don't display the protection template if we are not in the template or module namespaces.
return nil
return nil
خط ۴۱۷: خط ۴۱۶:
return nil
return nil
end
end
local editLevels = protectionLevels.edit
local editProt = protectionLevels.edit and protectionLevels.edit[1]
local moveLevels = protectionLevels.move
local moveProt = protectionLevels.move and protectionLevels.move[1]
if moveLevels and moveLevels[1] == 'sysop' or editLevels and editLevels[1] then
if editProt then
-- The page is full-move protected, or full, template, or semi-protected.
-- The page is edit-protected.
local frame = mw.getCurrentFrame()
mProtectionBanner = require('Module:Protection banner')
return frame:expandTemplate{title = protectionTemplate, args = message('protection-template-args', nil, 'table')}
local reason = message('protection-reason-edit')
return mProtectionBanner._main{reason, small = true}
elseif moveProt and moveProt ~= 'autoconfirmed' then
-- The page is move-protected but not edit-protected. Exclude move
-- protection with the level "autoconfirmed", as this is equivalent to
-- no move protection at all.
mProtectionBanner = require('Module:Protection banner')
return mProtectionBanner._main{action = 'move', small = true}
else
else
return nil
return nil
خط ۸۰۷: خط ۸۱۳:
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-edit-summary' --> 'Create sandbox version of $1'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-display' --> 'mirror'
-- 'mirror-link-preload' --> 'Template:Documentation/mirror'
-- 'sandbox-link-display' --> 'sandbox'
-- 'sandbox-link-display' --> 'sandbox'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-link-display' --> 'testcases'
-- 'testcases-edit-link-display'--> 'edit'
-- 'testcases-edit-link-display'--> 'edit'
-- 'module-testcases-preload' --> 'Template:Documentation/preload-module-testcases'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'template-sandbox-preload' --> 'Template:Documentation/preload-sandbox'
-- 'testcases-create-link-display' --> 'create'
-- 'testcases-create-link-display' --> 'create'
خط ۸۵۵: خط ۸۶۱:
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local sandboxCreateLink = makeUrlLink(sandboxCreateUrl, sandboxCreateDisplay)
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorSummary = message('mirror-edit-summary', {makeWikilink(templatePage)})
local mirrorPreload = message('mirror-link-preload')
local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = templatePage, summary = mirrorSummary}
local mirrorUrl = sandboxTitle:fullUrl{action = 'edit', preload = mirrorPreload, summary = mirrorSummary}
local mirrorDisplay = message('mirror-link-display')
local mirrorDisplay = message('mirror-link-display')
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
local mirrorLink = makeUrlLink(mirrorUrl, mirrorDisplay)
خط ۹۳۳: خط ۹۳۸:
end
end
local subpagesLink = makeWikilink(
local subpagesLink = makeWikilink(
'Special:PrefixIndex/' .. templateTitle.prefixedText .. '/',
'ویژه:نمایه پیشوندی/' .. templateTitle.prefixedText .. '/',
message('subpages-link-display', {pagetype})
message('subpages-link-display', {pagetype})
)
)