This template is protected from editing.
Template:If lang
Documentation for If lang
{{if lang}}
tests whether a page is a language subpage and can output specified values based on this. It can be particularly useful in creating links to language pages without disrupting links to English pages.
It tests the value of SUBPAGENAME
and determines whether a page is a language subpage. If SUBPAGENAME
is equal to the BASEPAGENAME
, then {{if lang}}
will output the value of parameter 1. If SUBPAGENAME
fails to match BASEPAGENAME
, then {{if lang}}
will output /SUBPAGENAME
.
Usage
By default, {{if lang}}
will output nothing if the page is English, and will output /ru
or /fr
, etc, depending on the SUBPAGENAME
.
- For language links to work properly,
{{if lang}}
must not have a space preceding it. For example:
[[Soldier{{if lang}}]]
generates Soldier and Soldier/fr, however,[[Soldier {{if lang}}]]
will generate Soldier and Soldier_/fr.
Advanced
Outputs can be changed, however, if the use of a character other than /
is necessary. For example:
{{if lang|1=|2=_{{SUBPAGENAME}}}}
will generate "nothing" on an English page like Soldier, whereas on Soldier/fr, it will output_fr
.