Page MenuHomePhabricator

Use proper variant in ParsoidLocalization on messages localized into the page language
Open, Needs TriagePublic

Description

Generally speaking, messages in MediaWiki are localized directly into a target variant, and don't have LanguageConverter run on them. However, ParsoidLocalization supports localization into an arbitrary language, as well as into the page "content language".

These should be adjusted to account for the user's selected variant. For example, if the arbitrary language is zh or the page content language is zh and the user's preferred variant is zh-tw, then we should localize into zh-tw, not zh. (We still shouldn't try to run LanguageConverter on the contents of the messages!)

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

In my local testing with the new parsoid languageconverter implementation it seems like we might be double-converting messages: we don't actually have any localizations for en-x-piglatin, so when we ask for those we get the 'en' fallback, but then we parse that message with the *legacy* parser, and the user language variant is still in the RequestContext so we end up running the message through LanguageConverter. If the message was already present in the variant, we would have converted it twice. Converters *try* to be idempotent, so this might not immediately be noticible, but the pig latin converter is *not* idempotent so it should be pretty obvious.

Moving the language variant into the parser options will help some, as it will force the legacy converter not to look into the request context for language conversion. We could/should also specify the 'disable language conversion' flag when messages are parsed.

Change #1236396 had a related patch set uploaded (by C. Scott Ananian; author: C. Scott Ananian):

[mediawiki/core@master] WIP: Disable content conversion when parsing interface messages

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