Template:Translated From/code: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 6: | Line 6: | ||
--></td> | --></td> | ||
<td style="padding-right:10px; padding-top:4px; padding-bottom:4px;"><!-- | <td style="padding-right:10px; padding-top:4px; padding-bottom:4px;"><!-- | ||
-->{{#if:{{{source|}}} | -->{{#if:{{{source|}}} | ||
# param "source=" provided, produce list of languages | |||
| {{#arraydefine:a|<!-- | |||
-->{{#arraymap:{{#ask: [[:{{{source}}}]][[Has translation::+]]|?Has translation#=|format=list}},{{{source}}}<!-- | -->{{#arraymap:{{#ask: [[:{{{source}}}]][[Has translation::+]]|?Has translation#=|format=list}},{{{source}}}<!-- | ||
-->|,<!-- | -->|,<!-- | ||
-->|@@@@<!-- | -->|@@@@<!-- | ||
# insert artificial sort key, to sort language names properly (space at end is needed) | |||
-->| | -->|{{#language:{{Language code of page|@@@@}}}} \n<!-- | ||
# if the language we are treating is the translation source language | |||
-->{{#if:{{#ask: [[:@@@@]][[Has translation::+]]|?Has translation#=|format=list}}<!-- | -->{{#if:{{#ask: [[:@@@@]][[Has translation::+]]|?Has translation#=|format=list}}<!-- | ||
# it is, output the language with a title that contains the revision number | |||
-->|[[:@@@@|<span class="plainlinks" title="@@@@ ( | -->|[[:@@@@|<span class="plainlinks" title="@@@@ (rev:{{#ask:[[:@@@@]]|?Last revision#=}})"><!-- | ||
-->{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}<!-- | -->{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}<!-- | ||
--></span>]]<!-- | --></span>]]<!-- | ||
# it's not, normal output | |||
# language name | |||
-->|[[:@@@@|{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}]]<!-- | -->|[[:@@@@|{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}]]<!-- | ||
# if a revision was specified | |||
-->{{#if:{{{rev|}}}<!-- | -->{{#if:{{{rev|}}}<!-- | ||
# if the language we are treating now is this page's language | |||
-->|{{#ifeq:{{Language code of page|@@@@}}|{{Language code of page}}<!-- | -->|{{#ifeq:{{Language code of page|@@@@}}|{{Language code of page}}<!-- | ||
# produce the up-to-date indicator | |||
-->| {{{{Translation of|Template:Diff since trans}}|source={{{source}}}|rev={{{rev}}}}}<!-- | -->| {{{{Translation of|Template:Diff since trans}}|source={{{source}}}|rev={{{rev}}}}}<!-- | ||
| Line 51: | Line 51: | ||
-->|,<!-- | -->|,<!-- | ||
# get rid of duplicates and sort alphabetically (see hidden sort element above) | |||
-->|unique,sort=asc<!-- | -->|unique,sort=asc<!-- | ||
-->}}<!-- close #arraydefine | -->}}<!-- close #arraydefine | ||
# output array with the pipe separators | |||
-->{{#arrayprint:a| |  |@@@@|@@@@}}<!-- | -->{{#arrayprint:a<!-- | ||
-->| |  <!-- | |||
-->|@@@@<!-- | |||
# remove artificial sort key inserted above | |||
-->|{{#explode:@@@@|\n|1}}<!-- | |||
-->}}<!-- | |||
-->{{#arrayreset:a}}<!-- | -->{{#arrayreset:a}}<!-- | ||
# no param "source=" provided, categorize as untranslated | |||
-->| {{{message-no-known-translations|}}} | -->| {{{message-no-known-translations|}}} | ||
Revision as of 14:25, 28 April 2011
This is the code page for Template:Translated From. Please refer to that template for instructions.