Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wikidata fields showing non-local language data #5563

Closed
boothym opened this issue Dec 6, 2018 · 3 comments
Closed

Wikidata fields showing non-local language data #5563

boothym opened this issue Dec 6, 2018 · 3 comments
Labels
localization Adapting iD across languages, regions, and cultures

Comments

@boothym
Copy link
Contributor

boothym commented Dec 6, 2018

This city node is showing non-English information in the wikidata fields for my en-GB browsers (Firefox/Chrome):
capture
Seems to be coming from the Wu Chinese name and French description here: https://www.wikidata.org/wiki/Q182923

@bhousel bhousel added the localization Adapting iD across languages, regions, and cultures label Dec 6, 2018
@1ec5
Copy link
Collaborator

1ec5 commented Dec 6, 2018

Here’s the request I’d expect iD to make in this case; it shows “Stirling” and “city in Scotland” as expected.

I think the problem is that we’re passing the browser’s language directly into the MediaWiki API:

languages: lang,

The API expects lowercase language codes (en-gb), whereas browsers typically supply the region in uppercase (en-GB). An unrecognized language code results in all the languages being returned, and iD picks the first item in each object: Simplified Chinese for the label, French for the description.

Case aside, it’s possible for the browser to supply a language that Wikidata doesn’t support, or for the browser’s language code to contain some additional detail that doesn’t match Wikidata. (For example, WebKit on Apple platforms would probably use zh-Hant-TW instead of zh-tw.) We should supply all the browser’s languages via navigator.languages (plural) and also add a fallback for English, which is more likely to be understood than a combination of Chinese and French (or whatever happens to be present on the item).

@bhousel
Copy link
Member

bhousel commented Dec 6, 2018

Ah yeah @nyurik showed me how to fix this the other day.. The MediaWiki API lets us request a list of preferred locales and fallbacks.

@1ec5
Copy link
Collaborator

1ec5 commented Dec 6, 2018

#5543 would be another reason to supply fallback language codes in the API request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
localization Adapting iD across languages, regions, and cultures
Projects
None yet
Development

No branches or pull requests

3 participants