Template:Establishment category in country: Difference between revisions
m Typo |
start switchover to version without year parameters |
||
Line 1: | Line 1: | ||
⚫ | |||
⚫ | |||
# The first step is to check whether this uses the old-style year parameters, of the form {{EstcatCountry| YYY | Y | country [ | sort key [ | new name ]] }} |
|||
{{Category explanation|organizations, places and other things founded or established in '''[[{{#if:{{{dab|}}}|{{{dab}}}{{!}}|}}{{{3}}}]]''' in the year '''[[{{#ifexpr:{{{1}}}{{{2}}} < 10|AD {{{1}}}{{{2}}}|{{{1}}}{{{2}}}}}]]'''}} |
|||
# The new form is {{EstcatCountry| country [ | sort key [ | new name ]] }} |
|||
{| class="toccolours" style="margin:1em auto;" |
|||
# If it is then all parameters should be passed to the old template ... if not, then use the new core |
|||
|{{LinkCatIfExists2|{{{1}}}0s establishments in {{{3}}}|{{{1}}}0s establishments in {{{3}}}}}: |
|||
# |
|||
|{{#ifexpr: {{{1}}}0 < 10 ||{{LinkCatIfExists2|{{#expr: {{{1}}}0 - 1}} establishments in {{{3}}}|←}} {{LinkCatIfExists2|{{{1}}}0 establishments in {{{3}}}|{{{1}}}0}} • }}{{LinkCatIfExists2|{{{1}}}1 establishments in {{{3}}}|{{{1}}}1}} • {{LinkCatIfExists2|{{{1}}}2 establishments in {{{3}}}|{{{1}}}2}} • {{LinkCatIfExists2|{{{1}}}3 establishments in {{{3}}}|{{{1}}}3}} • {{LinkCatIfExists2|{{{1}}}4 establishments in {{{3}}}|{{{1}}}4}} • {{LinkCatIfExists2|{{{1}}}5 establishments in {{{3}}}|{{{1}}}5}} • {{LinkCatIfExists2|{{{1}}}6 establishments in {{{3}}}|{{{1}}}6}} • {{LinkCatIfExists2|{{{1}}}7 establishments in {{{3}}}|{{{1}}}7}} • {{LinkCatIfExists2|{{{1}}}8 establishments in {{{3}}}|{{{1}}}8}} • {{LinkCatIfExists2|{{{1}}}9 establishments in {{{3}}}|{{{1}}}9}} {{LinkCatIfExists2|{{#expr: {{{1}}}9 + 1}} establishments in {{{3}}}|→}} |
|||
# We check this by concatenating the first 2 parameters, and then checking that they are all digits. |
|||
|} |
|||
-->{{#ifeq: {{#invoke:String|match|s={{{1}}}{{{2}}}|pattern=^%d%d%d%d?$|start=1|match=1|plain=false|nomatch=%%nomatch%%}}|%%nomatch%%<!-- |
|||
-->|<!-- |
|||
{{Category see also if exists 2|{{{1}}}{{{2}}} disestablishments in {{{3}}}|{{{1}}}0s disestablishments in {{{3}}}}}<includeonly> |
|||
# NOT using the old-style parameters |
|||
[[Category:{{{1}}}{{{2}}} establishments by country|{{{4|{{{3}}}}}}]] |
|||
# So invoke the new core |
|||
{{#ifeq:{{{decadeparent}}}|no||[[Category:{{{1}}}0s establishments in {{{3}}}]]}} |
|||
-->{{EstcatCountry/core |
|||
{{#ifexpr: {{{1}}}0 < 1000 | [[Category:Establishments in {{{3}}} by year|0{{{1}}}]] | [[Category:Establishments in {{{5|{{{3}}}}}} by year]]}} |
|||
| year = {{{year|{{Title year}}}}} <!-- allow year param for demonstration purposes --> |
|||
[[Category:{{{1}}}{{{2}}} in {{{3}}}|/Establishments]] |
|||
| country = {{{1|}}} |
|||
{{#if: {{{5|}}} | [[Category:EstcatCountry with newname parameter|{{{4|{{{3}}}}}}]]}} |
|||
| sortkey = {{{2|}}} |
|||
⚫ | |||
| newname = {{{3|}}} |
|||
# Note {{YearParamUsageCheck}} needs to be available whether or not this template page has been transcluded |
|||
| decadeparent = {{{decadeparent|}}} |
|||
-->{{YearParamUsageCheck |
|||
| nocat={{{nocat|}}} |
|||
| min={{{min|}}} |
|||
| templatename = EstcatCountry |
|||
| dab={{{dab|}}} |
|||
⚫ | |||
}}<!-- |
|||
⚫ | |||
# Tracking usage of new versions of the template |
|||
⚫ | |||
-->{{Category other|[[Category:Pages using new version of Template EstcatCountry]]}}<!-- |
|||
</noinclude> |
|||
-->|<!-- |
|||
# FOUND the old-style parameters |
|||
# So invoke the new old template |
|||
⚫ | |||
-->|nocat={{{nocat|}}}|decadeparent={{{decadeparent|}}}|dab={{{dab|}}}}}<!-- |
|||
# Tracking usage of old versions of the template |
|||
-->{{Category other|[[Category:Pages using old version of Template EstcatCountry]]}}<!-- |
|||
-->}}</includeonly><noinclude> |
|||
⚫ | |||
⚫ | |||
⚫ |
Revision as of 07:15, 31 August 2019
![]() | This template is used on approximately 29,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. |
Usage
In September 2019, this template's syntax was changed to a new format which doesn't need year parameters. If used, they will now trigger an error message, and the page will be categorised in Category:Errors reported by establishment and disestablishment templates (population: 0) Purge page to update total
Syntax
{{EstcatCountry| country [ | sort key ]}}
- Examples
- {{EstcatCountry|the United States|United States}}
- {{EstcatCountry|Belgium}}
Change of country name
From 2015 to January 2022, this template took an optional parameter for a new name of the country. That parameter is now obsolete, as the template makes use of category redirects instead.
If the default parent category "Establishments in 'X' by year" is a category redirect page, the template will resolve the category redirect, i.e. it will use the target page with the new name instead. Similarly, it will resolve a redirect on the decade parent.
- Examples
- The name Myanmar is used on all categories for 1989 onwards, and for any periods ending in or after that year, e.g. 1980s and 20th century.
For categories up to 1988, use the old name, i.e.
{{EstcatCountry|Burma}}
On Category:1988 establishments in Burma, the template generates parent categories Category:1980s establishments in Myanmar and Category:Establishments in Myanmar by year, because both Category:1980s establishments in Burma and Category:Establishments in Burma by year are category redirects to the corresponding names using Myanmar.
On Category:1906 establishments in Burma, the parent categories will be Category:1900s establishments in Burma, which is not redirected, but Category:Establishments in Myanmar by year.
Suppressing parent category for decade
The template normally adds the page into a parent for the decade. In cases where that decade category does not exist, and it would not be useful to create it because of the short duration or small number of categories for this country, append |decadeparent=no
Disambiguation
If the country name used in the category title is ambiguous, use the optional named dab parameter to link to the mainspace article about the country.
- Example
- {{estcatCountry|Malaya|dab=Malayan Union}}
Error checking
Error messages are display if this template is used in a which is not named "Category:YYYY establishments in Foo", and are categorized in Category:Errors reported by establishment and disestablishment templates.
See also
- Template:EstcatCountryDecade
- Template:EstcatCountryCentury
- Template:EstcatCountry2ndMillennium
- Template:EstcatCountry3rdMillennium
- Template:Estcatsubcountry (for subdivisions of countries, like states, provinces, departments; or regions of continents)
- Template:EstcatUSstate
- Template:DisestcatCountry