Difference between revisions of "Module:Template translation"
Jump to navigation
Jump to search
m
Module:Template translation (view source)
Revision as of 14:16, 12 January 2014
, 14:16, 12 January 2014no edit summary
>Verdy p m (fix the script error when TNT is used on a pagename still without any /en subpage) |
>Verdy p m |
||
Line 86: | Line 86: | ||
-- Get the last subpage and check if it matches a known language code. | -- Get the last subpage and check if it matches a known language code. | ||
local subpage = this.getLanguageSubpage() | local subpage = this.getLanguageSubpage() | ||
if (subpage | if (subpage == '') | ||
then | 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 | -- Check if a translation of the pagename exists in that language | ||
local newtitle = mw.title.new(title.prefixedText .. '/' .. subpage) -- Costly | local newtitle = mw.title.new(title.prefixedText .. '/' .. subpage) -- Costly |