Difference between revisions of "Module:Template translation"

Jump to navigation Jump to search
m
no edit summary
en>Verdy p
m (catch undocumented exveption thrown by mw.title.new)
en>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 arguments = {}
     local pargs = (frame:getParent() or {}).args
    for k, v in pairs((frame:getParent() or {}).args) do
    local arguments
        -- numbered args >= 1 need to be shifted
    if (args['noshift'] or '') == ''
    local n = tonumber(k) or 0
    then
    if (n > 0)
        arguments = {}
    then
        for k, v in pairs(pargs) do
    if (n >= 2)
            -- numbered args >= 1 need to be shifted
    then
            local n = tonumber(k) or 0
                arguments[n - 1] = v
            if (n > 0)
            then
                if (n >= 2)
                then
                    arguments[n - 1] = v
                end
            else
                arguments[k] = v
             end
             end
        else
            arguments[k] = v
         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
Anonymous user

Navigation menu