Difference between revisions 468892 and 484737 on arzwiki

{{صفحه توثيق فرعيه}}
<!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE -->

The {{tl|CountryAbbr}} template attempts to generate the [[ISO 3166-1 alpha-2]] or [[ISO 3166-2]] code for a named country or geographic region, for use in the <code>region:</code> parameter of {{tl|Coord}}.  It attempts a [[ISO 3166-2]] region code for locations in Canada, France, Germany, India, and the United States.  It attempts a [[ISO 3166-1 alpha-2]] country code for all other locations.

==  Parameters  ==
The first (required) argument specifies the name of the country, such as "United States" or "Chile".

The second (optional) argument is the name of a state or province within the specified country, such as "Alaska".

Attempts have been made to recognize variations commonly seen in infoboxes, such as:
* <nowiki>[[Chile]]</nowiki>
* <nowiki>[[Image:Flag of Chile.svg|25px]] [[Chile]]</nowiki>
* <nowiki>{{CHL}}</nowiki>
* <nowiki>{{flag|Chile}}</nowiki>
So far, however, the template has failed to keep up with the ingenuity of infobox creators.

==  Bugs  ==
Locations in Canada, India, and the United States generate invalid region codes (CA-X, IN-X, and US-X) if the second argument is omitted, blank, or invalid.

==  Used in  ==
* {{tl|Geobox}}
* {{tl|Infobox building}}
* {{tl|Infobox settlement}}

==  Implementation notes  ==
{{tl|CountryAbbr}} can handle many inputs simply and directly.  In some cases, however, it invokes a helper template:
*{{tl|CountryAbbr2}} - (expensive) cases where the first parameter is a template
*{{tl|CanAbbr2}} - provinces, territories, etc. of Canada
*{{tl|FraAbbr}} - departments, etc. of France
*{{tl|IndAbbr}} - states, etc. of India
*{{tl|StateAbbr}} - states, districts, etc. of the United States

<includeonly>
<!-- CATEGORIES AND INTERWIKIS HERE, THANKS -->
[[Category:Geography and place metatemplates]]</includeonly>

<noinclude>
[[pt:Predefinição:CountryAbbr]]
</noinclude>