Module:ISO 3166/doc
This module returns a country's or subdivision's code (alpha-2, alpha-3, numeric) or name (ISO, non-ISO) from [[ISO 3166]] from a varity of inputs (alpha-2, alpha-3, numeric, name, ISO-name, alternative names). The module also removes junk from the input.
 ==Examples==
 ===Countries (ISO 3166-1)===
 All three types of [[ISO 3166-1]] codes (alpha-2, alpha-3 and numeric) work as inputs to &lt;code&gt;name&lt;/code&gt;, as well as to &lt;code&gt;code&lt;/code&gt; (which can therefore also be used to convert between different code types). Use {{para|codetype}} to output alpha-3 or numeric codes in &lt;code&gt;code&lt;/code&gt; instead of the default alpha-2 codes.
 ====Name====
 To get the common name use the name function
 *{{tnull|&amp;#35;invoke:ISO 3166|name|GB}} &amp;rarr; {{#invoke:ISO 3166|name|GB}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|GBR}} &amp;rarr; {{#invoke:ISO 3166|name|GBR}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|826}} &amp;rarr; {{#invoke:ISO 3166|name|826}}
 ====ISO Name====
 To get the common name use the name function with isoname = yes
 *{{tnull|&amp;#35;invoke:ISO 3166|name|GB|isoname{{=}}yes}} &amp;rarr; {{#invoke:ISO 3166|name|GB|isoname=yes}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|GBR|isoname{{=}}yes}} &amp;rarr; {{#invoke:ISO 3166|name|GBR|isoname=yes}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|826|isoname{{=}}yes}} &amp;rarr; {{#invoke:ISO 3166|name|826|isoname=yes}}
 ====Alpha-2====
 To get the alpha 2 code use the code function
 *{{tnull|&amp;#35;invoke:ISO 3166|code|826}} &amp;rarr; {{#invoke:ISO 3166|code|826}}
 *{{tnull|&amp;#35;invoke:ISO 3166|code|ஐக்கிய இராச்சியம்}} &amp;rarr; {{#invoke:ISO 3166|code|ஐக்கிய இராச்சியம்}}
 *{{tnull|&amp;#35;invoke:ISO 3166|code|UK}} &amp;rarr; {{#invoke:ISO 3166|code|UK}}
 ====Alpha-3====
 To get the alpha 3 code use the code function with codetype = 3
 *{{tnull|&amp;#35;invoke:ISO 3166|code|ஐக்கிய இராச்சியம்|codetype{{=}}alpha3}} &amp;rarr; {{#invoke:ISO 3166|code|ஐக்கிய இராச்சியம்|codetype=alpha3}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|GB}} &amp;rarr; {{#invoke:ISO 3166|name|GB}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|GBR}} &amp;rarr; {{#invoke:ISO 3166|name|GBR}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|826}} &amp;rarr; {{#invoke:ISO 3166|name|826}}
 *{{tnull|&amp;#35;invoke:ISO 3166|code|UK|codetype{{=}}alpha3}} &amp;rarr; {{#invoke:ISO 3166|code|UK|codetype=alpha3}}
 ====Numeric====
 To get the numeric code use the code function with codetype = numeric '''or''' use the numeric function
 *{{tnull|&amp;#35;invoke:ISO 3166|numeric|GB}} &amp;rarr; {{#invoke:ISO 3166|numeric|GB}}
 *{{tnull|&amp;#35;invoke:ISO 3166|code|GB|codetype{{=}}numeric}} &amp;rarr; {{#invoke:ISO 3166|code|GB|codetype=numeric}}
 ===Subdivisions (ISO 3166-2)===
 Inputs to &lt;code&gt;name&lt;/code&gt; must be valid [[ISO 3166-2]] codes, i.e. the country's alpha-2 code for the first part, and up to three alphanumeric characters for the second part. They may be given normally (with a hyphen between the parts), or split between two unnamed parameters. For &lt;code&gt;code&lt;/code&gt;, the first parameter is the country name (or any of its three codes, like above), and the second the subdivision name.
 ====Code (alpha-2)====
 To get the alpha-2 code of a subdivision use the code function with parameter 1 being the country and parameter 2 being the subdivision
 *{{tnull|&amp;#35;invoke:ISO 3166|code|ஐக்கிய இராச்சியம்|இங்கிலாந்து}} &amp;rarr; {{#invoke:ISO 3166|code|ஐக்கிய இராச்சியம்|இங்கிலாந்து}}
 *{{tnull|&amp;#35;invoke:ISO 3166|code|GBR|இங்கிலாந்து}} &amp;rarr; {{#invoke:ISO 3166|code|GBR|இங்கிலாந்து}}
 *{{tnull|&amp;#35;invoke:ISO 3166|code|GB|இங்கிலாந்து}} &amp;rarr; {{#invoke:ISO 3166|code|GB|இங்கிலாந்து}}
 ====Name====
 To get the name of a subdivision use the name function with parameter 1 being the country and parameter 2 being the subdivsion '''or''' parameter 1 being the subdivsion code
 *{{tnull|&amp;#35;invoke:ISO 3166|name|IN-TN}} &amp;rarr; {{#invoke:ISO 3166|name|IN-TN}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|IN|TN}} &amp;rarr; {{#invoke:ISO 3166|name|IN|TN}}
 
 {{para|isoname}} works for subnational entities as well; keep in mind that ISO 3166-2 uses (transliterations of) local names that may differ from English ones. Set {{para|lang}} to a [[ISO 639|language code]] to switch between different languages for entities that have multiple ISO names. The default language for multilingual entities can be set on the country's [[Module:ISO 3166/data|data page]].
 *{{tnull|&amp;#35;invoke:ISO 3166|name|IN|TN}} &amp;rarr; {{#invoke:ISO 3166|name|IN|TN}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|IN|TN|isoname{{=}}yes}} &amp;rarr; {{#invoke:ISO 3166|name|IN|TN|isoname=yes}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|IN|TN|lang{{=}}en}} &amp;rarr; {{#invoke:ISO 3166|name|IN|TN|lang=en}}
 *{{tnull|&amp;#35;invoke:ISO 3166|name|IN|PY|lang{{=}}en}} &amp;rarr; {{#invoke:ISO 3166|name|IN|PY|lang=en}}
 
 == Tracking categories ==
 * {{clc|Wikipedia page with obscure country}}
 * {{clc|Wikipedia page with obscure country or subdivision}}
 * {{clc|Wikipedia page with obscure subdivision}}
 ==See also==
 *[[Wikipedia:Templates for discussion/Log/2015 November 12#Template:ISO 3166 name DE-HB]] &amp;ndash; discussion of replacement of [[Template:ISO 3166 conversion template doc|template-based system]] with Lua
 *[[Wikipedia:Templates_for_discussion/Log/2018_September_10#Template:ISO_3166_code-3_AD]] &amp;ndash; discussion of full removal of [[Template:ISO 3166 conversion template doc|template-based system]]
 *{{tl|ISO 3166 name}} &amp;ndash; (ISO name)
 *{{tl|Country name}} &amp;ndash; (Standard name)
 *{{tl|ISO 3166 code}} &amp;ndash; (Code)
 *{{tl|ISO 3166 code-3}} &amp;ndash; (3 letter code)
 *{{tl|ISO 3166 numeric}} &amp;ndash; (numeric code)
 *[[Module:ISO 3166/data]] &amp;ndash; the data subpages used by this module
 
 ==Subpages==
 {{Special:Prefixindex/Module:ISO 3166/}}
 
 &lt;includeonly&gt;{{#ifeq:{{SUBPAGENAME}}|sandbox | |
 [[Category:Data retrieval templates]]