Template:Lang/doc

From Valve Developer Community
Jump to: navigation, search
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. As of 2023 (and still ongoing), it is slowly being replaced by {{MultiPage}}, which supports more languages and they are fully ISO 639 compliant.

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-cn, 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.
{{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 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.
{{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}}}
Blank image.pngTodo: Document it.
Blank image.pngTodo:

Examples

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

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

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

Currently Supported Languages
Language Page name Icon
English Page_name English (en)
Esperanto Page_name:eo Esperanto (eo)
Catalan Page_name:ca Català (ca)
Czech Page_name:cs Čeština (cs)
German Page_name:de Deutsch (de)
Spanish Page_name:es Español (es)
Estonian Page_name:et Eesti (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 (no)
Polish Page_name:pl Polski (pl)
Portuguese Page_name:pt Português (pt)
Portuguese (Brazilian) Page_name:pt-br Português do Brasil (pt-br)
Russian Page_name:ru Русский (ru)
Ukrainian Page_name:uk Українська (uk)
Swedish Page_name:sv Svenska (sv)
Turkish Page_name:tr Türkçe (tr)
Japanese Page_name:ja 日本語 (ja)
Chinese (PRC) Page_name:zh-cn 中文 (zh)
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, not all of them of these language codes are compliant ISO 639 codes.