Changes
m
local translation = if ( mw.titlelanguage.newisKnownLanguageTag( namespace..template..'/'..subpage ) if ( translation.id ~= 0)
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
then
local translation = mw.title.new( namespace..template..'/'..subpage ) if ( translation.id ~= 0) then langcode='/'..subpage end
end
end