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 triaged this task as Medium 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

Pginer-WMF subscribed.

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.