"साचा:Fallback" च्या विविध आवृत्यांमधील फरक

Content deleted Content added
restoring cosmetic changes
restoring o change
ओळ ८१:
end
 
function p.autotranslate(frame) -- logic for [[template:Autotranslate]]
local args = frame.args
local maintext = ''
local errormessage = ''
if not args.lang or args.lang == '' then
args.lang = frame:preprocess( "{{int:lang}}" ) -- get user's chosen language
end
local page = p.fallbackpage('Template:' .. args.base, args.lang)
if-- notfind base page then
page local base = p.fallbackpage(args.base, args.lang)
if not base or base == '' then
return '<strong class="error">Base page not provided for autotranslate</strong>'
end
if string.sub(base,2,9) ~= 'emplate:' then
base = 'Template:' .. base -- base provided without 'Template:' part
end
-- find base template language subpage
local page = p.fallbackpage('Template:' .. args.base, args.lang) --
if (not page and base ~= args.base) then
-- try the original args.base string. This case is only needed if base is not in template namespace
page = p.fallbackpage(args.base, args.lang)
end
if not page then
return string.format('<strong class="error">no fallback page found for autotranslate (base=[[%s]], lang=%s)</strong>', args.base, args.lang)
end
-- repack args in a standard table
newargs = {}
for ifield, jvalue in pairs(args) do
if type(i)field =~= 'numberbase' then
table.insert(newargs,[field] j)= value;
elseif i ~= 'base' and i ~= 'lang' then
errormessage = errormessage .. '[[Category:Pages with incorrect template usage/Autotranslate]]'
end
end
local maintext = frame:expandTemplate{ title = page, args = newargs }
-- Transclude {{page |....}} with template arguments the same as the ones passed to {{autotranslate}} template.
return maintext .. errormessage
local maintext = return frame:expandTemplate{ title = page, args = newargs }
end
 
"https://mr.wikipedia.org/wiki/साचा:Fallback" पासून हुडकले