Template:Language/code

From Wikinews, the free news source you can write!
Jump to navigation Jump to search
[edit] Template documentation

Usage[edit]

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, {{language/code}} in the documentation for {{Spanish}} would produce es.

Two optional parameters are also provided for use in exceptional cases. Optional parameter lang specifies the language template name. For example, {{language/code|lang=Spanish}} anywhere would produce es. Non-blank optional parameter name extracts the language name rather than the language code. For example, {{language/code|lang=Spanish|name=1}} would produce Spanish.

Internals[edit]

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

See also[edit]