Page MenuHomePhabricator

Hovercards: Add `lang` and `dir` attributes to the `.mwe-popups-extract`
Closed, ResolvedPublic

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:11 AM
bzimport added a project: Page-Previews.
bzimport set Reference to bz66114.
bzimport added a subscriber: Unknown Object (MLST).

Change 142481 had a related patch set uploaded by Prtksxna:
Add lang and dir attributes to .mwe-popups-extract

https://gerrit.wikimedia.org/r/142481

Prtksxna updated the task description. (Show Details)
Prtksxna set Security to None.

Change 142481 had a related patch set uploaded (by Prtksxna):
Add 'lang' and 'dir' attributes to '.mwe-popups-extract'

https://gerrit.wikimedia.org/r/142481

Patch-For-Review

The patch has a -1 but fix should be super simple. @Prtksxna are you able to do that and if not should someone feel free to take it over?

Jdlrobson changed the task status from Open to Stalled.Oct 9 2015, 12:55 AM

Does someone want to take over this patch as requested on gerrit?

Jdlrobson changed the task status from Stalled to Open.Dec 17 2015, 8:26 PM

Change 142481 merged by jenkins-bot:
Add 'lang' and 'dir' attributes to '.mwe-popups-extract'

https://gerrit.wikimedia.org/r/142481

Can we use the current page's content language/direction for the popup instead of the one from the API? In which cases would that not work?

I am reopening the task because I want to switch the extension to use RESTBase and it currently doesn't return language details. It simple enough to add but I am want to find out why we need it before I request it.

Can we use the current page's content language/direction for the popup instead of the one from the API? In which cases would that not work?

In the MediaWiki namespace pages can have different languages. With $wgPageLanguageUseDB = true; every page can have an individual language.

For extracting the language code and the direction of the language from the current page see my comments on patch set 5: https://gerrit.wikimedia.org/r/#/c/142481/5/resources/ext.popups.core.js

Thanks @Fomafix! Do you know of any wikis (WMF or non-WMF) that use this extensively?

I've create a PR for RESTBase to add lang and dir properties to the summary endpoint response.

I've create a PR for RESTBase to add lang and dir properties to the summary endpoint response.

Thanks ! @GWicke was telling me (offline) that it should be easy to add, but we wanted some evidence of usage before cluttering the response.

@Prtksxna, this is now scheduled to be deployed tomorrow. Would the hovercards code temporarily tolerate responses without lang / dir attribute, or should we nuke the existing content?

@Prtksxna, this is now scheduled to be deployed tomorrow. Would the hovercards code temporarily tolerate responses without lang / dir attribute, or should we nuke the existing content?

Whoa! That was really quick. Hovercards hasn't even switched to the RESTBase response yet, and even when it does it should be fine if we don't get that content for a while. So, no need to nuke the existing content.

The changes are live in production. Here's an example: https://en.wikipedia.org/api/rest_v1/page/summary/Coca_Cola

However, we didn't drop all the data we've had in the storage, so now it will get updated to the new format gradually, as the articles are edited (also the response is cached for 1 hour, so update wouldn't be seen right away).