Template: Languages
m (debugging...) |
|||
(50 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
<noinclude> | <noinclude> | ||
− | This is the "Languages" template. | + | This is the "'''Languages'''" template. It provides a bar linking to the available translations of a page in the LibrePlanet wiki.<br /> |
+ | '''''PLEASE - Do not edit if you are not REALLY sure about what you are doing: it could broke the LibrePlanet wiki pages!''''' | ||
+ | <!-- | ||
+ | Coded by: alexus <http://libreplanet.org/wiki/User:Alexus> | ||
+ | Revision: 2.0 | ||
+ | Date: 25/01/2011 | ||
+ | --> | ||
− | + | '''Description''' | |
+ | |||
+ | This template shows a bar linking to the available translations of a page. Only works for the pages (should be the "original" master page and its translations) which include this template itself. | ||
+ | |||
+ | This template should be included, either in the "original" master page and in all its translations, ONLY IF almost one translation of the master page really exist in the wiki. | ||
+ | |||
+ | It also set the MediaWiki property 'Language code' of the page in which the template itself has being included (see below). | ||
+ | |||
+ | This template calls: | ||
+ | * the "LanguageOtherMsg" sub-template | ||
+ | * the "LanguageNativeLink" sub-template | ||
+ | |||
+ | '''Usage''' | ||
It should be called in the following format: | It should be called in the following format: | ||
<pre> | <pre> | ||
− | {{Languages| | + | {{Languages|master page=<MasterPage>|language=<LangCode>}} |
</pre> | </pre> | ||
+ | where: | ||
+ | * <MasterPage> is the "original" master page | ||
+ | * <LangCode> is the (2-digit lowercase) language code (ISO 639-1) of the content in the page in which the template itself has being included (either if it is the "original" master page or one of its translations) | ||
+ | |||
+ | '''''Note''''' - This also set the MediaWiki properties 'Language code' and 'Content language' of the calling page to the <LangCode> parameter. | ||
+ | |||
+ | '''Example''' | ||
− | + | If the "original" master page 'MyPage' is written in English (as more often is) and it has an Italian translation at the page 'MyPage/it", then: | |
− | </noinclude> | + | * into 'MyPage', include this: |
− | <includeonly> | + | <pre> |
− | {{#ifeq:{{#ask: [[master page::{{{master page}}}]] [[language code::!{{{language}}}]]|format=count}}|0||<div | + | {{Languages|master page=MyPage|language=en}} |
− | + | </pre> | |
− | {{ | + | * in 'MyPage/it', include this: |
− | }} {{#ask: [[master page::{{{master page}}}]] [[language code::!{{{language}}}]]| | + | <pre> |
+ | {{Languages|master page=MyPage|language=it}} | ||
+ | </pre> | ||
+ | </noinclude><includeonly>{{#ifeq:{{#ask: [[master page::{{{master page}}}]] [[language code::!{{{language}}}]]|format=count}}|0|| | ||
+ | <div id="box-lang"><div id="lang-box"> | ||
+ | <span lang="{{{language}}}" xml:lang="{{{language}}}"><i style="font-size: 1.5em;" class="fas fa-language"></i> '''[[Translation_Policy|{{LanguageOtherMsg|{{{language}}}}}]]'''</span>:</div><div id="lang-list"> | ||
+ | {{#ask: [[master page::{{{master page}}}]] [[language code::!{{{language}}}]]| | ||
?language code =| | ?language code =| | ||
link=none| | link=none| | ||
format=list| | format=list| | ||
− | + | template=LanguageNativeLink| | |
− | template= | ||
sort = language code| | sort = language code| | ||
order = asc| | order = asc| | ||
− | limit = | + | limit = 30| |
searchlabel = […] | searchlabel = […] | ||
}} | }} | ||
− | |||
− | |||
− | |||
</div> | </div> | ||
− | </includeonly> | + | }} |
+ | </div><!-- #box-lang --> | ||
+ | <div style="display: none;"> | ||
+ | [[master page::{{{master page}}}]] [[language code::{{{language}}}]] [[Content language::{{{language}}}]] | ||
+ | </div></includeonly> |
Latest revision as of 12:08, 21 October 2019
This is the "Languages" template. It provides a bar linking to the available translations of a page in the LibrePlanet wiki.
PLEASE - Do not edit if you are not REALLY sure about what you are doing: it could broke the LibrePlanet wiki pages!
Description
This template shows a bar linking to the available translations of a page. Only works for the pages (should be the "original" master page and its translations) which include this template itself.
This template should be included, either in the "original" master page and in all its translations, ONLY IF almost one translation of the master page really exist in the wiki.
It also set the MediaWiki property 'Language code' of the page in which the template itself has being included (see below).
This template calls:
- the "LanguageOtherMsg" sub-template
- the "LanguageNativeLink" sub-template
Usage
It should be called in the following format:
{{Languages|master page=<MasterPage>|language=<LangCode>}}
where:
- <MasterPage> is the "original" master page
- <LangCode> is the (2-digit lowercase) language code (ISO 639-1) of the content in the page in which the template itself has being included (either if it is the "original" master page or one of its translations)
Note - This also set the MediaWiki properties 'Language code' and 'Content language' of the calling page to the <LangCode> parameter.
Example
If the "original" master page 'MyPage' is written in English (as more often is) and it has an Italian translation at the page 'MyPage/it", then:
- into 'MyPage', include this:
{{Languages|master page=MyPage|language=en}}
- in 'MyPage/it', include this:
{{Languages|master page=MyPage|language=it}}