Template:Language/code/doc

Usage
This template extracts the language code from a language template.

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 produce.

Two optional parameters are also provided for use in exceptional cases. Optional parameter  specifies the language template name. For example,  anywhere would produce. Non-blank optional parameter  extracts the language name rather than the language code. For example,  would produce.

Internals
This template depends on the language template to pass on parameter  to languageicon, and parses the resulting markup to extract the label on the resulting wikilink.