Difference between revisions of "Template:If lang link"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (+allow en as a substitute for 1;)
m
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<includeonly>[[{{Booland|{{{en|}}}|{{#if: {{{1|}}}||1}}|{{{en}}}|{{{1}}}}}{{#if: {{{force|}}}|/{{{force}}}|{{if lang}}}}|{{lang|en={{{2|{{{en|{{{1}}}}}}}}}|ar={{{ar|}}}|cs={{{cs|}}}|da={{{da|}}}|de={{{de|}}}|es={{{es|}}}|fi={{{fi|}}}|fr={{{fr|}}}|he={{{he|}}}|hr={{{hr|}}}|hu={{{hu|}}}|it={{{it|}}}|ja={{{ja|}}}|ko={{{ko|}}}|nl={{{nl|}}}|no={{{no|}}}|pl={{{pl|}}}|pt={{{pt|}}}|pt-br={{{pt-br|}}}|ro={{{ro|}}}|ru={{{ru|}}}|sv={{{sv|}}}|th={{{th|}}}|tr={{{tr|}}}|zh={{{zh|}}}|zh-cn={{{zh-cn|}}}|zh-tw={{{zh-tw|}}}|force={{{force|}}}}}]]</includeonly><noinclude>
+
<includeonly>[[{{#if: {{{en|}}}|{{#if: {{{1|}}}|{{{1}}}|{{{en}}}}}|{{{1}}}}}{{#if: {{{force|}}}|/{{{force}}}|{{if lang}}}}|{{lang|en={{{2|{{{en|{{{1}}}}}}}}}|ar={{{ar|}}}|cs={{{cs|}}}|da={{{da|}}}|de={{{de|}}}|es={{{es|}}}|fi={{{fi|}}}|fr={{{fr|}}}|he={{{he|}}}|hr={{{hr|}}}|hu={{{hu|}}}|it={{{it|}}}|ja={{{ja|}}}|ko={{{ko|}}}|nl={{{nl|}}}|no={{{no|}}}|pl={{{pl|}}}|pt={{{pt|}}}|pt-br={{{pt-br|}}}|ro={{{ro|}}}|ru={{{ru|}}}|sv={{{sv|}}}|th={{{th|}}}|tr={{{tr|}}}|zh={{{zh|}}}|zh-cn={{{zh-cn|}}}|zh-tw={{{zh-tw|}}}|force={{{force|}}}}}]]</includeonly><noinclude>
Creates a link which automatically links to the article in the same language. Requires one parameter to the link target. Optionally it allows another link text in the same languages supported by {{Tl|lang}}.
+
{{Documentation}}
 
+
</noinclude>
<tt><nowiki>{{if lang link|Main Page}}</nowiki></tt> would create a link to the [[Main Page]] if on an English page and to [[Main Page/ru]] if on an Russian page.
 
 
 
== Parameters ==
 
{{Parameter Table|name=both|parameters=
 
{{Parameter Row|1|Target's name. If not set will use {{{en}}}.}}
 
{{Parameter Row|2|name2=en|Visible link text.|{{{1}}}}}
 
{{Parameter Row|de|name2=pl|name3=…|Visible link text in other languages.|Not set}}
 
{{Parameter Row|force|Forced language target. Usually not required, but can be used to test what that template would show in a different language.|Not set}}
 
}}
 
 
 
== Examples ==
 
{| class="wikitable"
 
! rowspan="2" | Code
 
! colspan="3" | View
 
|-
 
! English
 
! German
 
! Russian
 
|-
 
| <code><nowiki>{{if lang link|Mk16 Parachute|ru=Парашют Mk16}}</nowiki></code>
 
| [[Mk16 Parachute]]
 
| [[Mk16 Parachute/de|Mk16 Parachute]]
 
| [[Mk16 Parachute/ru|Парашют Mk16]]
 
|-
 
| <code><nowiki>{{if lang link|Kerbol|en=Sun|de=Sonne|ru=Солнце}}</nowiki></code>
 
| [[Kerbol|Sun]]
 
| [[Kerbol/de|Sonne]]
 
| [[Kerbol/ru|Солнце]]
 
|-
 
| <code><nowiki>{{if lang link|Kerbol|en=Sun|de=Sonne|ru=Солнце|force=de}}</nowiki></code>
 
| [[Kerbol/de|Sonne]]
 
| [[Kerbol/de|Sonne]]
 
| [[Kerbol/de|Sonne]]
 
|}
 
 
 
[[Category:Language templates]]
 
[[Category:Language code templates]]</noinclude>
 

Latest revision as of 09:40, 27 February 2020

Documentation icon Template documentation[view] [edit] [history] [purge]Pages that link to Template:If lang link

Usage

Creates a link which automatically links to the article in the same language. Requires one parameter to the link target. Optionally it allows another link text in the same languages supported by {{lang}}.

{{if lang link|Main Page}} would create a link to the Main Page if on an English page and to Main Page/ru if on an Russian page.

Parameters

#/Name Optional Description Default
1 No Target's pagename. If not set will use {{{en}}}.
2 or en Yes Visible link text. {{{1}}}
de , pl or Yes Visible link text in other languages. Not set
force Yes Forced language target. Usually not required, but can be used to test what that template would show in a different language. Not set

Examples

Code View
English German Russian
{{if lang link|Mk16 Parachute|ru=Парашют Mk16}} Mk16 Parachute Mk16 Parachute Парашют Mk16
{{if lang link|Kerbol|en=Sun|de=Sonne|ru=Солнце}} Sun Sonne Солнце
{{if lang link|Kerbol|en=Sun|de=Sonne|ru=Солнце|force=de}} Sonne Sonne Sonne