Page MenuHomePhabricator

Show the messages in target language
Closed, ResolvedPublic

Description

A tricky problem with the ExternalGuidance machine translation context is, the UI messages should be ideally in the target language of translation.

For example, if the user is seeing a page translated from English to Hindi, the guidance messages we show should be in Hindi. But since the content is rendered in English wiki(source language), our i18n setup will use English messages.

There should be a way to get the messages in target language from backend, ideally without overheads, since rendering them is very time sensitive

Event Timeline

santhosh created this task.Jan 17 2019, 7:07 AM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJan 17 2019, 7:07 AM
santhosh claimed this task.Jan 18 2019, 5:25 AM
santhosh triaged this task as Normal priority.
santhosh moved this task from Backlog to In Progress on the ExternalGuidance board.

There are multiple way to solve this. A special resource loader module or a new API are options. But it comes with the cost of extra fetches from server apart from RL module.

I found a way to trick the RL module fetcher to fetch the module and messages for the target language in the context. Just change the wgUserLanguage before calling mw.loader.using and reset just after the module is fetched.

It works. One issue is the hacky part of modifying wgUserLanguage for moments, but I think the purpose of the extension justify it.

Change 485144 had a related patch set uploaded (by Santhosh; owner: Santhosh):
[mediawiki/extensions/ExternalGuidance@master] Show the messages in target language of MT context

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

Change 485144 merged by jenkins-bot:
[mediawiki/extensions/ExternalGuidance@master] Show the messages in target language of MT context

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

santhosh moved this task from In Review to Done on the ExternalGuidance board.Jan 18 2019, 11:33 AM
Pginer-WMF closed this task as Resolved.Jan 21 2019, 12:14 PM
Pginer-WMF added a subscriber: Pginer-WMF.

For the UI messages with a translation available, those are properly shown in both the external translation service and the special page that provides guidance on how to contribute.