Anonymous user
Module:Template translation: Difference between revisions
m
Undo revision 7059330 by Techman224 (talk) sorry but I need to see the error, because the revert breaks other pages
(revert, causing script errors all over the place) |
m (Undo revision 7059330 by Techman224 (talk) sorry but I need to see the error, because the revert breaks other pages) |
||
Line 58:
]]
function this.renderTranslatedTemplate(frame)
local
local pagename = args['template']
--[[Check whether the
if we're transcluding a main-namespace page.
(added for backward compatibility of Template:TNT)
]]
local
if (namespace ~= '') -- Checks for namespace parameter for custom ns.
then
else --
if (
then -- not found in the Template namespace, assume the main namespace (for backward compatibility)
end
end
--
if (title.id == 0)
then
return '[[' .. title.prefixedText .. ']]'
end
-- Get the last subpage and check if it matches a known language code.
local subpage = this.getLanguageSubpage()
if (subpage
then
-- Check if a translation of the
local
if (newtitle.id ~= 0)
then
title = newtitle
end
else
-- Check if a translation of the pagename exists in that language
local newtitle = mw.title.new(title.prefixedText .. '/' .. subpage) -- Costly
if (newtitle.id == 0)
then
-- Check if a translation of the pagename exists in English
newtitle = mw.title.new(title.prefixedText .. '/' .. 'en') -- Costly
end
-- Use the translation when it exists
if (newtitle.id ~= 0)
then
end
end
-- Copy args pseudo-table to a proper table so we can feed it to expandTemplate.
-- Then render the
local arguments = {}
for k, v in pairs((frame:getParent() or {}).args) do
Line 105 ⟶ 126:
end
end
return frame:expandTemplate{title =
end
|