The extension has support for Items, Properties and Lexemes, allowing to prettify the output with the labels on proper language. Straightforward adding EntitySchemas to the list does not help, because `wbgetentities' Action API does not return data for them. After T362005: [ES-M3]: Investigate how search could work by label and aliases on the EntitySchema expert and T375641: [ES-M3]: Implement label and aliases search for EntitySchemas via the wbsearchentities API it should be a call for wbsearchentities per each entity, so looks like it needs to be cached. Maybe two calls if mul support is possible. So, it worth a separate task and a separate change.
Description
Details
| Subject | Repo | Branch | Lines +/- | |
|---|---|---|---|---|
| Add support for EntitySchema pages in Global Watchlist | mediawiki/extensions/GlobalWatchlist | master | +83 -17 |
| Status | Subtype | Assigned | Task | ||
|---|---|---|---|---|---|
| In Progress | Feature | IKhitron | T415450 Add support for EntitySchema elements | ||
| Resolved | BUG REPORT | IKhitron | T415306 Global Watchlist works wrong on Wikibase sites with items outside the main namespace | ||
| Resolved | BUG REPORT | IKhitron | T415337 Recognize Wikibase when no wgGlobalWatchlistWikibaseSite system variable is set |
Event Timeline
Change #1231682 had a related patch set uploaded (by IKhitron; author: IKhitron):
[mediawiki/extensions/GlobalWatchlist@master] Add support for EntitySchema pages in Global Watchlist
wbsearchentities (not wbgetsearchentities) isn’t really the right API for this, but there isn’t another API either – EntitySchema has very poor API support, as a result of our decision years ago to not base it on Wikibase. I guess it’s possible to implement GlobalWatchlist support this way, yes.
Alternatively, GlobalWatchlist could have some sort of hook or extensibility mechanism that allows an extension, such as EntitySchema, to customize it, and then it would be EntitySchema’s responsibility to figure out how to display the page title properly. (This would be fairly straightforward in PHP; but given that IIUC this all happens in JS, EntitySchema itself would still need some kind of API to access the labels. But at least it would be encapsulated within that extension.)
Thank you for the answer. Sorry for the typo. About API - I'm not going to create a bottleneck. What I'm building is, conceptually, E35<span class="entityschemawaiting" data-label="E35"></span> shown to the user and running a function to get the API data and add the span text asynchronously, after the GlobalWatchlist refresh is ready. All this with caching, as I already mentioned, allowing to show older results immediately and reducing the number of API calls as much as possible. @Tacsipacsi recommends against preferences usage, so I'm considering local storage.
About the delegation, if it will happen from the EntitySchema side, it will be great, but I can't order them do it, of course, so I can just implement in on this side and be ready to change later.
@Lucas_Werkmeister_WMDE, could you tell me, please, if the fact that Lexemes labels do not get language fallback is a bug or a feature? Thank you.
And btw, why wbsearchentities ignores all the language parameters? The call https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&search=E1&language=es&strictlanguage=1&type=entity-schema&formatversion=2, and another without the strictlanguage flag, return both the English results, while the Spanish do exist for this page.
Lexemes don’t have labels, they have lemmas. When displaying lexemes, all lemmas should be shown at once (example), so language fallback doesn’t really apply.
And btw, why wbsearchentities ignores all the language parameters? The call https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&search=E1&language=es&strictlanguage=1&type=entity-schema&formatversion=2, and another without the strictlanguage flag, return both the English results, while the Spanish do exist for this page.
language= controls the language of the search input, uselang= controls the language of the result output. You probably want to set both of them (language= doesn’t really matter if you’re searching for an entity ID, but it’s a required parameter so you can’t omit it either); strictlanguage= shouldn’t matter when searching for an entity ID.
So, it's a feature. Thanks a lot.
And btw, why wbsearchentities ignores all the language parameters? The call https://www.wikidata.org/w/api.php?action=wbsearchentities&format=json&search=E1&language=es&strictlanguage=1&type=entity-schema&formatversion=2, and another without the strictlanguage flag, return both the English results, while the Spanish do exist for this page.
language= controls the language of the search input, uselang= controls the language of the result output. You probably want to set both of them (language= doesn’t really matter if you’re searching for an entity ID, but it’s a required parameter so you can’t omit it either); strictlanguage= shouldn’t matter when searching for an entity ID.
I see. Great, I can fix it now. Thanks a lot for your help.