Thread:User talk:CodeCat/detect script

That "plan B" part is a bit slow, but practically it's not much used, because linked terms are usually written in scripts that are listed in Module:languages. We can limit it to specific cases, i.e. doing that only when lang is "und" or "mul", and since the term is supposed to be written in the specified scripts in Module:languages, we can even put the term in a cleanup category if the module thinks it is not written in any of those scripts. We can also optimize it by defining more highly-used scripts (such as Latn) first, in Module:scripts.