• Home
  • Random
  • Recent changes
  • Special pages
  • Settings
  • About MOASSpedia
  • Disclaimers
MOASSpedia
  • 216.73.216.55
  • Talk
  • Watchlist
  • Contributions
  • Log in

Template:Country alias

Template Discussion
  • Language
  • Watch
  • History
  • Edit
    • Page information
    • Permanent link
    • What links here
File:Test Template Info-Icon - Version (2).svg Template documentation[view] [edit] [history] [purge]
File:Ambox warning yellow.svgThis template is used on approximately 14,000 pages and changes may be widely noticed. Test changes in the template's /sandbox or /testcases subpages, or in your own user subpage. Consider discussing changes on the talk page before implementing them.
File:Lua-Logo.svgThis template uses Lua:
  • Module:Country alias
  • Module:Country alias/data

This template returns either a country name or the flag associated with that country, depending on the input parameters.

{{Country alias}} is primarily meant to be used for sporting competitions such as the Olympics, Commonwealth Games, Asian Games, etc.

Usage

There is one required parameter and three optional parameters.

country/1
The three-letter country code used by IOC, CGF, or FINA. This parameter can be an unnamed parameter.
flag
If set to yes, will return the flag of the country.
year
The input year will determine which flag is used. For example, any year before 1999 will give "Pre-1999 Flag of Tunisia.svg" for Tunisia (TUN), while any year after 1999 will give "Flag of Tunisia.svg".
games
This is another method of determining which flag is used. Some countries, such as Great Britain, used the Olympic flag during the 1980 Summer Olympics.

Examples

Here are some examples based on the entry for Italy (ITA)

ITA = {
	name = "Italy",
	{1946, "Flag of Italy (1861-1946).svg"},
	{2002, "Flag of Italy.svg"},
	{2006, "Flag of Italy (2003-2006).svg"},
	"Flag of Italy.svg",
	["Summer Olympics"] = {
		[1980] = "Olympic flag.svg",
	},
  • {{Country alias|ITA}} → Italy
  • {{Country alias|ITA|flag=yes}} → Flag of Italy.svg
  • {{Country alias|ITA|flag=yes|year=1946}} → Flag of Italy (1861-1946).svg
  • {{Country alias|ITA|flag=yes|year=1947}} → Flag of Italy.svg
  • {{Country alias|ITA|flag=yes|year=1980|games=Summer Olympics}} → Olympic flag.svg
  • {{Country alias|ITA|flag=yes|year=2006|games=Summer Olympics}} → Flag of Italy (2003–2006).svg

Note that in the last example games does not factor into the flag image.

Lua script error messages

If the country code is not supplied, or does not exist in the module, an error will be returned:

  • {{Country alias}} → Lua error in Module:Country_alias at line 181: Invalid country alias: {{{country}}}.
  • {{Country alias}} → Lua error in Module:Country_alias at line 181: Invalid country alias: nil.
  • {{Country alias|EXZ}} → Lua error in Module:Country_alias at line 181: Invalid country alias: EXZ.
  • {{Country alias|country=EXZ}} → Lua error in Module:Country_alias at line 181: Invalid country alias: EXZ.

To avoid generating a script error, use |error=value.

  • {{Country alias|EXZ|error=ERROR}} → ERROR
The above documentation is transcluded from Template:Country alias/doc. (edit | history)
Editors can experiment in this template's sandbox (create | mirror) and testcases (create) pages.
Add categories to the /doc subpage. Subpages of this template.
Retrieved from "https://moasspedia.org/w/index.php?title=Template:Country_alias&oldid=9973"
Categories:
  • Pages with broken file links
  • Lua-based templates
  • Wikipedia classification templates
  • Wikipedia formatting and function templates
Last edited on 30 January 2019, at 23:07

MOASSpedia

Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • This page was last edited on 30 January 2019, at 23:07.
  • Content is available under Creative Commons Attribution-ShareAlike unless otherwise noted.
  • Privacy policy
  • About MOASSpedia
  • Disclaimers
  • Desktop