Difference between revisions of "Template:Lang"

From Team Fortress Wiki
Jump to: navigation, search
(This *should* fix it.)
Line 1: Line 1:
{{#switch:{{SUBPAGENAME}}
+
{{#switch:{{{force|{{SUBPAGENAME}}}}}
 
| af = {{{af|{{{en|{{{1}}}}}}}}}
 
| af = {{{af|{{{en|{{{1}}}}}}}}}
 
| ar = {{{ar|{{{en|{{{1}}}}}}}}}
 
| ar = {{{ar|{{{en|{{{1}}}}}}}}}
Line 58: Line 58:
 
}}<noinclude>
 
}}<noinclude>
 
== Usage ==
 
== Usage ==
The main purpose of this template is to keep translations and template code together in one single template. So when the coding is updated, consistency is kept across all language translations.
+
The main purpose of this template is to retain consistency across multiple translated pages.
  
 
* Using {{tl|lang}} will switch translations based on the value of <code><nowiki>{{SUBPAGENAME}}</nowiki></code>.
 
* Using {{tl|lang}} will switch translations based on the value of <code><nowiki>{{SUBPAGENAME}}</nowiki></code>.
 +
** e.g. in the article [[Soldier/de]], the <code><nowiki>{{SUBPAGENAME}}</nowiki></code> is ''de'' so {{tl|lang}} will display the translations for German.
 
* To define an English translation, you can use <code><nowiki>{{lang|en=Welcome}}</nowiki></code> or simply <code><nowiki>{{lang|Welcome}}</nowiki></code>.
 
* To define an English translation, you can use <code><nowiki>{{lang|en=Welcome}}</nowiki></code> or simply <code><nowiki>{{lang|Welcome}}</nowiki></code>.
 +
* You can also ''force'' a particular language to display, overriding <code><nowiki>{{SUBPAGENAME}}</nowiki></code>.
 +
** <code><nowiki>{{lang|force=pl}}</nowiki></code> will force Polish to show, always.
  
 
;Example:
 
;Example:

Revision as of 05:08, 7 August 2010

Usage

The main purpose of this template is to retain consistency across multiple translated pages.

  • Using {{lang}} will switch translations based on the value of {{SUBPAGENAME}}.
    • e.g. in the article Soldier/de, the {{SUBPAGENAME}} is de so {{lang}} will display the translations for German.
  • To define an English translation, you can use {{lang|en=Welcome}} or simply {{lang|Welcome}}.
  • You can also force a particular language to display, overriding {{SUBPAGENAME}}.
    • {{lang|force=pl}} will force Polish to show, always.
Example
{{Ambox
| contents = {{ambox/message
  | 1 = {{lang|de=Sprache|ja=言語|pl=Język}}
  | 2 = {{lang|de=Willkommen|ja=Irashaimasu|pl=Witaj}}
  }}
}}