Difference between revisions of "Module:Template translation"

Jump to navigation Jump to search
m
no edit summary
>Verdy p
m (supplement for TNTN (to be used to solve self-recursions of TNT, with translatable templates trying to transclude other translatable templates also with TNT))
>Verdy p
m
Line 119: Line 119:
     to transclude other translable templates (such as Tnavbar).
     to transclude other translable templates (such as Tnavbar).
     ]]
     ]]
function this.getTranslatedTemplate(frame)
function this.getTranslatedTemplate(frame, withStatus)
     local args = frame.args
     local args = frame.args
     local pagename = args['template']
     local pagename = args['template']
Line 172: Line 172:
     end
     end
     -- At this point the title should exist
     -- At this point the title should exist
return title.prefixedText, title.id ~= nil
    if withStatus then
    -- status returned to Lua function below
        return title.prefixedText, title.id ~= nil
    else
    -- returned directly to MediaWiki
        return title.prefixedText
    end
end
end


Line 187: Line 193:
     ]]
     ]]
function this.renderTranslatedTemplate(frame)
function this.renderTranslatedTemplate(frame)
local title, found = this.getTranslatedTemplate(frame)
local title, found = this.getTranslatedTemplate(frame, true)
     -- At this point the title should exist prior to performing the expansion
     -- At this point the title should exist prior to performing the expansion
     -- of the template, otherwise render a red link to the missing page
     -- of the template, otherwise render a red link to the missing page
Anonymous user

Navigation menu