Page MenuHomePhabricator

Inform about localised special page aliases in Siteinfo API
Closed, InvalidPublic

Description

There’s an API for returning a list of all special page aliases:
https://ru.wikipedia.org/w/api.php?action=query&meta=siteinfo&siprop=specialpagealiases&formatversion=2

It returns translation of special page name that is used in URLs, but API doesn’t tell which one is being used as a ‘canonical’ special page name on a wiki. If this information is not available elsewhere, I would like it to be available in this API.

My potential use case: transform the alias into canonical name when linking to a special page (in different multilingual tools etc.) for people with less knowledge of English and/or removing additional 301s.

Event Timeline

but API doesn’t tell which one is being used as a ‘canonical’ special page name on a wiki

It's almost always the first one in the list of aliases. More specifically, it's the first one in the list of aliases that doesn't collide with some other special page, and the code logs a warning if that happens for the first alias in the list (e.g. T89034, T112410, T224841).

My potential use case: transform the alias into canonical name when linking to a special page (in different multilingual tools etc.) for people with less knowledge of English and/or removing additional 301s.

You could satisfy that a bit more directly. For example, to normalize "Special:Watchlist" on ruwiki, https://ru.wikipedia.org/w/api.php?formatversion=2&action=query&titles=Special:Watchlist tells you "Служебная:Список наблюдения".

It's almost always the first one in the list of aliases. More specifically, it's the first one in the list of aliases that doesn't collide with some other special page, and the code logs a warning if that happens for the first alias in the list (e.g. T89034, T112410, T224841).

Some special pages can have English aliases and not have translated aliases, so that way of guessing can be wrong.

You could satisfy that a bit more directly.

Point taken, but I think it’s more efficient to maybe have that list somewhere once, since there are 227 special pages in there. Of course, if this proposal is not really viable from some standpoint, I guess we can just close it then.

Some special pages can have English aliases and not have translated aliases, so that way of guessing can be wrong.

Do you have an example? I described the way MediaWiki itself determines the canonical alias, which works based on the same data that the API already returns.

Of course, if this proposal is not really viable from some standpoint, I guess we can just close it then.

It's not inviable, but it would result in adding another field that's almost always just a copy of aliases[0]. And where it isn't that's actually a bug in the localization.

Do you have an example? I described the way MediaWiki itself determines the canonical alias, which works based on the same data that the API already returns.

I think you’re actually right and I’m wrong, I misinterpreted the fact that some special pages do not match realname. I guess I can, indeed, rely on aliases[0] for this, thank you for explaining this. Decline the task if you wish.

I'll close this for now. No objection to reopening if the situation changes so aliases[0] is no longer suitable.