Difference between revisions of "Template:Language code of page"

From Creative Commons
Jump to: navigation, search
Line 1: Line 1:
<includeonly>
+
<includeonly><!--
----
+
-->{{#ifeq: {{#language:{{lc:{{#explode:{{#if:{{{1|}}}|{{SUBPAGENAME:{{{1}}}}}|{{SUBPAGENAME}}}}|{{Language delimiter}}|0}}}}}}
{{{1|}}}
+
    | {{lc:{{#explode:{{#if:{{{1|}}}|{{SUBPAGENAME:{{{1}}}}}|{{SUBPAGENAME}}}}|{{Language delimiter}}|0}}}}
----
+
    | {{#ifeq: {{#language:{{lc:{{#explode:{{#if:{{{1|}}}|{{PAGENAME:{{{1}}}}}|{{PAGENAME}}}}|{{Language delimiter}}|0}}}}}}
{{#if:{{{1|}}}|{{SUBPAGENAME:{{{1}}}}}|{{SUBPAGENAME}}}}}}
+
        | {{lc:{{#explode:{{#if:{{{1|}}}|{{PAGENAME:{{{1}}}}}|{{PAGENAME}}}}|{{Language delimiter}}|0}}}}
----
+
        |<!-- return nothing
 
+
      -->|{{lc:{{#explode:{{#if:{{{1|}}}|{{PAGENAME:{{{1}}}}}|{{PAGENAME}}}}|{{Language delimiter}}|0}}}}<!--
 
+
    -->}}<!--
<!--
+
  -->|{{lc:{{#explode:{{#if:{{{1|}}}|{{SUBPAGENAME:{{{1}}}}}|{{SUBPAGENAME}}}}|{{Language delimiter}}|0}}}}<!--
-->{{#ifeq: {{#language:{{lc:{{#explode:{{SUBPAGENAME
 
{{#if:{{{1|}}}|{{colon}}{{{1}}}|}}
 
}}|{{Language delimiter}}|0}}}}}}
 
    | {{lc:{{#explode:{{SUBPAGENAME{{#if:{{{1|}}}|{{colon}}{{{1}}}|}}}}|{{Language delimiter}}|0}}}}
 
    | {{#language:{{lc:{{#explode:{{SUBPAGENAME{{#if:{{{1|}}}|{{colon}}{{{1}}}|}}|{{Language delimiter}}|0}}}}}} -- {{lc:{{#explode:{{SUBPAGENAME{{#if:{{{1|}}}|{{colon}}{{{1}}}|}}}}|{{Language delimiter}}|0}}}}
 
    | different<!--
 
 
-->}}</includeonly><noinclude>
 
-->}}</includeonly><noinclude>
 
Template '''{{PAGENAME}}''' returns the language code of a page. If no page name is passed in as the first parameter, the current page (in which it is being used) applies. If there is no language code, it returns empty.
 
Template '''{{PAGENAME}}''' returns the language code of a page. If no page name is passed in as the first parameter, the current page (in which it is being used) applies. If there is no language code, it returns empty.

Revision as of 10:48, 21 April 2011

Template Language code of page returns the language code of a page. If no page name is passed in as the first parameter, the current page (in which it is being used) applies. If there is no language code, it returns empty.

Use

{{Language code of page|optional page name}}

Examples

No page parameter

If no first parameter is passed in, the current page applies.

{{Language code of page}}

{{#ifeq: {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}

    | {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}
    | {{#ifeq: {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}
        | {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}
        | en| {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}}}| {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}}}

Page with a language code

{{Language code of page|Pt:Página principal}}

{{#ifeq: {{#explode:pt:página principal|{{#ifeq:|file| |:}}|0}}

    | {{#explode:pt:página principal|{{#ifeq:|file| |:}}|0}}
    | {{#ifeq: {{#explode:pt:página principal|{{#ifeq:|file| |:}}|0}}
        | {{#explode:pt:página principal|{{#ifeq:|file| |:}}|0}}
        | en| {{#explode:pt:página principal|{{#ifeq:|file| |:}}|0}}}}| {{#explode:pt:página principal|{{#ifeq:|file| |:}}|0}}}}

Page without a language code

If no first parameter is passed in, the current page applies.

{{Language code of page|Template:Language code of page}}

{{#ifeq: {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}

    | {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}
    | {{#ifeq: {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}
        | {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}
        | en| {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}}}| {{#explode:language code of page|{{#ifeq:template|file| |:}}|0}}}}