Template:Lang/doc: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (moved from the "Templates" category (which isn't supposed to contain templates themselves, only categories) to the "Translation templates" category.)
mNo edit summary
Line 1: Line 1:
{{Documentation subpage}}
<noinclude>[[Category:English]]{{doc|0}}</noinclude>__NOTOC__
<!-- Please place categories where indicated at the bottom of this page.) -->
This template is an improved version of {{tl|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.


Unlike {{tl|otherlang2}}, this template requires an unnamed parameter to be defined to work. The contents of it should be the full name of the page the template is being applied on, including namespaces such as '''Help:'''. It should not include any language suffixes, however, such as ''':ru'''. Capitalization matters, even on the first letter of the page name! Underscores must be replaced with spaces. <code>ai_changehintgroup</code> must be written as <code>Ai changehintgroup</code>.
This template is an improved version of <code style=padding:0><nowiki>{{Otherlang2}}</nowiki></code>. 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.
 
Unlike <code style=padding:0><nowiki>{{Otherlang2}}</nowiki></code>, this template requires an unnamed parameter to be defined to work. The contents of it should be the full name of the page the template is being applied on, including namespaces such as '''Help:'''. It should not include any language suffixes, however, such as ''':ru'''. Capitalization matters, even on the first letter of the page name! Underscores must be replaced with spaces. <code>ai_changehintgroup</code> must be written as <code>Ai changehintgroup</code>. However, this parameter can be omitted if the page name is without a suffix.


*The <code style="color:white">title</code> 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).
*The <code style="color:white">title</code> 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).
Line 56: Line 56:
|Russian                ||Page_name:ru      ||{{ru}} ||{{tl|ru}}
|Russian                ||Page_name:ru      ||{{ru}} ||{{tl|ru}}
|-  
|-  
|Ukrainian              ||Page_name:ua       ||{{ua}} ||{{tl|ua}}
|Ukrainian              ||Page_name:uk       ||{{uk}} ||{{tl|uk}}
|-  
|-  
|Swedish                ||Page_name:se       ||{{sv}} ||{{tl|se}}
|Swedish                ||Page_name:sv       ||{{sv}} ||{{tl|sv}}
|-  
|-  
|Turkish                ||Page_name:tr      ||{{tr}} ||{{tl|tr}}
|Turkish                ||Page_name:tr      ||{{tr}} ||{{tl|tr}}
|-  
|-  
|Japanese              ||Page_name:jp       ||{{jp}} ||{{tl|jp}}
|Japanese              ||Page_name:ja       ||{{ja}} ||{{tl|ja}}
|-  
|-  
|Chinese (PRC)          ||Page_name:zh-cn    ||{{zh-cn}} ||{{tl|zh-cn}}
|Chinese (PRC)          ||Page_name:zh-cn    ||{{zh-cn}} ||{{tl|zh-cn}}
Line 70: Line 70:
|Korean                ||Page_name:ko      ||{{ko}} ||{{tl|ko}}
|Korean                ||Page_name:ko      ||{{ko}} ||{{tl|ko}}
|-  
|-  
|Georgian              ||Page_name:ge       ||{{ge}} ||{{tl|ge}}
|Georgian              ||Page_name:ka       ||{{ka}} ||{{tl|ka}}
|-  
|-  
|Hebrew                ||Page_name:he      ||{{he}} ||{{tl|he}}
|Hebrew                ||Page_name:he      ||{{he}} ||{{tl|he}}
|-
|Greek                  ||Page_name:gr      ||{{gr}} ||{{tl|gr}}
|}
|}
*Also, this template automatically adds a page language category at the bottom of the page.
*Also, this template automatically adds a page language category at the bottom of the page.
For information on how the template detects other languages, view this page's source code.


{{note|Most of these language codes are [[w:ISO 639|ISO 639]] codes.}}
{{note|Most of these language codes are [[w:ISO 639|ISO 639]] codes.}}


<includeonly>{{sandbox other||
<includeonly>[[Category:Translation templates]]</includeonly>
<!-- Categories below this line, please -->
[[Category:Translation templates]]
}}</includeonly>

Revision as of 19:04, 2 December 2022

English (en)Deutsch (de)Esperanto (eo)Español (es)Français (fr)Suomi (fi)Hrvatski (hr)Magyar (hu)Italiano (it)日本語 (ja)한국어 (ko)Nederlands (nl)Polski (pl)Português (pt)Português do Brasil (pt-br)Русский (ru)Slovenčina (sk)Svenska (sv)Türkçe (tr)Українська (uk)Tiếng Việt (vi)中文 (zh)中文(臺灣) (zh-tw)
Edit-copy.png
This is a documentation subpage for Template:Lang.
Don't forget to purge the contents of the base page upon creating or editing this subpage.

This template is an improved version of {{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 standard method for translated page titles.

Unlike {{Otherlang2}}, this template requires an unnamed parameter to be defined to work. The contents of it should be the full name of the page the template is being applied on, including namespaces such as Help:. It should not include any language suffixes, however, such as :ru. 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.

  • The title 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).
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.
  • The $title 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}}.
  • The notitle parameter can be used to change the title of the site page itself, but not for the Title of the article itself.
  • The noline parameter can be set to 1 to hide the line under the title. If you don't plan on using it, don't bother defining it.
  • The noborder 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.

Here's an example for a hypothetical Spanish page called Category:Hello:es:

{{lang|Category:Hello|title=Categoría:Hola|noline=1}}

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, and hide the line under the title.

Currently Supported Languages
Language Page name Icon Icon Template
English Page_name English {{en}}
Catalan Page_name:ca Català {{ca}}
Czech Page_name:cs Čeština {{cz}}
German Page_name:de Deutsch {{de}}
Spanish Page_name:es Español {{es}}
Estonian Page_name:et Eestlane {{et}}
French Page_name:fr Français {{fr}}
Hungarian Page_name:hu Magyar {{hu}}
Italian Page_name:it Italiano {{it}}
Dutch Page_name:nl Nederlands {{nl}}
Norwegian Page_name:no Norsk {{norway}}
Polish Page_name:pl Polski {{pl}}
Portuguese Page_name:pt Português {{pt}}
Portuguese (Brazilian) Page_name:pt-br Português-Brasileiro {{pt-br}}
Russian Page_name:ru Русский {{ru}}
Ukrainian Page_name:uk Українська {{uk}}
Swedish Page_name:sv Svenska {{sv}}
Turkish Page_name:tr
{{tr}}
Japanese Page_name:ja 日本語 {{ja}}
Chinese (PRC) Page_name:zh-cn 简体中文 {{zh-cn}}
Chinese (Taiwan) Page_name:zh-tw 正體中文 {{zh-tw}}
Korean Page_name:ko 한국어 {{ko}}
Georgian Page_name:ka ქართული ენა {{ka}}
Hebrew Page_name:he עִברִית {{he}}
  • Also, this template automatically adds a page language category at the bottom of the page.
Note.pngNote:Most of these language codes are ISO 639 codes.