Anonymous user
Module:Template translation: Difference between revisions
m
hope this fixes this dummy bug of namespaces
m (preserve the namespace as it is resolved when testing other languages (may be needed for te main namespace) - workaround) |
m (hope this fixes this dummy bug of namespaces) |
||
Line 78:
title = mw.title.new(pagename, namespace) -- Costly
end
end▼
-- At this point the title should exist, otherwise render a red link to the missing page▼
if (title.id == 0)▼
then▼
return '[[' .. title.prefixedText .. ']]'▼
end
Line 91 ⟶ 85:
then
-- Check if a translation of the pagename exists in English
local newtitle = mw.title.new(
-- Use the translation when it exists
if (newtitle.id ~= 0)
Line 99 ⟶ 93:
else
-- Check if a translation of the pagename exists in that language
local newtitle = mw.title.new(
if (newtitle.id == 0)
then
-- Check if a translation of the pagename exists in English
newtitle = mw.title.new(
end
-- Use the translation when it exists
Line 110 ⟶ 104:
title = newtitle
end
▲ end
▲ -- At this point the title should exist, otherwise render a red link to the missing page (resolved in its assumed namespace)
▲ if (title.id == 0)
▲ then
▲ return '[[' .. title.prefixedText .. ']]'
end
Line 128:
end
end
return frame:expandTemplate{title = title, args = arguments}
end
|