Help:Translation switching: Difference between revisions

Jump to navigation Jump to search
(Copypasted from TF wiki - only had to adjust the category. Worded very generically, which is goooood.)
 
Line 107: Line 107:
{{tl|if lang}} tests whether the page is a language page, and if it is, it'll output the language code (in this case, it's {{code|/fr}}). So the link in this example will go to [[Welcome/fr]], and the text displayed on the link will be French, as well.
{{tl|if lang}} tests whether the page is a language page, and if it is, it'll output the language code (in this case, it's {{code|/fr}}). So the link in this example will go to [[Welcome/fr]], and the text displayed on the link will be French, as well.


It's important to not put a space in front of {{tl|if lang}} (for example {{code|1=[[Hats <nowiki>{{if lang}}</nowiki>]]}}) This is because, when used in a link, it will produce [[Hats_/fr]] instead of [[Hats/fr]].
It's important to not put a space in front of {{tl|if lang}} (for example {{code|1=[[Hats <nowiki>{{if lang}}</nowiki>]]}}) This is because, when used in a link, it will produce [[Chell/fr]] instead of [[Chell/fr]].


=== Language categories ===
=== Language categories ===
{{tl|lang cat}} can be particularly handy for placing some templates in categories based on their language. For example, {{tlx|lang cat|Soldier}} will place German pages in [[:Category:Soldier/de]], and French pages in [[:Category:Soldier/fr]].
{{tl|lang cat}} can be particularly handy for placing some templates in categories based on their language. For example, {{tlx|lang cat|Characters}} will place German pages in [[:Category:Characters/de]], and French pages in [[:Category:Characters/fr]].


== Related language templates ==
== Related language templates ==