Jump to content

Wikipedia:User scripts/Requests/Archive 5

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Lowercase sigmabot III (talk | contribs) at 06:24, 19 February 2021 (Archiving 1 discussion(s) from Wikipedia:User scripts/Requests) (bot). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
Archive 1Archive 3Archive 4Archive 5Archive 6Archive 7Archive 9

Eswatini vs. Swaziland sortkeys

Hello!

The country of Swaziland changed its name to Eswatini in 2018. Nearly all Wikipedia articles and categories that needed renaming have been moved to the new name, see e.g. Wikipedia:Categories for discussion/Log/2018 November 5 § Swaziland.

However, I noticed that this renaming may have left sortkeys that need correction. E.g. I found Category:Wealth in Eswatini in Category:Wealth by country and Category:Wealth in Africa with sortkey Swaziland, which left Eswatini in sequence between Sri Lanka and Sweden. I corrected them manually to Eswatini.

Is there a way to find all such sortkeys and have them corrected by a bot? That's how I would do it:

  • Look for every article or category that has Eswatini as part of its name
  • Look for category sortkey (found by [[Category:<whatever>|<sortkey>]], sometimes small-case category) or defaultsort ({{DEFAULTSORT:<sortkey>}}):
    • If exactly Swaziland or a prefix (such as Sw or Swaz, except just the letter S), replace by Eswatini exactly
    • If a longer sortkey includes Swaziland, not necessarily in the beginning (such as Swaziland, Economy of or Economy of Swaziland)
    • For sortkeys that are exactly the letter S (and we know that such sortkeys are found quite often), create a list of such occurrences for later manual treatment.

I think it's pretty safe to replace all the cases I have listed because we limit ourselves to titles that have been renamed to a name explicitly including Eswatini, so we would not affect content such as Category:Treaties extended to Swaziland (protectorate), for which Eswatini is anachronical, or Times of Swaziland, which is a proper noun. I think other namespaces (such as Template:) may be better left out for manual action.

Is there any bot master able to fulfill this request? Place Clichy (talk) 10:32, 29 May 2020 (UTC)

Place Clichy, I made a little script to do them, they should all be fixed now. BrandonXLF (talk) 06:49, 3 June 2020 (UTC)
@BrandonXLF: thanks, this looks very good! Were you by any chance able to look up partial prefix matches (such as |Swazi), even just to build a list that I could manually take care of later? Place Clichy (talk) 08:26, 3 June 2020 (UTC)
@BrandonXLF: Do you see any reason why e.g. Category:Immigrants to Eswatini was missed? Place Clichy (talk) 00:56, 14 June 2020 (UTC)
Place Clichy, because it's a category, I didn't have the namespace selected to search, my bad. There seems to be at least 382 categories that need fixing, see [1] and [2]. BrandonXLF (talk) 02:48, 14 June 2020 (UTC)