Difference between revisions of "Module:Template translation"
Jump to navigation
Jump to search
m
Module:Template translation (view source)
Revision as of 23:28, 8 November 2013
, 23:28, 8 November 2013no edit summary
>Verdy p m (this works) |
>Verdy p m |
||
Line 33: | Line 33: | ||
(added for backward compatibility of Template:TNT) | (added for backward compatibility of Template:TNT) | ||
]] | ]] | ||
local namespace = 'Template' | local namespace = 'Template' | ||
if (frame.args['namespace']~='')--checks for namespace parameter for custom ns | if (frame.args['namespace']~='')--checks for namespace parameter for custom ns | ||
Line 64: | Line 62: | ||
local arguments = {} | local arguments = {} | ||
for k, v in pairs((frame:getParent() or {}).args) do | for k, v in pairs((frame:getParent() or {}).args) do | ||
arguments[k] = v | -- 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 | ||
return frame:expandTemplate{title = namespace .. ':' .. template .. '/' .. langcode, args = arguments} | return frame:expandTemplate{title = namespace .. ':' .. template .. '/' .. langcode, args = arguments} |