Difference between revisions of "Template:Translation of"
(→3. Language does not exist) |
|||
Line 1: | Line 1: | ||
+ | {{{1|}}} | ||
+ | ---- | ||
+ | {{{2|{{PAGENAME}}}}} | ||
+ | ---- | ||
+ | {{#ask:[[:{{{2|{{PAGENAME}}}}}]]|?Has language=}} | ||
+ | ---- | ||
+ | {{#ask: [[Has language::{{#ask: [[:{{{2|{{PAGENAME}}}}}]]|?Has language=}}]] [[Translated from::{{{1}}}]] | ||
+ | }} | ||
+ | ---- | ||
+ | {{#ask: [[Has language::{{#ask: [[:{{{2|{{PAGENAME}}}}}]]|?Has language=}}]] [[Translated from::{{{1}}}]] | ||
+ | | link=none | ||
+ | }} | ||
+ | ---- | ||
{{#if: {{{1|}}} | {{#if: {{{1|}}} | ||
| {{#if: {{#ask:[[:{{{2|{{PAGENAME}}}}}]]|?Has language=}} | | {{#if: {{#ask:[[:{{{2|{{PAGENAME}}}}}]]|?Has language=}} | ||
Line 43: | Line 56: | ||
{{Translation of|Main Page|Non existent page}} | {{Translation of|Main Page|Non existent page}} | ||
+ | |||
+ | ===3. Language is not defined=== | ||
+ | <pre> | ||
+ | {{Translation of|Category:Untranslated|User:Hamilton Abreu/Pt:Testes}} | ||
+ | </pre> | ||
+ | |||
+ | {{Translation of|Category:Untranslated|User:Hamilton Abreu/Pt:Testes}} | ||
</noinclude> | </noinclude> |
Revision as of 17:47, 21 April 2011
Translation of
{{#ask:Translation of|?Has language=}}
{{#ask: [[Has language::{{#ask: Translation of|?Has language=}}]] [[Translated from::{{{1}}}]]
}}
{{#ask: [[Has language::{{#ask: Translation of|?Has language=}}]] [[Translated from::{{{1}}}]]
| link=none }}
{{#if:
| {{#if: {{#ask:Translation of|?Has language=}} | {{#if: {{#ask: [[Has language::{{#ask: Translation of|?Has language=}}]] [[Translated from::{{{1}}}]] }} | {{#ask: [[Has language::{{#ask: Translation of|?Has language=}}]] [[Translated from::{{{1}}}]] | link=none }} | {{{1}}} }} | {{{1}}} }}
}} Template Translation of returns the translation of page X in the same language as the language of page Y, if it exists. If no such translation exists, it returns page X itself. If page Y is not supplied, the current page will be used.
Contents
Use
{{Translation of|Page X|Page Y}}
Examples
1. Translation exists
{{Translation of|Main Page|CC Wiki:De:Übersetzen}}
returns the translation of Main Page in the same language as page CC Wiki:De:Übersetzen, that is, the translation of Main Page in language De:
{{#if: Main Page
| {{#if: {{#ask:CC Wiki:De:Übersetzen|?Has language=}} | {{#if: {{#ask: Translated from::Main Page [[Has language::{{#show: CC Wiki:De:Übersetzen | ?Has language = | link=none}}]] }} | {{#ask: Translated from::Main Page [[Has language::{{#show: CC Wiki:De:Übersetzen | ?Has language = | link=none}}]] | link=none }} | Main Page }} | Main Page }}
}}
2. Translation does not exist
{{Translation of|Main Page|Hr:Odabir licence}}
returns the translation of Main Page in the same language as page Hr:Odabir licence, that is, the translation of Main Page in language Hr (at the time of writing this translation does not exist so "Main Page" is returned):
{{#if: Main Page
| {{#if: {{#ask:Hr:Odabir licence|?Has language=}} | {{#if: {{#ask: Translated from::Main Page [[Has language::{{#show: Hr:Odabir licence | ?Has language = | link=none}}]] }} | {{#ask: Translated from::Main Page [[Has language::{{#show: Hr:Odabir licence | ?Has language = | link=none}}]] | link=none }} | Main Page }} | Main Page }}
}}
3. Language is not defined
{{Translation of|Main Page|Non existent page}}
returns the translation of Main Page in the same language as page Non existent page, that is, the translation of Main Page in an undefined language:
{{#if: Main Page
| {{#if: {{#ask:Non existent page|?Has language=}} | {{#if: {{#ask: Translated from::Main Page [[Has language::{{#show: Non existent page | ?Has language = | link=none}}]] }} | {{#ask: Translated from::Main Page [[Has language::{{#show: Non existent page | ?Has language = | link=none}}]] | link=none }} | Main Page }} | Main Page }}
}}
3. Language is not defined
{{Translation of|Category:Untranslated|User:Hamilton Abreu/Pt:Testes}}
{{#if: Category:Untranslated
| {{#if: {{#ask:User:Hamilton Abreu/Pt:Testes|?Has language=}} | {{#if: {{#ask: Translated from::Category:Untranslated [[Has language::{{#show: User:Hamilton Abreu/Pt:Testes | ?Has language = | link=none}}]] }} | {{#ask: Translated from::Category:Untranslated [[Has language::{{#show: User:Hamilton Abreu/Pt:Testes | ?Has language = | link=none}}]] | link=none }} | Category:Untranslated }} | Category:Untranslated }}
}}