Difference between revisions of "Template:If lang link"

From Kerbal Space Program Wiki
Jump to: navigation, search
m (+use lang template;)
(+examples;)
Line 4: Line 4:
 
<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.
 
<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 Table|name=both|parameters=
 
{{Parameter Row|1|Target's name}}
 
{{Parameter Row|1|Target's name}}
Line 10: Line 11:
 
{{Parameter Row|de|name2=pl|name3=…|Visible link text in other languages.|Not set}}
 
{{Parameter Row|de|name2=pl|name3=…|Visible link text in other languages.|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]]</noinclude>
 
[[Category:Language templates]]</noinclude>

Revision as of 11:59, 15 December 2013

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

Template:Parameter Table

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