Content deleted Content added
→Guinea-Bissau error: new section |
→Unexpected error in infobox: new section |
||
(32 intermediate revisions by 8 users not shown) | |||
Line 1:
{{Permanently protected}}
== Template-protected edit request on 20 September 2018 ==
Line 217 ⟶ 219:
Looks like Kosovo (XK) is missing? [[User:Le Deluge|Le Deluge]] ([[User talk:Le Deluge|talk]]) 23:40, 24 August 2020 (UTC)
:Still missing — [[User:GhostInTheMachine|GhostInTheMachine]] <sup>[[User talk:GhostInTheMachine|talk to me]]</sup> 11:06, 5 February 2025 (UTC)
::@[[User:GhostInTheMachine|GhostInTheMachine]], [[User:Le Deluge|Le Deluge]]: XK is not actually in ISO 3166. There would need to be some consensus here before adding it (although it has been mentioned a few times over the years). <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 18:02, 5 February 2025 (UTC)
:::I know, but this module is used in a number of contexts where the absence of XK does cause problems — [[User:GhostInTheMachine|GhostInTheMachine]] <sup>[[User talk:GhostInTheMachine|talk to me]]</sup> 18:07, 5 February 2025 (UTC)
::::@[[User:GhostInTheMachine|GhostInTheMachine]] I went ahead and added it, we'll see if anyone complains. <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 18:48, 5 February 2025 (UTC)
:::::{{kitty}} Did they also define any subdivision codes? — [[User:GhostInTheMachine|GhostInTheMachine]] <sup>[[User talk:GhostInTheMachine|talk to me]]</sup> 18:53, 5 February 2025 (UTC)
::::::@[[User:GhostInTheMachine|GhostInTheMachine]] I'm not aware of any standardized ones. <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 19:38, 5 February 2025 (UTC)
:::::::Thanks. I could not find any either. At least the error messages have changed — [[User:GhostInTheMachine|GhostInTheMachine]] <sup>[[User talk:GhostInTheMachine|talk to me]]</sup> 20:26, 5 February 2025 (UTC)
== substitutable? ==
I tried to subst {{tlx|Country name}} and I got a bare invoke instead of the output. Is there a way to subst these templates? –[[User:Fredddie|Fredddie]][[User talk:Fredddie|™]] 06:03, 2 January 2022 (UTC)
:@[[User:Fredddie|Fredddie]], you could just subst the underlying module instead of using the template, and that should (?) work. If it's tested enough, we could change the code from <code><nowiki>{{#invoke:ISO 3166|name}}</nowiki></code> to <code><nowiki>{{safesubst:<noinclude/>#invoke:ISO 3166|name}}</nowiki></code>, which would allow substitution via the template. <span style="color:#AAA"><small>{{u|</small><span style="border-radius:9em;padding:0 5px;background:#088">[[User:Sdkb|<span style="color:#FFF">'''Sdkb'''</span>]]</span><small>}}</small></span> <sup>[[User talk:Sdkb|'''talk''']]</sup> 20:53, 17 March 2022 (UTC)
== Guinea-Bissau error ==
Currently, <code><nowiki>{{ISO 3166 code-3|Guinea-Bissau}}</nowiki></code> does not return anything, despite seemingly being listed [[Module:ISO 3166/data/National|in the module]]. Could anyone figure out the error and resolve it? <span style="color:#AAA"><small>{{u|</small><span style="border-radius:9em;padding:0 5px;background:#088">[[User:Sdkb|<span style="color:#FFF">'''Sdkb'''</span>]]</span><small>}}</small></span> <sup>[[User talk:Sdkb|'''talk''']]</sup> 20:51, 17 March 2022 (UTC)
:It might be the hyphen. "GuineaBissau" works as input, even though it shouldn't. Also, invalid values return nothing instead of an error message. See [[:Template:ISO 3166 code-3/testcases]]. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 17:42, 18 March 2022 (UTC)
::@[[User:Jonesey95|Jonesey95]], hmm, yeah. Any idea what it is about the hyphen that's leading to the bug? <span style="color:#AAA"><small>{{u|</small><span style="border-radius:9em;padding:0 5px;background:#088">[[User:Sdkb|<span style="color:#FFF">'''Sdkb'''</span>]]</span><small>}}</small></span> <sup>[[User talk:Sdkb|'''talk''']]</sup> 01:16, 23 March 2022 (UTC)
:::<syntaxhighlight lang="lua">
::: if string.find(code1,"%-") then
::: code1, code2 = string.match(code1,"^([^%-]*)%-(.*)$")
::: end
:::</syntaxhighlight>
:::This is the problamtic piece of code. It splits "Guinea-Bissau" into "Guinea" and "Bissau". I'm not sure what the design rational behind that was though. [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 16:27, 31 March 2022 (UTC)
::::It's to handle the format <code><COUNTRY>-<SUBDIVISION></code>, like 'United Kingdom-England' — [[User:Wqnvlz|wqnvlz]] ([[User talk:Wqnvlz|talk]] '''·''' [[Special:Contributions/Wqnvlz|contribs]]) 17:08, 31 March 2022 (UTC)
:::::It looks like the code should check to see if "Xxxx-Yyyy" matches a valid country name first, then fall back to "Country-Subdivision". – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 19:31, 31 March 2022 (UTC)
:Continued from the [[WP:VPT#Help needed at Module talk:ISO 3166|this]] discussion.
:Let's try to finish up the fix for this so it can be used [[WP:Request a query#Map of countries by GAs/FAs per capita|where it was discovered]].
:*I made it also handle multiple hyphens. Overall, the [[Module talk:ISO 3166/testcases|tests page]] shows what has and hasn't changed (some older cases are commented out for runtime).
:*Hyphens are now significant, so input like 'GuineaBissau' no longer works. However, I'm not sure if this is really desired because quite a few subdivisions have hyphenated names that look like they might be used with spaces informally. For example, I can see one instance in the refs of [[Stoke-on-Trent]].
:**For reference, {{sl |insource:/[A-z]-[A-z]/ prefix:Module:ISO 3166/data |here's a search}} for all hyphenated names in the data
:*The way the UK data is stored ([[Module:ISO 3166/data/GB|here]]) makes the individual countries indistinguishable, so subdivisions belonging to the incorrect country like <code><nowiki>{{#invoke:ISO 3166|name|England|Glasgow}}</nowiki></code> work. How did this work in the original ISO standard?
:*Even though the top-level behaviour as seen in the tests remains largely unchanged, some of the underlying functions now handle things like <code>nil</code> vs <code>'<nowiki />'</code> differently. This might break direct invocations in other modules/templates (Hyrum's law, I suppose). Some searches for invocations:
:**{{sl |module: insource:"Module ISO 3166" |in modules}}
:**{{sl |template: insource:"invoke ISO 3166" |in templates}}
:**{{sl |all: insource:"invoke ISO 3166" |everywhere}}
:*An error message that wasn't showing up now does—is this desirable or are we relying on the template to fail silently? There are other cases that still don't have messages.
:*Profiling time varies widely; the testcase page is around 6 s with only main and 2 s with only sandbox.
: — [[User:Wqnvlz|wqnvlz]] ([[User talk:Wqnvlz|talk]] '''·''' [[Special:Contributions/Wqnvlz|contribs]]) 01:23, 2 April 2022 (UTC)
::According to those searches, the only significant direct callers of the module are {{tl|Infobox road}} & {{tl|Infobox country}} (which use the return values as-is) and {{tl|Infobox settlement}} (which uses geocoordinsert(), which ''has no testcases'').
::Regarding the section above, I don't see what about <code>safesubst:</code> wouldn't work; for good measure, I tested at {{diff||1080938489||Template:ISO 3166 code-3/testcases}} and it looks fine.
::I noticed [[Module talk:ISO 3166/testcases/core]] and [[Module talk:ISO 3166/testcases/test]] are some sort of framework for wikitext-only tests, but they're mostly broken for some reason (including a case that regressed with the sandbox changes): {{tlx|Module_talk:ISO_3166/testcases/test|name}}
::I'm not sure if that's cause for concern. {{ping|Sdkb|Jonesey95|Trappist the monk|Johnuniq}} —[[User:Wqnvlz|wqnvlz]] ([[User talk:Wqnvlz|talk]] '''·''' [[Special:Contributions/Wqnvlz|contribs]]); 19:34, 5 April 2022 (UTC)
:::Those testcases are failing because /test puts the input as argument 3, core puts it as argument 2, and then [[Module:Arguments]] is blending the frame args and the parent frame args and the input is getting duplicated (it's as if you entered {{mlx|ISO 3166|name|Canada|Canada}}). <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 17:23, 16 August 2024 (UTC)
:@[[User:Jonesey95|Jonesey95]] I implemented your suggestion to remove the hyphen only after the initial lookup fails in the sandbox at [[Special:Diff/1100609312/1240674198]]. The logic ended up being a little more complicated since the lookup is done differently depending on whether there is a second parameter:
:# If there is no second parameter and the lookup fails, then split it on the hyphen and try again
:# If there is a second parameter and the first parameter lookup succeeds and the second parameter lookup fails, and the second parameter is hyphenated, move the first part back to the first parameter (so if #1 split "Guinea-Bissau-Leste" into "Guinea" and "Bissau-Leste", try again with "Guinea-Bissau" and "Leste")
:# If there is a second parameter and the first parameter lookup fails, try stripping everything after the hyphen in the first parameter (so if #1 split "UK-ENG-Greenwich" into "UK" and "ENG-Greenwich", and #2 changed it to "UK-ENG" and "Greenwich", try again with "UK" and "Greenwich")
:All the [[Module_talk:ISO_3166/testcases|testcases]] seem to show improvement. Also pinging {{u|Frietjes}}, since he's the last to edit the module. <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 17:48, 16 August 2024 (UTC)
::<code><nowiki>{{ISO 3166 code-3|Guinea-Bissau}}</nowiki></code> still returns nothing. I think the sandbox code may still need to be moved to the live module. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 01:04, 5 February 2025 (UTC)
:::@[[User:Jonesey95|Jonesey95]] {{done}} <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 18:07, 5 February 2025 (UTC)
== Kosovo still missing ==
3 years ago asked at [[#Kosovo?]] and still relevant. I'm unfamiliar with these modules so would rather not edit and break anything here. Can this be added please? [[User:Gonnym|Gonnym]] ([[User talk:Gonnym|talk]]) 13:36, 11 January 2024 (UTC)
:XK is not listed in ISO 3166 <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 20:45, 15 August 2024 (UTC)
== geocoordinsert ==
Template:Infobox settlement uses <nowiki>{{#invoke:ISO 3166|geocoordinsert}}</nowiki>, but this option is not explained on the documentation page for this module. Is it possible for someone to explain the parameters that can be used and what the output should look like for this option? [[User:Redheadkelly|Redheadkelly]] ([[User talk:Redheadkelly|talk]]) 03:11, 17 February 2024 (UTC)
== alt name does not appear to be working for "People's Republic of China" pulled from Wikidata ==
<syntaxhighlight lang=wikitext inline>{{ISO 3166 code|{{{country|{{#property:P17}}}}}}}</syntaxhighlight> is code used in {{tl|Infobox station}}. At [[Qiziwan railway station]], <code>#property:P17</code> pulls "People's Republic of China" from property 17 for that article's Wikidata item, but the ISO template returns nothing. This appears to cause the article to be placed in {{cl|Wikipedia page with obscure country}} unnecessarily.
[[Module:ISO 3166/data/National]] contains "People's Republic of China" as one of China's <code>altnames</code>. <syntaxhighlight lang=wikitext inline>{{ISO 3166 code|Ivory Coast}}</syntaxhighlight> correctly returns "CI", apparently using an altname from that same module subpage. I haven't been able to figure out where this process is failing for "People's Republic of China". Any ideas? – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 01:09, 5 February 2025 (UTC)
:I think I figured out one thing. The property call to Wikidata is returning "<syntaxhighlight lang=wikitext inline>People's Republic of China</syntaxhighlight>", using an HTML entity for the apostrophe. Now I don't know where to ask about troubleshooting that problem. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 01:15, 5 February 2025 (UTC)
::@[[User:Jonesey95|Jonesey95]] {{fixed}} [[Special:Diff/1274160458|here]]. <span class="nowrap">--[[User:Ahecht|Ahecht]] ([[User talk:Ahecht|<b style="color:#FFF;background:#04A;display:inline-block;padding:1px;vertical-align:middle;font:bold 50%/1 sans-serif;text-align:center">TALK<br />PAGE</b>]])</span> 19:33, 5 February 2025 (UTC)
:::Wonderful. Thanks for figuring out where and how to fix it. – [[User:Jonesey95|Jonesey95]] ([[User talk:Jonesey95|talk]]) 20:45, 5 February 2025 (UTC)
== Unexpected error in infobox ==
Please see description of a bug, at [[Template talk:Infobox officeholder#ISO 3166-1 related error]]. <span class="vcard"><span class="fn">[[User:Pigsonthewing|Andy Mabbett]]</span> (<span class="nickname">Pigsonthewing</span>); [[User talk:Pigsonthewing|Talk to Andy]]; [[Special:Contributions/Pigsonthewing|Andy's edits]]</span> 11:42, 19 August 2025 (UTC)
|