Template:langrev/documentation

Definition from Wiktionary, the free dictionary
Jump to: navigation, search
Edit-copy green.svg Documentation for Template:langrev. [edit]
This page contains usage information, categories, interwiki links and other content describing the template.
This template is deprecated.
Use Module:languages/templates#getByCanonicalName instead.

Usage[edit]

This template is used to reverse-map language names to their codes. It is the reverse of direct transclusion of the language code template. It has one unnamed parameter, which should be the name of the language to be converted. If a mapping for that name exists, it will return the code for it on Wiktionary. If it doesn't exist, it returns an empty string. The template can be used equally well with or without subst:.

The mapping is done with subtemplates, which contain just the code in question. For example, {{langrev/English}} contains en. The mapping can be many-to-one, since a language might have more than one given name. Of course, only one of those will be what the language code itself expands to. So it may be possible for {{langrev|High German}} to equal de even though {{de}} equals German. In technical terms, this template is not injective (one-to-one) and therefore can't be reversed.

This template may be used directly to determine a language's code (or name): type {{langrev|English}}, for example, in the Sandbox or Special:ExpandTemplates, and it will return "en".

It is also used by some other templates, such as Template:langcat.

See also[edit]