Module talk:Country population
Static Row Numbers
Hey, Jts1882, would {{srn}} be useful in this module? — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 21:59, 2 May 2021 (UTC)
- Done
- FYI, you can't just add templates or tags to wikitext output generated in a module, as they won't expand properly. You need to use
frame:expandTemplate
orframe:extensionTag
- P.S. I don't think the template {{srn}} is a good idea. It's to short to make it clear what it does and looks like one of the short note citation template, which could confuse people. Better to use the full template name which gives an indication of what it is doing. — Jts1882 | talk 08:56, 5 May 2021 (UTC)
Bottom alignment
Jts1882: Rows seem to be valigned to the bottom. I had a look at the code, and could only find bottom alignment for the header row, which is fine. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 01:07, 5 May 2021 (UTC)
Flaglist vs Flagcountry
Jts1882: Wouldn't {{flaglist}} be better for alignment than {{flagcountry}} here? — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 (talk) 01:28, 5 May 2021 (UTC)
Template wrapper
I started a template wrapper for this module bc I wanted to pass the list of countries as a template (like the {{List of countries in South America}}), bc the MW engine processes modules before templates. The main function here is commented with called from template
, but I got stuck passing through the arguments. Did you already create the template you referred to there, Jts1882, or can you help me beat that one into shape? Cheers. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 ☎ 08:17, 13 June 2021 (UTC)
- The main() function wasn't doing anything. The module was using p.populations().
- When a module is called directly from #invoke the arguments are in frame.args. The function p.populations() uses these frame arguments. I've split p.populations to have an entry point for invoke that gets the frame arguments and calls p._populations() to generate the table.
- When called from a template the arguments are in the parent frame. I've changed main() to get the parent frame arguments and then call p._populations() so it now seems to work for the template. Not an ideal approach but an easy change for now. — Jts1882 | talk 10:04, 13 June 2021 (UTC)
Country | Projected population (2 September 2025) | Pct of total | UN Population estimates | Annual growth[a] | Doubling time (years)[b] | ||
---|---|---|---|---|---|---|---|
1 July 2023 | 1 July 2022 | Increment | Rate | ||||
Brazil | 212,965,319 | 48.56% | 211,140,729 | 210,306,415 | 834,314 | 0.40% | 175 |
Colombia | 53,611,368 | 12.22% | 52,321,152 | 51,737,944 | 583,208 | 1.13% | 62 |
Argentina | 45,823,296 | 10.45% | 45,538,401 | 45,407,904 | 130,497 | 0.29% | 242 |
Peru | 34,664,279 | 7.90% | 33,845,617 | 33,475,438 | 370,179 | 1.11% | 63 |
Venezuela | 28,492,688 | 6.50% | 28,300,854 | 28,213,017 | 87,837 | 0.31% | 223 |
Chile | 19,890,739 | 4.54% | 19,658,835 | 19,553,036 | 105,799 | 0.54% | 128 |
Ecuador | 18,324,247 | 4.18% | 17,980,083 | 17,823,897 | 156,186 | 0.88% | 79 |
Bolivia | 12,615,106 | 2.88% | 12,244,159 | 12,077,154 | 167,005 | 1.38% | 50 |
Paraguay | 7,029,596 | 1.60% | 6,844,146 | 6,760,464 | 83,682 | 1.24% | 56 |
Uruguay | 3,381,935 | 0.77% | 3,388,081 | 3,390,913 | −2,832 | −0.08% | −830 |
Guyana | 836,696 | 0.19% | 826,353 | 821,637 | 4,716 | 0.57% | 121 |
Suriname | 641,503 | 0.15% | 628,886 | 623,164 | 5,722 | 0.92% | 76 |
French Guiana | 314,779 | 0.07% | 303,402 | 298,306 | 5,096 | 1.71% | 41 |
Falkland Islands | 3,449 | 0.00% | 3,477 | 3,490 | −13 | −0.37% | −186 |
Total | 438,594,999 | 100% | 433,024,175 | 430,492,779 | 2,531,396 | 0.58% | 118 |
- I wonder what I need to do to get this to work:
Country Projected population
(2 September 2025)Pct of
totalAnnual growth Doubling time
(years)Increment Rate Brazil 212,965,319 48.56% 834,314 0.40% 175 Colombia 53,611,368 12.22% 583,208 1.13% 62 Argentina 45,823,296 10.45% 130,497 0.29% 242 Peru 34,664,279 7.90% 370,179 1.11% 63 Venezuela 28,492,688 6.50% 87,837 0.31% 223 Chile 19,890,739 4.54% 105,799 0.54% 128 Ecuador 18,324,247 4.18% 156,186 0.88% 79 Bolivia 12,615,106 2.88% 167,005 1.38% 50 Paraguay 7,029,596 1.60% 83,682 1.24% 56 Uruguay 3,381,935 0.77% −2,832 −0.08% −830 Guyana 836,696 0.19% 4,716 0.57% 121 Suriname 641,503 0.15% 5,722 0.92% 76 French Guiana 314,779 0.07% 5,096 1.71% 41 Falkland Islands 3,449 0.00% −13 −0.37% −186 Total 438,594,999 100% 2,531,396 0.58% 118 - Yeah, well, I know it works like that—
{{Country populations|ARG|BOL|BRA|COL|PER|VEN|CHL|ECU|PRY|URY|GUY|GUF|SUR|FLK}}
—but what I really wanted was: {{Country populations|{{List of countries in South America|ISO=y}}}}
- Lua error: bad argument #1 to 'formatNum' (NaN).
- The motive here is replicating the good work you did with {{Country populations}} to, say, {{Country areas}}, {{Country densities}}, etc, so that the list of countries in each region could be centrally maintained in a single template for each. — 𝐆𝐮𝐚𝐫𝐚𝐩𝐢𝐫𝐚𝐧𝐠𝐚 ☎ 21:59, 13 June 2021 (UTC)
- The problem there is that the result of that is to set parameter
|1=Template:List of countries in South America
. - I don't think you can use a template to supply a series of parameters. The solutions is to get the module to handle a list (e.g. comma delimited). If the module is handling it, then the lists may as well be stored in a subpage and be provided a via a parameter, e.g.
|
. — Jts1882 | talk 08:24, 14 June 2021 (UTC)
- The problem there is that the result of that is to set parameter
- Yeah, well, I know it works like that—
Country | Projected population (2 September 2025) | Pct of total | UN Population estimates | Annual growth | Doubling time (years) | ||
---|---|---|---|---|---|---|---|
1 July 2023 | 1 July 2022 | Increment | Rate | ||||
Brazil | 212,965,319 | 48.56% | 211,140,729 | 210,306,415 | 834,314 | 0.40% | 175 |
Colombia | 53,611,368 | 12.22% | 52,321,152 | 51,737,944 | 583,208 | 1.13% | 62 |
Argentina | 45,823,296 | 10.45% | 45,538,401 | 45,407,904 | 130,497 | 0.29% | 242 |
Peru | 34,664,279 | 7.90% | 33,845,617 | 33,475,438 | 370,179 | 1.11% | 63 |
Venezuela | 28,492,688 | 6.50% | 28,300,854 | 28,213,017 | 87,837 | 0.31% | 223 |
Chile | 19,890,739 | 4.54% | 19,658,835 | 19,553,036 | 105,799 | 0.54% | 128 |
Ecuador | 18,324,247 | 4.18% | 17,980,083 | 17,823,897 | 156,186 | 0.88% | 79 |
Bolivia | 12,615,106 | 2.88% | 12,244,159 | 12,077,154 | 167,005 | 1.38% | 50 |
Paraguay | 7,029,596 | 1.60% | 6,844,146 | 6,760,464 | 83,682 | 1.24% | 56 |
Uruguay | 3,381,935 | 0.77% | 3,388,081 | 3,390,913 | −2,832 | −0.08% | −830 |
Guyana | 836,696 | 0.19% | 826,353 | 821,637 | 4,716 | 0.57% | 121 |
Suriname | 641,503 | 0.15% | 628,886 | 623,164 | 5,722 | 0.92% | 76 |
French Guiana | 314,779 | 0.07% | 303,402 | 298,306 | 5,096 | 1.71% | 41 |
Falkland Islands | 3,449 | 0.00% | 3,477 | 3,490 | −13 | −0.37% | −186 |
Total | 438,594,999 | 100% | 433,024,175 | 430,492,779 | 2,531,396 | 0.58% | 118 |
The above table is generated with {{Country populations|list=South America}}
. The list of countries is stored in a table as follows:
local country_lists = { ['South America'] = { "ARG","BOL","BRA","CHL","COL","ECU","GUY","PRY","PER","SUR","URY","VEN","BVT","FLK","SGS","GUF" } }
At the moment it is just a local variable in the function, but I suggest putting them in a subpage of the module. Then the subpage can be used by other modules. — Jts1882 | talk 16:26, 14 June 2021 (UTC)
Cite error: There are <ref group=lower-alpha>
tags or {{efn}}
templates on this page, but the references will not show without a {{reflist|group=lower-alpha}}
template or {{notelist}}
template (see the help page).