Changes

Module:Template translation

213 bytes added, 06:47, 10 June 2013
m
check for apostrophes before isKnownLanguageTag
--[[ If the subpage is a valid language code, check if a translation of the
template exists in that language; if so, put it in langcode.
Check first if there's an apostrophe, because they break the
isKnownLanguageTag function.
]]
if (type ( mw.languageustring.isKnownLanguageTagmatch( subpage , "'" )) == nil )
then
local translation = if ( mw.titlelanguage.newisKnownLanguageTag( namespace..template..'/'..subpage ) if ( translation.id ~= 0)
then
local translation = mw.title.new( namespace..template..'/'..subpage ) if ( translation.id ~= 0) then langcode='/'..subpage end
end
end
Anonymous user