Difference between revisions of "Module:Template translation"
Jump to navigation
Jump to search
m
Module:Template translation (view source)
Revision as of 08:34, 7 February 2014
, 08:34, 7 February 2014no edit summary
>Verdy p m (catch undocumented exveption thrown by mw.title.new) |
>Verdy p m |
||
Line 172: | Line 172: | ||
-- Copy args pseudo-table to a proper table so we can feed it to expandTemplate. | -- Copy args pseudo-table to a proper table so we can feed it to expandTemplate. | ||
-- Then render the pagename. | -- Then render the pagename. | ||
local | local pargs = (frame:getParent() or {}).args | ||
local arguments | |||
if (args['noshift'] or '') == '' | |||
then | |||
arguments = {} | |||
for k, v in pairs(pargs) do | |||
-- numbered args >= 1 need to be shifted | |||
local n = tonumber(k) or 0 | |||
if (n > 0) | |||
then | |||
if (n >= 2) | |||
then | |||
arguments[n - 1] = v | |||
end | |||
else | |||
arguments[k] = v | |||
end | end | ||
end | end | ||
else -- special case where TNT is used as autotranslate | |||
-- (don't shift again what is shifted in the invokation) | |||
arguments = pargs | |||
end | end | ||
arguments['template'] = title.prefixedText -- override the existing parameter of the base template name supplied with the full name of the actual template expanded | arguments['template'] = title.prefixedText -- override the existing parameter of the base template name supplied with the full name of the actual template expanded |