Template:Language/archives/Lang2/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 14: Line 14:
|- bgcolor="#3A3A3A"
|- bgcolor="#3A3A3A"
| Preview languages || {{Yes}} || {{Yes}} || {{Yes}} || {{No|English only}}
| Preview languages || {{Yes}} || {{Yes}} || {{Yes}} || {{No|English only}}
|}
== 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|<nowiki>/ru</nowiki>}}, {{Code|<nowiki>/es</nowiki>}}, {{Code|<nowiki>/zh</nowiki>}}, etc.
{{note|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.}}
{{Tip|You can use {{Code|<nowiki>{{lang|title={{FULLPAGENAME}}}}</nowiki>}} instead of writing the article name, unless there are any issues mentioned above.}}
| {{CodeBlock|<nowiki>{{lang|title={{FULLPAGENAME}}}}</nowiki>}}<br>{{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.
{{note|'''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.}}
{{note|The subpages 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 page title (logically, into the text that should be displayed for the language of the page).
{{warning|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}}}}
|{{todo|Document it.}}
| {{Todo}}
|-
|}
|}


== Usage ==
== Usage ==
{{Todo|Documentations. English page should be on base page, while others are located in subpage, with {{code|/language-ids}} suffix at the end of the page name (Example: {{Code|Half-Life 2/vi}}, {{Code|Half-Life 2/zh}}, etc... just like {{T|MultiPage}}). Pages begin with prefix Lang-ID is not supported at the moment as it's requires alot of testing and this template may or may not work with them.}}
{{Todo|Documentations. English page should be on base page, while others are located in subpage, with {{code|/language-ids}} suffix at the end of the page name (Example: {{Code|Half-Life 2/vi}}, {{Code|Half-Life 2/zh}}, etc... just like {{T|MultiPage}}). Pages begin with prefix Lang-ID is not supported at the moment as it's requires alot of testing and this template may or may not work with them.}}

Revision as of 09:03, 4 July 2024

Edit-copy.png
This is a documentation subpage for Template:Language.
Don't forget to purge the contents of the base page upon creating or editing this subpage.
Under construction.png
This Template page is actively undergoing a major edit.
As a courtesy, please do not edit this Template while this message is displayed.
If this page has not been edited for at least several hours to a few days, please remove this template. This message is intended to help reduce edit conflicts; please remove it between editing sessions to allow others to edit the page.

The person who added this notice will be listed in its edit history should you wish to contact them.
Additional Notes: This template is not recommended to be used in any pages yet, as it's need to be tested.

A translation template. Successor to both {{Lang}} (itself was forked to create {{Lang2}}) and {{MultiPage}}, while solving most of the limitations in both templates. Currently the template is largely incomplete and cannot be used in any pages until bugs or issues is fixed. Also this template only support very few languages as it was being rewritten to only support languages that are most popular, and to cleaning up code before adding new languages.

Differences

Features {{Lang}} {{Lang2}} (this template) {{MultiPage}} {{Page}}
Language subpage location English: None (base page)
Other languages: Page_name{{:}}Lang
English: None (base page)
Other languages: Page_name/Lang
All, including English are located in Page_name/Lang.
The base page itself just contains {{MultiPage}}.
Rely on {{Strings}} or {{Autolang}}, meant that all other languages are hidden in the base page.
Requires purge? Base page only, in order to display the language
icons if the translated page (except English) is edited or created. [confirm]
Same as {{Lang}}[confirm]. Required No
Category translation support Yes, has separate translated category page which only list translated pages. Unknown Yes, but translated pages are not added to the translated category page, unlike {{Lang}}. Unknown
Preview languages Yes Yes Yes English only

Parameters and Examples

Parameter Description Example
{{{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 Help:, Template:, User:, etc. It should not include any language suffixes, however, such as /ru, /es, /zh, etc.
Note.pngNote:Capitalization matters, even on the first letter of the page name! Underscores must be replaced with spaces. ai_changehintgroup must be written as Ai changehintgroup. However, this parameter can be omitted if the page name is without a suffix.
Tip.pngTip:You can use {{lang|title={{FULLPAGENAME}}}} instead of writing the article name, unless there are any issues mentioned above.
{{lang|title={{FULLPAGENAME}}}}

{{lang|Template:Lang}}
{{{2}}} ~ {{{8}}} These parameters are used to link subpages (such as L4D2 Level Design/Add-on Notes, L4D Level Design/Panic Events, Half-Life: Alyx Workshop Tools/Animgraph/AnimGraph Introduction, etc.). Just replace "/" with "|" to link correctly. See the examples for details how to use them.
Note.pngNote:Do not link subpages with "/"! Use "|" instead of "/". Therefore, the template can link the pages correctly.
Note.pngNote:The subpages must be moved to a correctly name so that the template can link them. Non-English subpage names must follow this format: <page1><lang code>/<page2><lang code>/..., such as L4D Level Design:zh-cn/Panic Events:zh-cn
{{lang|L4D2 Level Design|Add-on Notes}}
{{lang|L4D Level Design|Panic Events}}
{{lang|Half-Life: Alyx Workshop Tools|Animgraph|AnimGraph Introduction}}
{{{title}}} This parameter can be used to change the page title (logically, into the text that should be displayed for the language of the page).
Warning.pngWarning:On some pages you may receive this error: Warning: Display title "env_cubemap" overrides earlier display title "<code>Env cubemap</code>". This can be due to the fact that the page uses a different template in which the page title is set.
{{lang|title=Template:Lang}}
{{{$title}}} This parameter can be used to change the text of the page titlebar and place the title under the <code> tag - {{lang|Template:Lang|$title=$model}}.
{{lang|$title=Template:Lang}}
{{{notitle}}} This parameter can be used to change the title of the site page itself, but not for the title of the article itself.
{{lang|notitle=1}}
{{{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.
{{lang|noborder=1}}
{{{select}}} The selection mode of the title. 1 is the one-click selection (just like clicking the "1").
{{lang|Template:Lang|select=1}}
{{{up}}}
Todo: Document it.
[Todo]

Usage

Todo: Documentations. English page should be on base page, while others are located in subpage, with /language-ids suffix at the end of the page name (Example: Half-Life 2/vi, Half-Life 2/zh, etc... just like {{MultiPage}}). Pages begin with prefix Lang-ID is not supported at the moment as it's requires alot of testing and this template may or may not work with them.