Page MenuHomePhabricator

"Language not recognized" error on adding urls with openGraph metadata
Closed, ResolvedPublic8 Estimated Story Points

Description

I get a "langue non reconnue : en_US" error message when adding a source like this one to a page on the French Wikipedia.
Also, in the preview after clicking on Trouver, a left-click on the title of the article does nothing.
After clicking Insérer, all I see in the citation inserter is the error message, and the left guillemets. Clicking on the guillemets prompts me to leave the page and go to the article one.
Win8, FF 36.0.1.

Event Timeline

Elitre raised the priority of this task from to Needs Triage.
Elitre updated the task description. (Show Details)
Elitre added a project: Citoid.
Elitre subscribed.
Mvolz triaged this task as Unbreak Now! priority.Mar 20 2015, 11:02 AM
Mvolz set Security to None.
Mvolz subscribed.

Okay, so what is happening here is Zotero has told us that the language is en_US, because zotero is incredibly inconsistent with using valid language codes. So the citation module has told us that the language code isn't valid.

A temp fix would simply to be to remove the language definition in the template data so the user experience is better until we force zotero to be more consistent.

Mvolz renamed this task from "Language not recognized" error to Validate language field in zotero output.Mar 20 2015, 11:11 AM

@Elitre, do you think that's a good fix until we can do this backend? It might take a little longer.

So, whoops, this was actually us, and not Zotero (although I have actually encountered this before with Zotero- like us, they're just scraping what is in the page and hoping it turns out okay and not validating anything). Open graph metadata doesn't use valid language codes, they use these: https://developers.facebook.com/docs/internationalization#locales

So in addition to validating the Zotero output, we need to write a conversion function in translators/openGraph.js for language codes.

Mvolz lowered the priority of this task from Unbreak Now! to High.Mar 22 2015, 11:21 AM
Mvolz renamed this task from Validate language field in zotero output to "Language not recognized" error on adding urls with openGraph metadata.Mar 22 2015, 2:34 PM

Change 198556 had a related patch set uploaded (by Mvolz):
Don't add openGraph 'locale' to language field

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

Change 198491 had a related patch set uploaded (by Mvolz):
[WIP] Validate language codes in mediawiki format

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

Change 198556 merged by jenkins-bot:
Don't add openGraph 'locale' to language field

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

Change 198491 merged by Mobrovac:
Validate language codes in mediawiki format

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

I would think really hard about how you can preserve as much information as possible, taking into account keeping stuff working with the external services of course.

Also for Zotero, I'd say they would be foolish to limit themselves to 2 letter language codes (ISO-639-2 and 639-3 matter), and that they should take note of the Bcp47 (https://tools.ietf.org/html/bcp47) efforts at Mozilla. Design for the future, not for the past.

@TheDJ - feel free to comment that directly on the thread and or on zotero-dev; https://forums.zotero.org/discussion/47726 (aurimas and adamsmith are both zotero devs; not sure what stage they are with deploying that bit but I'm sure it's probably still open for discussion).

Change 237713 had a related patch set uploaded (by Mvolz):
[WIP] Finish openGraph definitions

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

Change 237713 merged by Mobrovac:
Finish openGraph definitions

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