Difference between revisions of "Template:Translated From/code"
 (Undo revision 49265 by Hamilton Abreu (talk))  | 
				|||
| Line 7: | Line 7: | ||
          <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|}}}  | ||
| − |                | {{#arraydefine:a|{{#arraymap:{{#ask: [[:{{{source}}}]][[Has translation::+]]|?Has translation#=|format=list}},{{{source}}}|,|@@@@|<span style="display:none">{{#language:{{#ask:[[:@@@@]]|?Has language#=}}}} </span>[[:@@@@|{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}]]{{#if:{{{rev|}}}|{{#ifeq:{{Language code of page|@@@@}}|{{Language code of page}}| {{{{Translation of|Template:Diff since trans}}|source={{{source}}}|rev={{{rev}}}}} }}}}}}|,|unique,sort=asc}}{{#arrayprint:a|  |  |@@@@|@@@@}}{{#arrayreset:a}}<!--  | + | |
| + |                 param "source=" provided, produce list of languages  | ||
| + | |||
| + |                | {{#arraydefine:a|<!--  | ||
| + |                -->{{#arraymap:{{#ask: [[:{{{source}}}]][[Has translation::+]]|?Has translation#=|format=list}},{{{source}}}<!--  | ||
| + |                  -->|,<!--  | ||
| + |                  -->|@@@@<!--  | ||
| + | |||
| + |                      hidden sort element, to sort language names properly (space at end is needed)  | ||
| + |                  -->|<span style="display:none">{{#language:{{#ask:[[:@@@@]]|?Has language#=}}}} </span><!--  | ||
| + | |||
| + |                      if the language we are treating is the translation source language  | ||
| + | |||
| + |                   -->{{#if:{{#ask: [[:@@@@]][[Has translation::+]]|?Has translation#=|format=list}}<!--  | ||
| + | |||
| + |                         it is, output the language with a title that contains the revision number  | ||
| + | |||
| + |                     -->|<span title="@@@@ (rev:{{#ask: [[:@@@@]][[Latest revision::+]]|?Latest revision#=|format=list}})><!--  | ||
| + |                          -->[[:@@@@|{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}]]<!--  | ||
| + |                      --></span><!--  | ||
| + | |||
| + |                         it's not, normal output  | ||
| + | |||
| + |                         language name  | ||
| + |                     -->|[[:@@@@|{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}]]<!--  | ||
| + | |||
| + |                         if a revision was specified  | ||
| + |                      -->{{#if:{{{rev|}}}<!--  | ||
| + | |||
| + |                            if the language we are treating now is this page's language  | ||
| + |                        -->|{{#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}}}}}<!--  | ||
| + | |||
| + |                         -->}}<!--  | ||
| + | |||
| + |                      -->}}<!--  | ||
| + | |||
| + |                   -->}}<!--  | ||
| + | |||
| + |                -->}}<!-- close #arraymap  | ||
| + | |||
| + |                -->|,<!--  | ||
| + |                    get rid of duplicates and sort alphabetically (see hidden sort element above)  | ||
| + |                -->|unique,sort=asc<!--  | ||
| + |              -->}}<!-- close #arraydefine  | ||
| + | |||
| + |                   output array with the pipe separators  | ||
| + |              -->{{#arrayprint:a|  |  |@@@@|@@@@}}<!--  | ||
| + |              -->{{#arrayreset:a}}<!--  | ||
| + | |||
| + |                 no param "source=" provided, categorize as untranslated  | ||
| + | |||
            -->| {{{message-no-known-translations|}}}  |             -->| {{{message-no-known-translations|}}}  | ||
                 [[{{Translation of|Category:Untranslated}}]]  |                  [[{{Translation of|Category:Untranslated}}]]  | ||
Revision as of 13:44, 27 April 2011
This is the code page for Template:Translated From. Please refer to that template for instructions.