Difference between revisions of "Template:If lang"
From Kerbal Space Program Wiki
m (derp) |
m (Move doc) |
||
(20 intermediate revisions by 9 users not shown) | |||
Line 1: | Line 1: | ||
− | {{ | + | {{If lang/Detection|suffix={{#if:{{{from|}}}|{{{from}}}|{{#titleparts:{{PAGENAME}}||-1}}}}|1={{{1|{{{en|}}}}}}|2={{{2|{{{non-en|{{{lang|}}}}}}}}}|3={{{3|{{{data|}}}}}}|prefix={{{prefix|/}}}|data enabled={{{data enabled|}}}}}<noinclude> |
− | + | {{Documentation}} | |
− | | | ||
− | |||
− | |||
− | |||
− | |||
− | { | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | | | ||
− | |||
− | |||
− | |||
− | = | ||
− | {{ | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
</noinclude> | </noinclude> |
Latest revision as of 13:03, 29 February 2020
{{if lang}}
is a template that can output specified values based on whether a particular page is a language subpage or not.
Usage
Code | English page result | Language page result (de) |
---|---|---|
[[Kerbin{{if lang}}]]
|
Kerbin | Kerbin/de |
[[Kerbin {{if lang}}]]
|
Kerbin | Kerbin /de |
Advanced
{{if lang}}
can be used in more advanced ways by specifying the English and non-English outputs.
-
{{if lang|non-en=_{{SUBPAGENAME}}}}
will generate_de
when used on Gilly/de.- This example is used in infobox templates to display item name images in the correct language.
#/Name | Optional | Description | Default |
---|---|---|---|
1 or en | Yes | If the language code isn't recognized returns this parameter. | Not set |
2 , non-en or lang | Yes | If the language code is recognized returns this parameter. | {{{prefix}}} and the language code |
3 or data | Yes | If the suffix is recognized as a data suffix returns this parameter. | {{{prefix}}} and the data suffix |
prefix | Yes | The prefix before the language code. | / |
data enabled | Yes | If set enables the data suffix detection. | Not set/Disabled |
Languages supported
{{if lang}}
recognizes only the below language subpages (the same as {{lang}}
):
Available languages | ar, cs, da, de, es, fi, fr, he, hr, hu, it, ja, ko, nl, no, pl, pt, pt-br, ro, ru, sv, th, tr, zh-cn, zh-tw |
---|---|
Available data suffixes | Param, Data, Box, RefFrame |
The above documentation is transcluded from Template:If lang/doc. (edit | history) Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages. Please add categories to the /doc subpage. Subpages of this template. |