Module:Template translation: Difference between revisions

m
no edit summary
m (fix the script error when TNT is used on a pagename still without any /en subpage)
mNo edit summary
Line 86:
-- 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 pagename exists in English
local newtitle = mw.title.new(title.prefixedText .. '/' .. 'en') -- Costly
-- Use the translation when it exists
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
Anonymous user