Changes
isValidCode --> isKnownLanguageTag
template exists in that language; if so, put it in langcode ]]
if ( mw.language.isValidCodeisKnownLanguageTag( subpage ) )
then
local translation = mw.title.new( frame[template]..'/'..subpage, 'Template' )