Editing
Module:ISO 3166/doc
From Thetacola Wiki
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
{{Module rating|p}} {{High risk|493000+}} 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 variety 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 <code>name</code>, as well as to <code>code</code> (which can therefore also be used to convert between different code types). Use {{para|codetype}} to output alpha-3 or numeric codes in <code>code</code> instead of the default alpha-2 codes. ====Name==== To get the common name use the name function *{{tnull|#invoke:ISO 3166|name|GB}} → {{#invoke:ISO 3166|name|GB}} *{{tnull|#invoke:ISO 3166|name|GBR}} → {{#invoke:ISO 3166|name|GBR}} *{{tnull|#invoke:ISO 3166|name|826}} → {{#invoke:ISO 3166|name|826}} ====ISO Name==== To get the common name use the name function with isoname = yes *{{tnull|#invoke:ISO 3166|name|GB|isoname{{=}}yes}} → {{#invoke:ISO 3166|name|GB|isoname=yes}} *{{tnull|#invoke:ISO 3166|name|GBR|isoname{{=}}yes}} → {{#invoke:ISO 3166|name|GBR|isoname=yes}} *{{tnull|#invoke:ISO 3166|name|826|isoname{{=}}yes}} → {{#invoke:ISO 3166|name|826|isoname=yes}} ====Alpha-2==== To get the alpha 2 code use the code function *{{tnull|#invoke:ISO 3166|code|826}} → {{#invoke:ISO 3166|code|826}} *{{tnull|#invoke:ISO 3166|code|United Kingdom}} → {{#invoke:ISO 3166|code|United Kingdom}} *{{tnull|#invoke:ISO 3166|code|UK}} → {{#invoke:ISO 3166|code|UK}} ====Alpha-3==== To get the alpha 3 code use the code function with codetype = 3 *{{tnull|#invoke:ISO 3166|code|United Kingdom|codetype{{=}}alpha3}} → {{#invoke:ISO 3166|code|United Kingdom|codetype=alpha3}} *{{tnull|#invoke:ISO 3166|name|GB}} → {{#invoke:ISO 3166|name|GB}} *{{tnull|#invoke:ISO 3166|name|GBR}} → {{#invoke:ISO 3166|name|GBR}} *{{tnull|#invoke:ISO 3166|name|826}} → {{#invoke:ISO 3166|name|826}} *{{tnull|#invoke:ISO 3166|code|UK|codetype{{=}}alpha3}} → {{#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|#invoke:ISO 3166|numeric|GB}} → {{#invoke:ISO 3166|numeric|GB}} *{{tnull|#invoke:ISO 3166|code|GB|codetype{{=}}numeric}} → {{#invoke:ISO 3166|code|GB|codetype=numeric}} ===Subdivisions (ISO 3166-2)=== Inputs to <code>name</code> 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 <code>code</code>, 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|#invoke:ISO 3166|code|United Kingdom|England}} → {{#invoke:ISO 3166|code|United Kingdom|England}} *{{tnull|#invoke:ISO 3166|code|GBR|England}} → {{#invoke:ISO 3166|code|GBR|England}} *{{tnull|#invoke:ISO 3166|code|GB|England}} → {{#invoke:ISO 3166|code|GB|England}} ====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|#invoke:ISO 3166|name|GB-ENG}} → {{#invoke:ISO 3166|name|GB-ENG}} *{{tnull|#invoke:ISO 3166|name|GB|ENG}} → {{#invoke:ISO 3166|name|GB|ENG}} {{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|#invoke:ISO 3166|name|BE|BRU}} → {{#invoke:ISO 3166|name|BE|BRU}} *{{tnull|#invoke:ISO 3166|name|BE|BRU|isoname{{=}}yes}} → {{#invoke:ISO 3166|name|BE|BRU|isoname=yes}} *{{tnull|#invoke:ISO 3166|name|BE|BRU|lang{{=}}fr}} → {{#invoke:ISO 3166|name|BE|BRU|lang=fr}} *{{tnull|#invoke:ISO 3166|name|BE|BRU|lang{{=}}nl}} → {{#invoke:ISO 3166|name|BE|BRU|lang=nl}} == 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]] – 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]] – discussion of full removal of [[Template:ISO 3166 conversion template doc|template-based system]] *{{tl|ISO 3166 name}} – (ISO name) *{{tl|Country name}} – (Standard name) *{{tl|ISO 3166 code}} – (Code) *{{tl|ISO 3166 code-3}} – (3 letter code) *{{tl|ISO 3166 numeric}} – (numeric code) *[[Module:ISO 3166/data]] – the data subpages used by this module ==Subpages== {{Special:Prefixindex/Module:ISO 3166/}} <includeonly>{{#ifeq:{{SUBPAGENAME}}|sandbox | | [[Category:Data retrieval templates]] }}</includeonly>
Summary:
Please note that all contributions to Thetacola Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Project:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:Category link with count
(
edit
)
Template:Clc
(
edit
)
Template:High-use
(
edit
)
Template:High risk
(
edit
)
Template:Module rating
(
edit
)
Template:Nowrap
(
edit
)
Template:Para
(
edit
)
Template:Template link
(
edit
)
Template:Template link null
(
edit
)
Template:Tl
(
edit
)
Template:Tnull
(
edit
)
Module:Arguments
(
edit
)
Module:High-use
(
edit
)
Module:ISO 3166
(
edit
)
Module:ISO 3166/data/National
(
edit
)
Module:Message box
(
edit
)
Module:Message box/configuration
(
edit
)
Module:Message box/ombox.css
(
edit
)
Module:String
(
edit
)
Module:Template link general
(
edit
)
Module:Transclusion count
(
edit
)
Module:Transclusion count/data/I
(
edit
)
Module:Yesno
(
edit
)
Navigation menu
Page actions
Module
Discussion
Read
Edit source
History
Page actions
Module
Discussion
More
Tools
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Search
Tools
What links here
Related changes
Special pages
Page information