Template:Lang: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(english flag liked to have extra spacing.)
m (added some noincludes so the amount of data wasted loading html comments is way less)
Line 89: Line 89:
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.


----</noinclude><!--
----<!--
{{{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
{{ARTICLEPAGENAME}}: page's full name, including any namespace and/or language suffix
{{ARTICLEPAGENAME}}: page's full name, including any namespace and/or language suffix
Line 95: Line 95:


title
title
-->{{#if: {{{title|}}} | {{DISPLAYTITLE:{{{title}}}}} }}<!--
--></noinclude>{{#if: {{{title|}}} | {{DISPLAYTITLE:{{{title}}}}} }}<!--<noinclude>


html to make the buttons appear in the header space
html to make the buttons appear in the header space
--><div style="position:relative;top:-32px;margin-bottom: -40px;float:right;text-align:right;padding:2px;line-height:11px;background:#262626;<!--
</noinclude>--><div style="position:relative;top:-32px;margin-bottom: -40px;float:right;text-align:right;padding:2px;line-height:11px;background:#262626;<!--<noinclude>


optional taking away of the icon borders
optional taking away of the icon borders
-->{{#if: {{{noborder|}}} | margin-top:5px;border:0; | border:1px solid #65635F;border-bottom:0;}}"><!--
</noinclude>-->{{#if: {{{noborder|}}} | margin-top:5px;border:0; | border:1px solid #65635F;border-bottom:0;}}"><!--<noinclude>


For English:
For English:
Line 108: Line 108:
-If they do not match, show the English link, cause this is NOT the English page.
-If they do not match, show the English link, cause this is NOT the English page.
We're not going to test if the English page exists or not. It damn well better.
We're not going to test if the English page exists or not. It damn well better.
-->{{#ifeq: {{{1}}} | {{ARTICLEPAGENAME}} | | [[File:en.png|alt=English|link={{{1}}}]]}}<!--
</noinclude>-->{{#ifeq: {{{1}}} | {{ARTICLEPAGENAME}} | | [[File:en.png|alt=English|link={{{1}}}]]}}<!--<noinclude>


Other languages are a little more complex:
Other languages are a little more complex:
Line 118: Line 118:


Czech - cs
Czech - cs
-->{{#ifexist: {{{1}}}:cs | <!--
</noinclude>-->{{#ifexist: {{{1}}}:cs | <!--
   -->{{#ifeq: {{{1}}}:cs | {{ARTICLEPAGENAME}} | | [[File:cs.png|alt=Čeština|link={{{1}}}:cs]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:cs | {{ARTICLEPAGENAME}} | | [[File:cs.png|alt=Čeština|link={{{1}}}:cs]]&nbsp;}}<!--
--> | }} <!--
--> | }} <!--<noinclude>


German - de
German - de
-->{{#ifexist: {{{1}}}:de | <!--
</noinclude>-->{{#ifexist: {{{1}}}:de | <!--
   -->{{#ifeq: {{{1}}}:de | {{ARTICLEPAGENAME}} | | [[File:de.png|alt=Deutsch|link={{{1}}}:de]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:de | {{ARTICLEPAGENAME}} | | [[File:de.png|alt=Deutsch|link={{{1}}}:de]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Spanish - es
Spanish - es
-->{{#ifexist: {{{1}}}:es | <!--
</noinclude>-->{{#ifexist: {{{1}}}:es | <!--
   -->{{#ifeq: {{{1}}}:es | {{ARTICLEPAGENAME}} | | [[File:es.png|alt=Español|link={{{1}}}:es]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:es | {{ARTICLEPAGENAME}} | | [[File:es.png|alt=Español|link={{{1}}}:es]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


French - fr
French - fr
-->{{#ifexist: {{{1}}}:fr | <!--
</noinclude>-->{{#ifexist: {{{1}}}:fr | <!--
   -->{{#ifeq: {{{1}}}:fr | {{ARTICLEPAGENAME}} | | [[File:fr.png|alt=Français|link={{{1}}}:fr]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:fr | {{ARTICLEPAGENAME}} | | [[File:fr.png|alt=Français|link={{{1}}}:fr]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Hungarian - hu
Hungarian - hu
-->{{#ifexist: {{{1}}}:hu | <!--
</noinclude>-->{{#ifexist: {{{1}}}:hu | <!--
   -->{{#ifeq: {{{1}}}:hu | {{ARTICLEPAGENAME}} | | [[File:hu.png|alt=Magyar|link={{{1}}}:hu]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:hu | {{ARTICLEPAGENAME}} | | [[File:hu.png|alt=Magyar|link={{{1}}}:hu]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Italian - it
Italian - it
-->{{#ifexist: {{{1}}}:it | <!--
</noinclude>-->{{#ifexist: {{{1}}}:it | <!--
   -->{{#ifeq: {{{1}}}:it | {{ARTICLEPAGENAME}} | | [[File:it.png|alt=Italiano|link={{{1}}}:it]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:it | {{ARTICLEPAGENAME}} | | [[File:it.png|alt=Italiano|link={{{1}}}:it]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Dutch - nl
Dutch - nl
-->{{#ifexist: {{{1}}}:nl | <!--
</noinclude>-->{{#ifexist: {{{1}}}:nl | <!--
   -->{{#ifeq: {{{1}}}:nl | {{ARTICLEPAGENAME}} | | [[File:nl.png|alt=Nederlands|link={{{1}}}:nl]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:nl | {{ARTICLEPAGENAME}} | | [[File:nl.png|alt=Nederlands|link={{{1}}}:nl]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Norwegian - no
Norwegian - no
-->{{#ifexist: {{{1}}}:no | <!--
</noinclude>-->{{#ifexist: {{{1}}}:no | <!--
   -->{{#ifeq: {{{1}}}:no | {{ARTICLEPAGENAME}} | | [[File:no.png|alt=Norsk|link={{{1}}}:no]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:no | {{ARTICLEPAGENAME}} | | [[File:no.png|alt=Norsk|link={{{1}}}:no]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Polish - pl
Polish - pl
-->{{#ifexist: {{{1}}}:pl | <!--
</noinclude>-->{{#ifexist: {{{1}}}:pl | <!--
   -->{{#ifeq: {{{1}}}:pl | {{ARTICLEPAGENAME}} | | [[File:pl.png|alt=Polski|link={{{1}}}:pl]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:pl | {{ARTICLEPAGENAME}} | | [[File:pl.png|alt=Polski|link={{{1}}}:pl]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Portuguese - pt
Portuguese - pt
-->{{#ifexist: {{{1}}}:pt | <!--
</noinclude>-->{{#ifexist: {{{1}}}:pt | <!--
   -->{{#ifeq: {{{1}}}:pt | {{ARTICLEPAGENAME}} | | [[File:pt.png|alt=Português|link={{{1}}}:pt]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:pt | {{ARTICLEPAGENAME}} | | [[File:pt.png|alt=Português|link={{{1}}}:pt]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Brazilian Portuguese - pt-br
Brazilian Portuguese - pt-br
-->{{#ifexist: {{{1}}}:pt-br | <!--
</noinclude>-->{{#ifexist: {{{1}}}:pt-br | <!--
   -->{{#ifeq: {{{1}}}:pt-br | {{ARTICLEPAGENAME}} | | [[File:pt-br.png|alt=Português-Brasileiro|link={{{1}}}:pt-br]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:pt-br | {{ARTICLEPAGENAME}} | | [[File:pt-br.png|alt=Português-Brasileiro|link={{{1}}}:pt-br]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Russian - ru
Russian - ru
-->{{#ifexist: {{{1}}}:ru | <!--
</noinclude>-->{{#ifexist: {{{1}}}:ru | <!--
   -->{{#ifeq: {{{1}}}:ru | {{ARTICLEPAGENAME}} | | [[File:ru.png|alt=Русский|link={{{1}}}:ru]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:ru | {{ARTICLEPAGENAME}} | | [[File:ru.png|alt=Русский|link={{{1}}}:ru]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Ukrainian - ua
Ukrainian - ua
-->{{#ifexist: {{{1}}}:ua | <!--
</noinclude>-->{{#ifexist: {{{1}}}:ua | <!--
   -->{{#ifeq: {{{1}}}:ua | {{ARTICLEPAGENAME}} | | [[File:ua.png|alt=Українська|link={{{1}}}:ua]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:ua | {{ARTICLEPAGENAME}} | | [[File:ua.png|alt=Українська|link={{{1}}}:ua]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Swedish - sv
Swedish - sv
-->{{#ifexist: {{{1}}}:sv | <!--
</noinclude>-->{{#ifexist: {{{1}}}:sv | <!--
   -->{{#ifeq: {{{1}}}:sv | {{ARTICLEPAGENAME}} | | [[File:sv.png|alt=Svenska|link={{{1}}}:sv]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:sv | {{ARTICLEPAGENAME}} | | [[File:sv.png|alt=Svenska|link={{{1}}}:sv]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Turkish - tr
Turkish - tr
-->{{#ifexist: {{{1}}}:tr | <!--
</noinclude>-->{{#ifexist: {{{1}}}:tr | <!--
   -->{{#ifeq: {{{1}}}:tr | {{ARTICLEPAGENAME}} | | [[File:tr.png|alt=Türkçe|link={{{1}}}:tr]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:tr | {{ARTICLEPAGENAME}} | | [[File:tr.png|alt=Türkçe|link={{{1}}}:tr]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Japanese - jp
Japanese - jp
-->{{#ifexist: {{{1}}}:jp | <!--
</noinclude>-->{{#ifexist: {{{1}}}:jp | <!--
   -->{{#ifeq: {{{1}}}:jp | {{ARTICLEPAGENAME}} | | [[File:jp.png|alt=日本語|link={{{1}}}:jp]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:jp | {{ARTICLEPAGENAME}} | | [[File:jp.png|alt=日本語|link={{{1}}}:jp]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Simplified Chinese - zh-cn
Simplified Chinese - zh-cn
-->{{#ifexist: {{{1}}}:zh-cn | <!--
</noinclude>-->{{#ifexist: {{{1}}}:zh-cn | <!--
   -->{{#ifeq: {{{1}}}:zh-cn | {{ARTICLEPAGENAME}} | | [[File:cn.png|alt=简体中文|link={{{1}}}:zh-cn]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:zh-cn | {{ARTICLEPAGENAME}} | | [[File:cn.png|alt=简体中文|link={{{1}}}:zh-cn]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Taiwanese Mandarin - zh-tw
Taiwanese Mandarin - zh-tw
-->{{#ifexist: {{{1}}}:zh-tw | <!--
</noinclude>-->{{#ifexist: {{{1}}}:zh-tw | <!--
   -->{{#ifeq: {{{1}}}:zh-tw | {{ARTICLEPAGENAME}} | | [[File:tw.png|alt=简体中文|link={{{1}}}:zh-tw]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:zh-tw | {{ARTICLEPAGENAME}} | | [[File:tw.png|alt=简体中文|link={{{1}}}:zh-tw]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Korean - ko
Korean - ko
-->{{#ifexist: {{{1}}}:ko | <!--
</noinclude>-->{{#ifexist: {{{1}}}:ko | <!--
   -->{{#ifeq: {{{1}}}:ko | {{ARTICLEPAGENAME}} | | [[File:ko.png|alt=한국어|link={{{1}}}:ko]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:ko | {{ARTICLEPAGENAME}} | | [[File:ko.png|alt=한국어|link={{{1}}}:ko]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Georgian - ka
Georgian - ka
-->{{#ifexist: {{{1}}}:ka | <!--
</noinclude>-->{{#ifexist: {{{1}}}:ka | <!--
   -->{{#ifeq: {{{1}}}:ka | {{ARTICLEPAGENAME}} | | [[File:ka.png|alt=ქართული ენა|link={{{1}}}:ka]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:ka | {{ARTICLEPAGENAME}} | | [[File:ka.png|alt=ქართული ენა|link={{{1}}}:ka]]&nbsp;}}<!--
--> | }}<!--
--> | }}<!--<noinclude>


Hebrew - he
Hebrew - he
-->{{#ifexist: {{{1}}}:he | <!--
</noinclude>-->{{#ifexist: {{{1}}}:he | <!--
   -->{{#ifeq: {{{1}}}:he | {{ARTICLEPAGENAME}} | | [[File:he.png|alt=עִברִית|link={{{1}}}:he]]&nbsp;}}<!--
   -->{{#ifeq: {{{1}}}:he | {{ARTICLEPAGENAME}} | | [[File:he.png|alt=עִברִית|link={{{1}}}:he]]&nbsp;}}<!--
--> | }}</div>
--> | }}</div>

Revision as of 14:46, 6 October 2018

This template is an improved version of Template:Otherlang2. It retains all the functionality, adds Hebrew properly, 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).

The noborder parameter can be set to 1 to hide the border around 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
|noborder=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 icon borders.


Currently supported languages:

Language Page name Icon
English Page_name En.png
Chinese (PRC) Page_name:zh-cn Cn.png
Chinese (Taiwan) Page_name:zh-tw Tw.png
Czech Page_name:cs Cs.png
Dutch Page_name:nl Nl.png
French Page_name:fr Fr.png
Georgian Page_name:ka Ka.png
German Page_name:de De.png
Hebrew Page_name:he He.png
Hungarian Page_name:hu Hu.png
Italian Page_name:it It.png
Japanese Page_name:jp Jp.png
Korean Page_name:ko Ko.png
Norwegian Page_name:no No.png
Polish Page_name:pl Pl.png
Portuguese Page_name:pt Pt.png
Portuguese (Brazilian) Page_name:pt-br Pt-br.png
Russian Page_name:ru Ru.png
Ukrainian Page_name:ua Ua.png
Spanish Page_name:es Es.png
Swedish Page_name:sv Sv.png
Turkish Page_name:tr Tr.png

For information on how the template detects other languages, view this page's source code.


English