Template:Countries of the Americas

From Wikimedia Commons, the free media repository
Jump to navigation Jump to search

This documentation is transcluded from Template:Countries of Africa/doc.

Displays a navigation box with links to similar galleries or categories for every country in a region. Links to existing pages are displayed using country names in the current user's language. Country names are obtained from Wikidata. If the name of a country is incorrect, find the country in this list and use the link in the Item column to check what changes have occurred at Wikidata.

Usage

[edit]

{{Countries of the Americas|prefix=:Namespace:Prefix text|suffix=suffix text}}

Template parameters

[edit]
Parameter Description Default Status
prefix Text inserted before the English country name for each link. empty optional
suffix Text added after the English country name for each link. empty optional
sep Separator between prefix and name, and between name and suffix. space optional
simple For some templates, |simple=yes simplifies the output, omitting some sections (e.g. for smaller or special territories, but possibly adding some of them in another displayed section). empty optional
showcode Use |showcode=yes to also display the country/territory code (between square brackets) after each linked label. The codes displayed are those defined in the data module. empty optional
all Use |all=yes for a temporary test to show all links without testing for their existence; will show red links. empty optional
nocat Use |nocat=yes for a demonstration where a template with invalid parameters should not output a tracking category. empty optional


Templates and country data

[edit]

The following templates are implemented by Module:Countries:

Template Data module Examples and test cases
{{Countries of Africa}} Module:Countries/Africa testcases
{{Countries of the Americas}} Module:Countries/Americas testcases
{{Countries of the Arab world}} Module:Countries/Arab world testcases
{{Countries of Asia}} Module:Countries/Asia testcases
{{Countries of the Caribbean}} Module:Countries/Caribbean testcases
{{Countries of Central America}} Module:Countries/Central America testcases
{{Countries of Europe}} Module:Countries/Europe testcases
{{Countries of the European Union}} Module:Countries/European Union testcases
{{Countries of North America}} Module:Countries/North America testcases
{{Countries of North America (subcontinent)}} Module:Countries/North America (subcontinent) testcases
{{Countries of Oceania}} Module:Countries/Oceania testcases
{{Countries of South America}} Module:Countries/South America testcases
{{Olympic teams}} Module:Countries/Olympic teams testcases
{{Constituent countries of the United Kingdom}} Module:Countries/United Kingdom testcases
{{States of the United States}} Module:States of the United States testcases
{{Departments of France}} Module:Departments of France testcases
{{Regions of France}} Module:Regions of France testcases

For example, {{Countries of Africa}} contains:

{{#invoke:Countries|main|Africa}}

The parameter Africa means data from Module:Countries/Africa is used. Changes to the countries or the text displayed are made in the data module.

Before updating the main data module, changes should be made in the sandbox data module and tested with the sandbox template:

Sandbox template Sandbox data module
{{Countries of Africa/sandbox}} Module:Countries/Africa/sandbox
{{Countries of the Americas/sandbox}} Module:Countries/Americas/sandbox
{{Countries of the Arab world/sandbox}} Module:Countries/Arab world/sandbox
{{Countries of Asia/sandbox}} Module:Countries/Asia/sandbox
{{Countries of the Caribbean/sandbox}} Module:Countries/Caribbean/sandbox
{{Countries of Central America/sandbox}} Module:Countries/Central America/sandbox
{{Countries of Europe/sandbox}} Module:Countries/Europe/sandbox
{{Countries of the European Union/sandbox}} Module:Countries/European Union/sandbox
{{Countries of North America/sandbox}} Module:Countries/North America/sandbox
{{Countries of North America (subcontinent)/sandbox}} Module:Countries/North America (subcontinent)/sandbox
{{Countries of Oceania/sandbox}} Module:Countries/Oceania/sandbox
{{Countries of South America/sandbox}} Module:Countries/South America/sandbox
{{Olympic teams/sandbox}} Module:Countries/Olympic teams/sandbox
{{Constituent countries of the United Kingdom/sandbox}} Module:Countries/United Kingdom/sandbox
{{States of the United States/sandbox}} Module:States of the United States/sandbox
{{Departments of France/sandbox}} Module:Departments of France/sandbox
{{Regions of France/sandbox}} Module:Regions of France/sandbox

For example {{Countries of Africa/sandbox}} just contains:

{{#invoke:Countries/sandbox|main|Africa}}

And it uses the sandbox version of the associated data module, used by Module:Countries/sandbox (which is the sandbox version of Module:Countries).

Displaying the sandbox version of a template also allows testing changes in Module:Countries, without modifying the template or its associated data module (which don't need to be changed in their sandbox version).

The following two examples below allow testing changes made in the sandbox before applying working modifications to the normal version. This should work as intended and will finally display the same thing between the normal and sandbox versions of the template (and of their associated data module) once these versions are synchronized.

  • {{Countries of the Americas/sandbox|prefix=:Category:}}
  • {{Countries of the Americas|prefix=:Category:}}

See more examples in the testcases listed above for the normal version with their rendering to compare the results in the sandbox version.

Errors

[edit]

If an invalid parameter is used, an error message is displayed when an edit to the page is previewed. If a page with an error is saved, no message is displayed but the page is added to a hidden error tracking category: Category:Countries template with invalid parameters.

For example the following code misspells the expected suffix parameter (For this demonstration, no tracking category is added because |nocat=yes is used).

{{Countries of the Americas|prefix=:Category:Maps of|sufix=by region|nocat=yes}}

Previewing an edit on any category or gallery page, with such code added (not on this documentation page!) shows the result and the following message Error: invalid parameter "|sufix=by region" will appear. You can fix it by editing the code in your edited page.

No description.

Template parameters[Edit template data]

ParameterDescriptionTypeStatus
prefixprefix

Text inserted before the English country name for each link.

Lineoptional
suffixsuffix

Text added after the English country name for each link.

Lineoptional
sepsep

Separator between prefix and name, and between name and suffix.

Lineoptional
simplesimple

For some templates, simple=yes simplifies the output, omitting some sections (e.g. for smaller or special territories, but possibly adding some of them in another displayed section).

Lineoptional
showcodeshowcode

Use showcode=yes to also display the country/territory code (between square brackets) after each linked label. The codes displayed are those defined in the data module.

Lineoptional
allall

Use all=yes for a temporary test to show all links without testing for their existence; will show red links.

Lineoptional
nocatnocat

Use nocat=yes for a demonstration where a template with invalid parameters should not output a tracking category.

Lineoptional