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:{{SUBPAGENAME}}|{{Language delimiter}}|0}}}}}}
+
-->{{#ifeq: {{#language:{{lc:{{#explode:{{SUBPAGENAME{{#if:{{{1|}}}|:{{{1}}}}}}}|{{Language delimiter}}|0}}}}}}
     | {{lc:{{#explode:{{SUBPAGENAME}}|{{Language delimiter}}|0}}}}
+
     | {{lc:{{#explode:{{SUBPAGENAME{{#if:{{{1|}}}|:{{{1}}}}}}}|{{Language delimiter}}|0}}}}
 
     |<!-- return nothing  
 
     |<!-- return nothing  
   -->|{{#language:{{lc:{{#explode:{{SUBPAGENAME}}|{{Language delimiter}}|0}}}}}}<!--
+
   -->|{{#language:{{lc:{{#explode:{{SUBPAGENAME{{#if:{{{1|}}}|:{{{1}}}}}}}|{{Language delimiter}}|0}}}}}}<!--
 
-->}}</includeonly><noinclude>
 
-->}}</includeonly><noinclude>
Template '''{{PAGENAME}}''' returns the language code of the page in which it is used. 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 in which it is used applies. If there is no language code, it returns empty.
 +
 
 +
==Use==
 +
<pre>
 +
{{Language of page|optional page name}}
 +
</pre>
 +
 
 +
==Examples==
 +
===No page parameter===
 +
If no first parameter is passed in, the current page applies.
 +
<pre>
 +
{{Language of page}}
 +
</pre>
 +
{{Language of page}}
 +
 
 +
===Page with property Has language:: set===
 +
<pre>
 +
{{Language of page|Main Page}}
 +
</pre>
 +
{{Language of page|Main Page}}
 +
 
 +
<pre>
 +
{{Language of page|Pt:Página principal}}
 +
</pre>
 +
{{Language of page|Pt:Página principal}}
 +
 
 +
===Page without property Has language:: set===
 +
If no first parameter is passed in, the current page applies.
 +
<pre>
 +
{{Language of page|Template:Language of page}}
 +
</pre>
 +
{{Language of page|Template:Language of page}}
  
 
[[Category:Translation templates|{{PAGENAME}}]]
 
[[Category:Translation templates|{{PAGENAME}}]]
 
</noinclude>
 
</noinclude>

Revision as of 14:19, 20 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 in which it is used applies. If there is no language code, it returns empty.

Use

{{Language of page|optional page name}}

Examples

No page parameter

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

{{Language of page}}

Template:Language of page

Page with property Has language:: set

{{Language of page|Main Page}}

Template:Language of page

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

Template:Language of page

Page without property Has language:: set

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

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

Template:Language of page