Template:Lang: Difference between revisions
m (add noline and notitle parameters) |
mNo edit summary |
||
Line 4: | Line 4: | ||
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. <code>ai_changehintgroup</code> must be written as <code>Ai changehintgroup</code>. | 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. <code>ai_changehintgroup</code> must be written as <code>Ai changehintgroup</code>. | ||
*The <code>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). | ||
*There is also a <code>notitle</code> parameter so that the page title is not displayed - '''<nowiki>{{lang|Template:Lang|notitle=1}}</nowiki>'''. | *The <code style="color:white">$title</code> parameter can be set to <code>1</code> to place the title of the article under the <nowiki><code></nowiki> tag. If you use it, you don't need to write any title - '''<nowiki>{{lang|Template:Lang|$title=1}}</nowiki>'''. | ||
*There is also a <code style="color:white">notitle</code> parameter which can be set to <code>1</code> so that the page title is not displayed - '''<nowiki>{{lang|Template:Lang|notitle=1}}</nowiki>'''. | |||
{{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.}} | {{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.}} | ||
{{Warning|do not use <code>title</code> and <code>notitle</code> together, otherwise you will have exactly the same error as the previous one.}} | {{Warning|do not use <code>title</code> and <code>notitle</code> together, otherwise you will have exactly the same error as the previous one.}} | ||
*The <code>noborder</code> parameter can be set to <code>1</code> to hide the border around icons. If you don't plan on using it, don't bother defining it. | *The <code style="color:white">noborder</code> parameter can be set to <code>1</code> to hide the border around icons. If you don't plan on using it, don't bother defining it. | ||
*The <code>noline</code> parameter can be set to <code>1</code> to hide the line under the title. If you don't plan on using it, don't bother defining it. | *The <code style="color:white">noline</code> parameter can be set to <code>1</code> to hide the line under the title. 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''': | Here's an example for a hypothetical Spanish page called '''Category:Hello:es''': | ||
Line 96: | Line 98: | ||
No title | No title | ||
-->{{#if: {{{notitle|}}} | {{DISPLAYTITLE:<span style="display:none">{{FULLPAGENAME}}</span>}} }}<!-- | -->{{#if: {{{notitle|}}} | {{DISPLAYTITLE:<span style="display:none">{{FULLPAGENAME}}</span>}} }}<!-- | ||
$title | |||
-->{{#if: {{{$title|}}} | {{DISPLAYTITLE:<code>{{PAGENAME}}</code>}} }}<!-- | |||
English | English |
Revision as of 11:55, 8 June 2021

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
$title
parameter can be set to1
to place the title of the article under the <code> tag. If you use it, you don't need to write any title - {{lang|Template:Lang|$title=1}}.
- There is also a
notitle
parameter which can be set to1
so that the page title is not displayed - {{lang|Template:Lang|notitle=1}}.


title
and notitle
together, otherwise you will have exactly the same error as the previous one.- The
noborder
parameter can be set to1
to hide the border around icons. If you don't plan on using it, don't bother defining it.
- The
noline
parameter can be set to1
to hide the line under the title. 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:
- Also, this template automatically adds a page language category at the bottom of the page.
[Todo] simplify code for <mark> tags
For information on how the template detects other languages, view this page's source code.