User:1416006136/Template:Lang/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
(Redirected page to Template:Lang/doc)
Tag: New redirect
 
Line 1: Line 1:
{{Doc/subpage}}__NOTOC__
#REDIRECT [[Template:Lang/doc]]
This template is an improved version of {{tl2|Otherlang2}}. It retains all the functionality and ''automatically'' detects which languages a page has been translated into. It works on English and non-English pages, with or without namespaces. Otherlang2 may still be used, in the rare case that a translated page does not follow the wiki's [[Valve Developer Community:Alternative Languages|standard method]] for translated page titles.
 
== Parameters and Examples ==
{| class="standard-table sortable" style="width:100%;"
! Parameter !! Description !! Example
|-
|align="center"|{{Code|style=1|{{param|1}}}}
|The page that the template create multi-language links according to. It is required for other translation page. The contents of it should be the full name of the page the template is being applied on, including namespaces such as {{Code|Help:}}, {{Code|Template:}}, {{Code|User:}}, etc. It should not include any language suffixes, however, such as {{Code|:ru}}, {{Code|:es}}, {{Code|:zh-cn}}, etc.
{{ModernNote|Capitalization matters, even on the first letter of the page name! Underscores must be replaced with spaces. {{Code|select=1|ai_changehintgroup}} must be written as {{Code|select=1|Ai changehintgroup}}. However, this parameter can be omitted if the page name is without a suffix.}}
| {{CodeBlock|<nowiki>{{lang|Template:Lang}}</nowiki>}}
|-
|align="center"|{{Code|style=1|{{param|2}}}} ~ {{Code|style=1|{{param|8}}}}
|These parameters are used to link subpages (such as {{Code|[[L4D2 Level Design/Add-on Notes]]}}, {{Code|[[L4D Level Design/Panic Events]]}}, {{Code|[[Half-Life: Alyx Workshop Tools/Animgraph/AnimGraph Introduction]]}}, etc.). '''Just replace "{{Code|select=1|/}}" with "{{Code|select=1|{{!}}}}" to link correctly.''' See the examples for details how to use them.
{{ModernNote|'''Do not link subpages with "{{Code|select=1|/}}"!''' Use "{{Code|select=1|{{!}}}}" instead of "{{Code|select=1|/}}". Therefore, the template can link the pages correctly.}}
{{ModernNote|The page must be moved to a correctly name so that the template can link them. '''Non-English subpage names must follow this format:''' {{Code|<page1><lang code>/<page2><lang code>/...}}, such as {{Code|[[L4D Level Design:zh-cn/Panic Events:zh-cn]]}}}}
| {{CodeBlock|<nowiki>{{lang|L4D2 Level Design|Add-on Notes}}</nowiki>}}
{{CodeBlock|<nowiki>{{lang|L4D Level Design|Panic Events}}</nowiki>}}
{{CodeBlock|<nowiki>{{lang|Half-Life: Alyx Workshop Tools|Animgraph|AnimGraph Introduction}}</nowiki>}}
|-
|align="center"|{{Code|style=1|{{param|title}}}}
|This parameter can be used to change the text of the page titlebar (logically, into the text that should be displayed for the language of the page).
{{ModernWarning|On some pages you may receive this error: '''Warning''': Display title "env_cubemap" overrides earlier display title <nowiki>"<code>Env cubemap</code>"</nowiki>. This can be due to the fact that the page uses a different template in which the page title is set.}}
| {{CodeBlock|<nowiki>{{lang|title=Template:Lang}}</nowiki>}}
|-
|align="center"|{{Code|style=1|{{param|$title}}}}
|This parameter can be used to change the text of the page titlebar and place the title under the <nowiki><code></nowiki> tag - '''<nowiki>{{lang|Template:Lang|$title=$model}}</nowiki>'''.
| {{CodeBlock|<nowiki>{{lang|$title=Template:Lang}}</nowiki>}}
|-
|align="center"|{{Code|style=1|{{param|notitle}}}}
|This parameter can be used to change the title of the site page itself, but not for the title of the article itself.
| {{CodeBlock|<nowiki>{{lang|notitle=1}}</nowiki>}}
|-
|align="center"|{{Code|style=1|{{param|noborder}}}}
|This parameter can be set to 1 to hide the border around lang icons. If you don't plan on using it, don't bother defining it.
| {{CodeBlock|<nowiki>{{lang|noborder=1}}</nowiki>}}
|-
|align="center"|{{Code|style=1|{{param|select}}}}
|The selection mode of the title. {{Code|1|select=1}} is the one-click selection (just like clicking the "1").
| {{CodeBlock|<nowiki>{{lang|Template:Lang|select=1}}</nowiki>}}
|-
|align="center"|{{Code|style=1|{{param|up}}}}
|{{ModernTodo|Document it.}}
| {{Todo}}
|-
|}
 
=== Examples ===
Here's an example for a hypothetical Spanish page called '''Category:Hello:es''':
{{CodeBlock|<nowiki>{{lang|Category:Hello|title=Categoría:Hola}}</nowiki>}}
 
This will add icons for all the versions of this page in different languages. It will also change the displayed title to a Spanish version of the name.
 
== Currently Supported Languages ==
{| class="standard-table sortable" style="width:100%;"
|+ Currently Supported Languages
! Language !! Page name !! Icon !! Icon Template
|-
|English                ||Page_name        ||{{en}}  ||{{tl|en}}
|-
|Catalan                ||Page_name:ca    ||{{ca}}  ||{{tl|ca}}
|-
|Czech                  ||Page_name:cs    ||{{cz}}  ||{{tl|cz}}
|-
|German                ||Page_name:de    ||{{de}}  ||{{tl|de}}
|-
|Spanish                ||Page_name:es    ||{{es}}  ||{{tl|es}}
|-
|Estonian              ||Page_name:et    ||{{et}}  ||{{tl|et}}
|-
|French                ||Page_name:fr    ||{{fr}}  ||{{tl|fr}}
|-
|Hungarian              ||Page_name:hu    ||{{hu}}  ||{{tl|hu}}
|-
|Italian                ||Page_name:it    ||{{it}}  ||{{tl|it}}
|-
|Dutch                  ||Page_name:nl    ||{{nl}}  ||{{tl|nl}}
|-
|Norwegian              ||Page_name:no    ||{{norway}} ||{{tl|norway}}
|-
|Polish                ||Page_name:pl    ||{{pl}}  ||{{tl|pl}}
|-
|Portuguese            ||Page_name:pt    ||{{pt}}  ||{{tl|pt}}
|-
|Portuguese (Brazilian) ||Page_name:pt-br  ||{{pt-br}} ||{{tl|pt-br}}
|-
|Russian                ||Page_name:ru    ||{{ru}}  ||{{tl|ru}}
|-
|Ukrainian              ||Page_name:uk    ||{{uk}}  ||{{tl|uk}}
|-
|Swedish                ||Page_name:sv    ||{{sv}}  ||{{tl|sv}}
|-
|Turkish                ||Page_name:tr    ||{{tr}}  ||{{tl|tr}}
|-
|Japanese              ||Page_name:ja    ||{{ja}}  ||{{tl|ja}}
|-
|Chinese (PRC)          ||Page_name:zh-cn  ||{{zh-cn}} ||{{tl|zh-cn}}
|-
|Chinese (Taiwan)      ||Page_name:zh-tw  ||{{zh-tw}} ||{{tl|zh-tw}}
|-
|Korean                ||Page_name:ko    ||{{ko}}  ||{{tl|ko}}
|-
|Georgian              ||Page_name:ka    ||{{ka}}  ||{{tl|ka}}
|-
|Hebrew                ||Page_name:he    ||{{he}}  ||{{tl|he}}
|}
*Also, this template automatically adds a page language category at the bottom of the page.
 
{{ModernNote|Most of these language codes are [[w:ISO 639|ISO 639]] codes.}}
 
<includeonly>[[Category:Translation templates]]</includeonly>

Latest revision as of 10:40, 23 February 2023

Redirect to: