Difference between revisions of "Template:Multi-lang"
m |
m |
||
Line 1: | Line 1: | ||
{{ | {{{{FULLPAGENAME}}|multiple=*}} | ||
== Template == | == Template == | ||
<onlyinclude>{{#if: | <onlyinclude>{{#if: | ||
{{#vardefine:ml-cat|{{#if:{{{category|}}}|{{{category|}}}/|{{#var:ml-cat}}}}}} | {{#vardefine:ml-cat|{{#if:{{{category|}}}|{{{category|}}}/|{{#var:ml-cat}}}}}} | ||
{{#vardefine:lang|{{#if:{{#var:lang}}|{{#var:lang}}|{{{2|}}}}}}} | {{#vardefine:lang|{{#if:{{#var:lang}}|{{#var:lang}}|{{{2|}}}}}}} | ||
{{#vardefine:ml-|-{{#len:{{#var:lang}}}}}} | {{#vardefine:ml-|-{{#len:{{#var:lang}}}}}} | ||
{{#vardefine:langbase|{{#if:{{#var:langbase}}|{{#var:langbase}}|{{#if:{{{1|}}}|{{{1|}}}|{{#if:{{#var:lang}}|{{#ifeq:{{#sub:{{FULLPAGENAME}}|{{#var:ml-}}}}|{{#var:lang}}|{{#sub:{{FULLPAGENAME}}|0|{{#var:ml-}}}}|{{FULLPAGENAME}}}}|{{#switch:{{#sub:{{FULLPAGENAME}}|-3|1}}|/|\={{#sub:{{FULLPAGENAME}}|0|-3}}|{{FULLPAGENAME}}}}}}}}}}}} | {{#vardefine:langbase|{{#if:{{#var:langbase}}|{{#var:langbase}}|{{#if:{{{1|}}}|{{{1|}}}|{{#if:{{#var:lang}}|{{#ifeq:{{#sub:{{FULLPAGENAME}}|{{#var:ml-}}}}|{{#var:lang}}|{{#sub:{{FULLPAGENAME}}|0|{{#var:ml-}}}}|{{FULLPAGENAME}}}}|{{#switch:{{#sub:{{FULLPAGENAME}}|-3|1}}|/|\={{#sub:{{FULLPAGENAME}}|0|-3}}|{{FULLPAGENAME}}}}}}}}}}}} | ||
{{#vardefine:ml-|{{#sub:{{FULLPAGENAME}}|{{#len:{{#var:langbase}}}}}}}} | {{#vardefine:ml-|{{#sub:{{FULLPAGENAME}}|{{#len:{{#var:langbase}}}}}}}} | ||
{{#vardefine:lang|{{#if:{{#var:lang}}|{{#var:lang}}|{{#switch:{{#sub:{{#var:ml-}}|0|1}}|/|\={{#var:ml-}}|}}}}}} | {{#vardefine:lang|{{#if:{{#var:lang}}|{{#var:lang}}|{{#switch:{{#sub:{{#var:ml-}}|0|1}}|/|\={{#var:ml-}}|}}}}}} | ||
{{#vardefine:ml-base-version|{{#ifexist:{{#var:langbase}}/version|{{{{#var:langbase}}/version|ml-base-version}}|-1.0}}}} | |||
}}{{#if:{{#var:ml-included}}||<div class="LanguageLinks" style="margin: 1em 0;"> | }}{{#if:{{#var:ml-included}}||<div class="LanguageLinks" style="margin: 1em 0;"> | ||
<table width="100%" style="clear: both; border: 1px solid #aaaaaa; border-collapse: collapse; padding: 0.2em; margin: 0; font-size: 85%; margin: 0 1px;"> | <table width="100%" style="clear: both; border: 1px solid #aaaaaa; border-collapse: collapse; padding: 0.2em; margin: 0; font-size: 85%; margin: 0 1px;"> | ||
Line 13: | Line 22: | ||
<td style="width: 10px; white-space: nowrap; padding: 4px 1em 0 0.5em; border-right: 1px solid #aaaaaa;">'''[[Project:Languages|Languages]]:''' </td><td style="padding: 1px 1em 0; background: #F6F9ED;"> | <td style="width: 10px; white-space: nowrap; padding: 4px 1em 0 0.5em; border-right: 1px solid #aaaaaa;">'''[[Project:Languages|Languages]]:''' </td><td style="padding: 1px 1em 0; background: #F6F9ED;"> | ||
'''[[:{{#var:langbase}}|English]]''' | '''[[:{{#var:langbase}}|English]]''' | ||
{{Languages/Lang|de|{{#var:langbase}}|Deutsch| | {{Languages/Lang|de|{{#var:langbase}}|Deutsch|}} | ||
{{Languages/Lang|es|{{#var:langbase}}|Español| | {{Languages/Lang|es|{{#var:langbase}}|Español|}} | ||
{{Languages/Lang|el|{{#var:langbase}}|ελληνικά| | {{Languages/Lang|el|{{#var:langbase}}|ελληνικά|}} | ||
{{Languages/Lang|fr|{{#var:langbase}}|Français| | {{Languages/Lang|fr|{{#var:langbase}}|Français|}} | ||
{{Languages/Lang|he|{{#var:langbase}}|עברית| | {{Languages/Lang|he|{{#var:langbase}}|עברית|}} | ||
{{Languages/Lang|it|{{#var:langbase}}|Italiano| | {{Languages/Lang|it|{{#var:langbase}}|Italiano|}} | ||
{{Languages/Lang|ja|{{#var:langbase}}|日本語| | {{Languages/Lang|ja|{{#var:langbase}}|日本語|}} | ||
{{Languages/Lang|ko|{{#var:langbase}}|한국어| | {{Languages/Lang|ko|{{#var:langbase}}|한국어|}} | ||
{{Languages/Lang|nl|{{#var:langbase}}|Nederlands| | {{Languages/Lang|nl|{{#var:langbase}}|Nederlands|}} | ||
{{Languages/Lang|no|{{#var:langbase}}|Norsk| | {{Languages/Lang|no|{{#var:langbase}}|Norsk|}} | ||
{{Languages/Lang|da|{{#var:langbase}}|Dansk| | {{Languages/Lang|da|{{#var:langbase}}|Dansk|}} | ||
{{Languages/Lang|sv|{{#var:langbase}}|Svenska| | {{Languages/Lang|sv|{{#var:langbase}}|Svenska|}} | ||
{{Languages/Lang|pl|{{#var:langbase}}|Polski| | {{Languages/Lang|pl|{{#var:langbase}}|Polski|}} | ||
{{Languages/Lang|pt|{{#var:langbase}}|Português| | {{Languages/Lang|pt|{{#var:langbase}}|Português|}} | ||
{{Languages/Lang|ru|{{#var:langbase}}|Русский| | {{Languages/Lang|ru|{{#var:langbase}}|Русский|}} | ||
{{Languages/Lang|zh-Hans|{{#var:langbase}}|中文(简体)| | {{Languages/Lang|zh-Hans|{{#var:langbase}}|中文(简体)|}} | ||
{{Languages/Lang|zh-Hant|{{#var:langbase}}|中文(繁體)| | {{Languages/Lang|zh-Hant|{{#var:langbase}}|中文(繁體)|}} | ||
</td></tr></table><div width="0" height="0" id="PageLanguage" style="display:none;">{{#var:lang}}</div></div>}}{{#vardefine:ml-included|{{#if:{{{multiple|}}}||*}}}}</onlyinclude> | </td></tr></table> | ||
<div width="0" height="0" id="PageLanguage" style="display:none;">{{#var:lang}}</div> | |||
<div width="0" height="0" id="PageCategory" style="display:none;">{{#var:ml-cat}}</div> | |||
{{#if:{{#var:lang}}| | |||
{{#ifexpr:({{#var:ml-base-version}} > 0.0) and ({{#if:{{{version|}}}|{{{version|}}}|0.0}} >= 0.0)| | |||
{{#ifexpr:{{#var:ml-base-version}} > {{#if:{{{version|}}}|{{{version|}}}|0.0}} | |||
|[[Category:Articles in need of updating{{#var:ml-cat}}{{#var:lang}}]]{{#if:{{#var:ml-base-message}}| | |||
{{Help/Box|1={{#if:{{#var:ml-base-message-title}}|{{#var:ml-base-message-title}}|Page in need of update}}|2= | |||
{{#var:ml-base-message}}}}}} | |||
|{{#ifexpr:{{#var:ml-base-version}} < {{#if:{{{version|}}}|{{{version|}}}|0.0}}| | |||
{{Help/Box|1=[[Multi-lang]] Usage Error|2= | |||
Article version supplied exceeds base article version!!! | |||
*Max article version supported: [[{{#var:langbase}}/version#Article_Version|{{#var:ml-base-version}}]] | |||
*Article version supplied: {{{version|}}} | |||
}}}}}}}}|{{#ifexpr:{{#var:ml-base-version}} < 0.0|[[Category:Articles in need of version number{{#var:ml-cat}}{{#var:lang}}]]|}}}}</div>}}{{#vardefine:ml-included|{{#if:{{{multiple|}}}||*}}}}</onlyinclude> | |||
== Syntax == | == Syntax == |
Revision as of 22:50, 29 October 2008
Template
Syntax
{{Multi-lang|PageName|Language Code}}
- PageName (optional) - the name of the page to display language links for. If omitted then the English version of the current page is used. This parameter can normally be omitted, as it is only required if you want to link to a page other than the one you place the template on, which is very uncommon. If this parameter is used on a sub-page make sure you supply the root name, not the full page name (e.g. on MediaWiki/fr you would need to use
{{Multi-lang|MediaWiki}}
and not{{Multi-lang|MediaWiki/fr}}
).
Usage
The template should be placed on pages that exist in more than one language, and it should be placed in the same location on each translation of the page.
The English version of a page is always the main version, with all other languages as sub-pages, named using the appropriate language code (see below).
For example, on the Main Page you would include the text {{Multi-lang}}
, both on Main Page itself, and on each of its language sub-pages. The template automatically creates links to any language sub-pages that exist, e.g. Main Page/ja, Main Page/fr, and ignores non-existent languages.
See Project:Languages for further details about translating pages.
Supported languages
The template includes a list of supported languages in it. Although it is easy to add a new language to the list, it is not recommended to add unnecessary languages. The language that has no pages in that language should be kept out of the list.
Articles in need of translation
The following link to articles in need of translation. They are in no particular order.
- dansk *
- Deutsch *
- español *
- Ελληνικά *
- français *
- עברית *
- italiano *
- 日本語 *
- 한국어 *
- magyar *
- Nederlands *
- Norsk *
- polski *
- português *
- русский *
- українська *
- svenska *
- Türkçe *
- ไทย *
- 中文(简体) *
- 中文(繁體) *
Related:
Origin
This template is originally taken from Template:Languages on the MediaWiki web site.