Page MenuHomePhabricator

Show labels to users in appropriate language
Closed, ResolvedPublic


When a user is viewing the SuggestedTags page in a non-English language (uselang=fr for example), the Wikidata labels displayed on each image in their stack should also be in that language.

Screen Shot 2019-10-15 at 1.14.48 PM.png (2×1 px, 1 MB)

Note: The LabelResolver class attempts to handle this by using language fallback chain handling provided by Wikidata, but this appears to need additional work.

Event Timeline

If you set the site content language to French, for example (by setting $wgLanguageCode = 'fr') in LocalSettings.php, the labels will be translated:

Screenshot from 2019-10-17 09-53-41.png (1×1 px, 776 KB)

Similarly, if the site content language is English but the user specifies a different language preference (e.g., Spanish) in user preferences, the labels will also be translated:

Screenshot from 2019-10-17 10-06-35.png (1×1 px, 779 KB)

I imagine that's how Commons actually works.

There's a distinction to be aware of here between the content language and the user interface language; see for discussion. The uselang parameter adjusts the user interface language, but the labels here are being treated (reasonably) as page content elements. That's why the labels aren't translated just by using the uselang parameter.

So I think this is working as intended, but I'll ping @Cparle and @matthiasmullie for comment before resolving this.

On the File page setting uselang changes the language of the labels.

see (click on the 'structured data' tab)

Yeah, that's why I assumed it would work the same way here.

I think that as a rule, we should treat Wikidata info a little differently than regular Wikitext content. For an article or a File description, it makes sense to leave the body text alone if the user specifies a different UI language in their URL params, since there is probably not an equivalent in their language.

However for Wikidata items we do have a more appropriate version readily available. I'd say we should generally change the language of all human-readable labels from Wikidata whenever we would change the user's interface language.

I agree that it should be consistent with existing mediainfo behavior. I'll dig in to what I need to tweak to pick up the UI lang.

Change 543930 had a related patch set uploaded (by MSantos; owner: MSantos):
[mediawiki/extensions/MachineVision@master] Show labels to users in appropriate language

Change 543930 merged by jenkins-bot:
[mediawiki/extensions/MachineVision@master] Show labels to users in appropriate language