Difference between revisions of "Template:Country2iso"

From blackwiki
Jump to navigation Jump to search
imported>Guarapiranga
(Creating template)
 
imported>Guarapiranga
(Corrections + example)
 
Line 1: Line 1:
 
<includeonly>{{#lst:ISO 3166-1 alpha-2|{{{1}}}}}</includeonly><noinclude>
 
<includeonly>{{#lst:ISO 3166-1 alpha-2|{{{1}}}}}</includeonly><noinclude>
 
{{Documentation|content=
 
{{Documentation|content=
This template does the opposite of {{tl|Iso2country}} and the same as {{tl|ISO 3166 code}}. However, rather than being [[Lua (programming language)|Lua]]-based like {{tl|Iso2country}}, it transcludes the ISO codes based on the country name from [[ISO 3166-1 alpha-2]]. This is particularly useful when [[Help:Substitution|subst'ing]] ISO codes, as [[Lua (programming language)|Lua]] modules need to be [[Help:Substitution|subst'd]] twice, and {{tl|ISO 3166 code}} often times out on long lists of countries.  
+
This template does the opposite of {{tl|Iso2country}} and the same as {{tl|ISO 3166 code}}. However, rather than being [[Lua (programming language)|Lua]]-based like {{tl|ISO 3166 code}}, it transcludes the ISO codes from [[ISO 3166-1 alpha-2]] based on the provided country name. This is particularly useful when [[Help:Substitution|subst'ing]] ISO codes, as [[Lua (programming language)|Lua]] modules need to be [[Help:Substitution|subst'd]] twice, and {{tl|ISO 3166 code}} often times out on long lists of countries.  
  
 
=== Usage ===
 
=== Usage ===
<code><nowiki>{{Country2iso | country name}}</nowiki></code>}}</noinclude>
+
<code><nowiki>{{Country2iso | country name}}</nowiki></code>
 +
 
 +
=== Example ===
 +
<code><nowiki>{{Country2iso | China}}</nowiki></code> yields <code>{{Country2iso | China}}</code>}}</noinclude>

Latest revision as of 02:27, 31 October 2019

Template documentation

This template does the opposite of {{Iso2country}} and the same as {{ISO 3166 code}}. However, rather than being Lua-based like {{ISO 3166 code}}, it transcludes the ISO codes from ISO 3166-1 alpha-2 based on the provided country name. This is particularly useful when subst'ing ISO codes, as Lua modules need to be subst'd twice, and {{ISO 3166 code}} often times out on long lists of countries.

Usage

{{Country2iso | country name}}

Example

{{Country2iso | China}} yields {{#lst:ISO 3166-1 alpha-2| China}}