Difference between revisions of "Template:Translations"

From Creative Commons
Jump to: navigation, search
(changed to extract language from parent, if available there)
(for files, extract language code by exploding spaces, because : is not allowed in file names)
Line 4: Line 4:
 
<tr style="background: #EEF3E2">
 
<tr style="background: #EEF3E2">
 
<th style="vertical-align:middle;white-space: nowrap; padding: 4px 1em; border-right: 1px solid #aaaaaa;width:15%;">[[File:Languages.png|link=CcWiki:Translate|middle]] [[CcWiki:Translate|Languages:]]</th>
 
<th style="vertical-align:middle;white-space: nowrap; padding: 4px 1em; border-right: 1px solid #aaaaaa;width:15%;">[[File:Languages.png|link=CcWiki:Translate|middle]] [[CcWiki:Translate|Languages:]]</th>
<td style="background: #F6F9ED;padding-left:10px;">{{#if:{{{articles|}}}|{{#arraymap:{{{articles}}}|,|x|[[Has translation::x]]|,  }}|[[Category:Untranslated]] There are no known translations for this page. Please read the directions on [[CcWiki:Translate|how to add a translation]].}}{{#ifeq:{{#explode:{{SUBPAGENAME}}|:|0}}|{{SUBPAGENAME}}
+
<td style="background: #F6F9ED;padding-left:10px;">{{#if:{{{articles|}}}|{{#arraymap:{{{articles}}}|,|x|[[Has translation::x]]|,  }}|[[Category:Untranslated]] There are no known translations for this page. Please read the directions on [[CcWiki:Translate|how to add a translation]].}}
   | {{#ifeq:{{#explode:{{PAGENAME}}|:|0}}|{{PAGENAME}}
+
{{#ifeq: {{NAMESPACE}} | {{ns:6}}
      |[[Has language::{{CONTENTLANGUAGE}}| ]]
+
  <|-- character ":" is not allowed in file names, so a space is used instead -
      |[[Has language::{{lc:{{#explode:{{PAGENAME}}|:|0}}}}| ]]}}
+
      if leftmost word is not a language code, language is content language -->
  | [[Has language::{{lc:{{#explode:{{SUBPAGENAME}}|:|0}}}}| ]]}}</td>
+
  | {{#ifeq: {{#language:{{lc:{{#explode:{{SUBPAGENAME}}| |0}}}}}}
 +
      | {{lc:{{#explode:{{SUBPAGENAME}}| |0}}}}
 +
      | [[Has language::{{CONTENTLANGUAGE}}| ]]
 +
      | [[Has language::{{lc:{{#explode:{{SUBPAGENAME}}| |0}}}}| ]]
 +
    }}
 +
   | {{#ifeq:{{#explode:{{SUBPAGENAME}}|:|0}}|{{SUBPAGENAME}}
 +
      | {{#ifeq:{{#explode:{{PAGENAME}}|:|0}}|{{PAGENAME}}
 +
          | [[Has language::{{CONTENTLANGUAGE}}| ]]
 +
          | [[Has language::{{lc:{{#explode:{{PAGENAME}}|:|0}}}}| ]]
 +
        }}
 +
      | [[Has language::{{lc:{{#explode:{{SUBPAGENAME}}|:|0}}}}| ]]
 +
    }}
 +
}}
 +
</td>
 
</tr></table></div>
 
</tr></table></div>
 
</includeonly><noinclude>
 
</includeonly><noinclude>

Revision as of 15:19, 18 April 2011


This is the Translations template. It can be used to link to translations of an article in the wiki. To use it in your article, insert it as follows:

{{Translations|
   articles=Es:Foo,Hr:Bar
}}

Any number of translations can be listed in the articles parameter, separated by commas.

If no translations are specified, the page is marked as Untranslated.

See also