1,674
edits
(→Templates without translation switching: forgot dis) |
mNo edit summary |
||
Line 1: | Line 1: | ||
{{NS HELP navbar}} | |||
'''Translation switching''' is used on many templates and other message boxes across the wiki. The template '''{{tl|lang}}''' detects the name of the language page and ''switches'' the text. Its main purpose is to keep all localized versions of text centralized into one template. | '''Translation switching''' is used on many templates and other message boxes across the wiki. The template '''{{tl|lang}}''' detects the name of the language page and ''switches'' the text. Its main purpose is to keep all localized versions of text centralized into one template. | ||
Line 5: | Line 7: | ||
== What should use translation switching? == | == What should use translation switching? == | ||
In general, all templates should use it | In general, all templates should use it. | ||
== How to add localized strings == | == How to add localized strings == | ||
# Select a template from the [[:Category:Templates that use translation switching|list of templates]] that use translation switching. | # Select a template from the [[:Category:Templates that use translation switching|list of templates]] that use translation switching. | ||
# Edit the template and add your strings (please use alphabetical ordering for convenience). | # Edit the template and add your strings (please use alphabetical ordering for convenience, with the English string on top). | ||
# Update the template {{tl|translation switching}} or {{tl|ts}} towards the bottom of the page and add your language code to the list. | # Update the template {{tl|translation switching}} or {{tl|ts}} towards the bottom of the page and add your language code to the list. | ||
Line 17: | Line 19: | ||
<pre><nowiki> | <pre><nowiki> | ||
{{lang | {{lang | ||
| en = Welcome | |||
| cs = Vítejte | | cs = Vítejte | ||
| de = Willkommen | | de = Willkommen | ||
| ja = Irashaimasu | | ja = Irashaimasu | ||
| ru = Добро пожаловать | | ru = Добро пожаловать | ||
Line 32: | Line 34: | ||
<nowiki>{{lang</nowiki> | <nowiki>{{lang</nowiki> | ||
| en = Welcome | |||
| cs = Vítejte | | cs = Vítejte | ||
| de = Willkommen | | de = Willkommen | ||
<span style="font-weight:bolder;font-size:110%;color:#006F00;">| it = Benvenuto</span> | <span style="font-weight:bolder;font-size:110%;color:#006F00;">| it = Benvenuto</span> | ||
| ja = Irashaimasu | | ja = Irashaimasu | ||
Line 46: | Line 48: | ||
Make sure to add the language to the {{tl|translation switching}} template towards the bottom of the page, also. | Make sure to add the language to the {{tl|translation switching}} template towards the bottom of the page, also. | ||
:{{c|important}}: Remember to add language strings in alphabetical order. | :{{c|important}}: Remember to add language strings in alphabetical order, with English being on top. | ||
== Templates without translation switching == | == Templates without translation switching == | ||
Line 107: | Line 109: | ||
{{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=[[ | It's important to not put a space in front of {{tl|if lang}} (for example {{code|1=[[Chell <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 === | ||
Line 122: | Line 124: | ||
== See also == | == See also == | ||
* [[Help:Language translation]] – how to translate normal article pages. | * [[Help:Language translation]] – how to translate normal article pages. | ||
[[Category:Help]] | [[Category:Help]] | ||
[[Category:Portal Wiki translation]] | [[Category:Portal Wiki translation]] |