Template:Lang: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
mNo edit summary
(Used Flag templates and added column naming them.)
Line 21: Line 21:
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.
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:
{| class="standard-table sortable"
{| class="standard-table"
|+ Currently Supported Languages
! Language !! Page name !! Icon
! Language !! Page name !! Icon !! Icon Template
|-  
|-  
|English                ||Page_name          ||[[File:En.png]]
|English                ||Page_name          ||{{en}} ||{{tl|en}}
|-  
|-  
|Catalan                ||Page_name:ca      ||[[File:Ca.png]]
|Catalan                ||Page_name:ca      ||{{ca}} ||{{tl|ca}}
|-  
|-  
|Czech                  ||Page_name:cs      ||[[File:Cs.png]]
|Czech                  ||Page_name:cs      ||{{cz}} ||{{tl|cz}}
|-  
|-  
|German                ||Page_name:de      ||[[File:De.png]]
|German                ||Page_name:de      ||{{de}} ||{{tl|de}}
|-  
|-  
|Spanish                ||Page_name:es      ||[[File:Es.png]]
|Spanish                ||Page_name:es      ||{{es}} ||{{tl|es}}
|-
|-
|Estonian              ||Page_name:et      ||[[File:Et.png]]
|Estonian              ||Page_name:et      ||{{et}} ||{{tl|et}}
|-  
|-  
|French                ||Page_name:fr      ||[[File:Fr.png]]
|French                ||Page_name:fr      ||{{fr}} ||{{tl|fr}}
|-  
|-  
|Hungarian              ||Page_name:hu      ||[[File:Hu.png]]
|Hungarian              ||Page_name:hu      ||{{hu}} ||{{tl|hu}}
|-  
|-  
|Italian                ||Page_name:it      ||[[File:It.png]]
|Italian                ||Page_name:it      ||{{it}} ||{{tl|it}}
|-  
|-  
|Dutch                  ||Page_name:nl      ||[[File:nl.png]]
|Dutch                  ||Page_name:nl      ||{{nl}} ||{{tl|nl}}
|-  
|-  
|Norwegian              ||Page_name:no      ||[[File:No.png]]
|Norwegian              ||Page_name:no      ||{{norway}} ||{{tl|norway}}
|-  
|-  
|Polish                ||Page_name:pl      ||[[File:Pl.png]]
|Polish                ||Page_name:pl      ||{{pl}} ||{{tl|pl}}
|-  
|-  
|Portuguese            ||Page_name:pt      ||[[File:Pt.png]]
|Portuguese            ||Page_name:pt      ||{{pt}} ||{{tl|pt}}
|-  
|-  
|Portuguese (Brazilian) ||Page_name:pt-br    ||[[File:Pt-br.png]]
|Portuguese (Brazilian) ||Page_name:pt-br    ||{{pt-br}} ||{{tl|pt-br}}
|-  
|-  
|Russian                ||Page_name:ru      ||[[File:Ru.png]]
|Russian                ||Page_name:ru      ||{{ru}} ||{{tl|ru}}
|-  
|-  
|Ukrainian              ||Page_name:ua      ||[[File:ua.png]]
|Ukrainian              ||Page_name:ua      ||{{ua}} ||{{tl|ua}}
|-  
|-  
|Swedish                ||Page_name:sv      ||[[File:Sv.png]]
|Swedish                ||Page_name:sv      ||{{sv}} ||{{tl|sv}}
|-  
|-  
|Turkish                ||Page_name:tr      ||[[File:Tr.png]]
|Turkish                ||Page_name:tr      ||{{tr}} ||{{tl|tr}}
|-  
|-  
|Japanese              ||Page_name:jp      ||[[File:Jp.png]]
|Japanese              ||Page_name:jp      ||{{jp}} ||{{tl|jp}}
|-  
|-  
|Chinese (PRC)          ||Page_name:zh-cn    ||[[File:Cn.png]]
|Chinese (PRC)          ||Page_name:zh-cn    ||{{zh-cn}} ||{{tl|zh-cn}}
|-  
|-  
|Chinese (Taiwan)      ||Page_name:zh-tw    ||[[File:Tw.png]]
|Chinese (Taiwan)      ||Page_name:zh-tw    ||{{zh-tw}} ||{{tl|zh-tw}}
|-  
|-  
|Korean                ||Page_name:ko      ||[[File:Ko.png]]
|Korean                ||Page_name:ko      ||{{ko}} ||{{tl|ko}}
|-  
|-  
|Georgian              ||Page_name:ka      ||[[File:Ka.png]]
|Georgian              ||Page_name:ka      ||{{ka}} ||{{tl|ka}}
|-  
|-  
|Hebrew                ||Page_name:he      ||[[File:He.png]]
|Hebrew                ||Page_name:he      ||{{he}} ||{{tl|he}}
|-  
|-  
|Greek                  ||Page_name:gr      ||[[File:Gr1.png]]
|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.
For information on how the template detects other languages, view this page's source code.
{{note|Not all of these language codes are [[w:ISO 3166-2|ISO 3166-2]] codes.}}
[[Category:Templates]]
[[Category:Templates]]
<onlyinclude><includeonly><!--
<onlyinclude><includeonly><!--
{{{1}}}: page's full name, including any namespace, but excluding any language suffix
{{{1}}}: page's full name, including any namespace, but excluding any language suffix

Revision as of 08:54, 25 February 2022

English

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.

  • 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:ua Template:Ua {{ua}}
Swedish Page_name:sv Svenska {{sv}}
Turkish Page_name:tr
{{tr}}
Japanese Page_name:jp Template:Jp {{jp}}
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}}
Greek Page_name:gr Template:Gr {{gr}}
  • 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.pngNote:Not all of these language codes are ISO 3166-2 codes.