Difference between revisions of "Template:Translate-link"
From Dragon Age Toolset Wiki
Line 1: | Line 1: | ||
<includeonly>{{#ifeq: {{#titleparts:{{PAGENAME}}|1|2}} | {{#language:{{#titleparts:{{PAGENAME}}|1|2}}}} | <includeonly>{{#ifeq: {{#titleparts:{{PAGENAME}}|1|2}} | {{#language:{{#titleparts:{{PAGENAME}}|1|2}}}} | ||
− | <!-- If language of the current page | + | <!-- If the language of the current page could not be extracted --> |
| | | | ||
− | <!-- Create a link to original page --> | + | {{#if: {{{3}}} |
− | [[{{{1}}}|Translate-link: <span style="color:#CC2200">GETTING_LANGUAGE_ERROR</span>]] | + | <!-- If 3rd param is defined --> |
− | <!-- If language of the current page extracted | + | | |
+ | <!-- Use it as current language --> | ||
+ | {{#ifexist: {{{1}}}/{{{3}}} | ||
+ | <!-- If exist page has been translated into current language --> | ||
+ | | | ||
+ | <!-- Create a link to translated page --> | ||
+ | [[{{{1|:{{NAMESPACE}}:{{BASEPAGENAME}}}}}/{{{3}}}|{{{2|{{{1}}}}}}]] | ||
+ | <!-- If not exist page has been translated into current language --> | ||
+ | | | ||
+ | <!-- Create a link to translated and original page --> | ||
+ | [[{{{1|:{{NAMESPACE}}:{{BASEPAGENAME}}}}}/{{{3}}}|{{{2|{{{1}}}}}}]] [[{{{1|:{{NAMESPACE}}:{{BASEPAGENAME}}}}}|(en)]] | ||
+ | }} | ||
+ | <!-- If 3rd param is not defined --> | ||
+ | | | ||
+ | <!-- Create a link to original page and print error mesage --> | ||
+ | [[{{{1}}}|Translate-link: <span style="color:#CC2200">GETTING_LANGUAGE_ERROR</span>]] | ||
+ | }} | ||
+ | <!-- If the language of the current page has been extracted --> | ||
| | | | ||
{{#ifexist: {{{1}}}/{{#titleparts:{{PAGENAME}}|1|2}} | {{#ifexist: {{{1}}}/{{#titleparts:{{PAGENAME}}|1|2}} | ||
Line 10: | Line 27: | ||
| | | | ||
<!-- Create a link to translated page --> | <!-- Create a link to translated page --> | ||
− | [[{{{1|:{{NAMESPACE}}:{{BASEPAGENAME}}}}}/ | + | [[{{{1|:{{NAMESPACE}}:{{BASEPAGENAME}}}}}/{{#titleparts:{{PAGENAME}}|1|2}}|{{{2|{{{1}}}}}}]] |
<!-- If not exist page has been translated into current language --> | <!-- If not exist page has been translated into current language --> | ||
| | | |
Revision as of 22:51, 7 November 2010
Description
Template allows you to quickly create links to translated page DA Builder Wiki using the language of the current page:
Source code | Condition | Output |
---|---|---|
{{Translate-link|Main Page}} |
If the language of the current page could not be extracted | Translate-link: GETTING_LANGUAGE_ERROR |
If the page translated into current language exists (i.e. this page in Russian) | Main Page | |
If the page translated into current language does not exist (i.e. this page in Russian) | Main Page (en) | |
{{Translate-link|Main Page|New page name}} |
If the language of the current page could not be extracted | Translate-link: GETTING_LANGUAGE_ERROR |
If the page translated into current language exists (i.e. this page in Russian) | New page name | |
If the page translated into current language does not exist (i.e. this page in Russian) | New page name (en) |