Jump to content

Template:Translated From/code: Difference between revisions

From CC Public Wiki
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
#              param "source=" provided, produce list of languages


          -->| {{#arraydefine:a|<!--
              | {{#arraydefine:a|<!--
               -->{{#arraymap:{{#ask: [[:{{{source}}}]][[Has translation::+]]|?Has translation#=|format=list}},{{{source}}}<!--
               -->{{#arraymap:{{#ask: [[:{{{source}}}]][[Has translation::+]]|?Has translation#=|format=list}},{{{source}}}<!--
                 -->|,<!--
                 -->|,<!--
                 -->|@@@@<!--
                 -->|@@@@<!--


                    hidden sort element, to sort language names properly (space at end is needed)
#                    insert artificial sort key, to sort language names properly (space at end is needed)
                 -->|<span style="display:none">{{#language:{{#ask:[[:@@@@]]|?Has language#=}}}} </span><!--
                 -->|{{#language:{{Language code of page|@@@@}}}} \n<!--


                    if the language we are treating is the translation source language
#                    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
#                      it is, output the language with a title that contains the revision number


                     -->|[[:@@@@|<span class="plainlinks" title="@@@@ ({{{message-latest-revision|}}} {{#ask:[[:@@@@]]|?Last revision#=}})"><!--
                     -->|[[:@@@@|<span class="plainlinks" title="@@@@ (rev:{{#ask:[[:@@@@]]|?Last revision#=}})"><!--
                                 -->{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}<!--
                                 -->{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}<!--
                             --></span>]]<!--
                             --></span>]]<!--


                        it's not, normal output
#                      it's not, normal output


                        language name
#                      language name
                     -->|[[:@@@@|{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}]]<!--
                     -->|[[:@@@@|{{#language: {{#ask:[[:@@@@]]|?Has language#=}}}}]]<!--


                        if a revision was specified
#                      if a revision was specified
                     -->{{#if:{{{rev|}}}<!--
                     -->{{#if:{{{rev|}}}<!--


                          if the language we are treating now is this page's language
#                          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
#                            produce the up-to-date indicator
                           -->|&nbsp;{{{{Translation of|Template:Diff since trans}}|source={{{source}}}|rev={{{rev}}}}}<!--
                           -->|&nbsp;{{{{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)
#                  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
#                output array with the pipe separators
             -->{{#arrayprint:a|&nbsp;&nbsp;&#124;&nbsp;&#32;|@@@@|@@@@}}<!--
             -->{{#arrayprint:a<!--
              -->|&nbsp;&nbsp;&#124;&nbsp;&#32;<!--
              -->|@@@@<!--
#                  remove artificial sort key inserted above
              -->|{{#explode:@@@@|\n|1}}<!--
            -->}}<!--
             -->{{#arrayreset:a}}<!--
             -->{{#arrayreset:a}}<!--


                no param "source=" provided, categorize as untranslated
#              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.