Template:Language/code-redir/doc

Usage
This template determines whether or not a language template appears to have a redirect from its language code. The result is non-blank for true, or blank for false.

If called with no parameters, it expects the calling page is either the language template itself, or its documentation page. For example,  in the documentation for Spanish would determine whether or not undefined appears to be a redirect to Spanish. (As of this writing, it does appear to be.)

Optional parameter  specifies the language template name. For example,  anywhere would determine whether or not undefined appears to be a redirect to Spanish.

Internals
This template uses language/code to determine the language code, but if the "code" then provided is the name of the language template, gives up and returns false. Otherwise, it checks to see whether the code names a template whose behavior appears to be the same as that of the language template. (As of this writing, the test is whether transcluding both of them produces strings of the same length; if some future change in the wiki software invalidated that test, some other test might be adopted, such as checking the first 200 characters for equality.)