Module:Template translation: Difference between revisions

Content added Content deleted
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))
mNo edit summary
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
if withStatus then
return title.prefixedText, title.id ~= nil
-- 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