Page MenuHomePhabricator

Live preview should respect user's language variant setting
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Go to zhwiki, and select zh-cn your language and zh-tw as your variant
  • Preview this page with normal and live preview

What happens?:
It should be "Current variant: zh-tw". With normal preview, nothing goes wrong.
However, with live preview, it's displayed as "Current variant: zh-cn".

Event Timeline

Aklapper renamed this task from Live preview should respect user variant to Live preview should respect user's language variant setting.Jun 9 2021, 6:00 AM
MusikAnimal set the point value for this task to 8.Sep 23 2021, 5:46 PM

Change 732618 had a related patch set uploaded (by Samwilson; author: Samwilson):

[mediawiki/core@master] Send 'variant' API param for live preview

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

Confirm that bug exists as described on zhwikipedia.

Replicate it locally with the following configuration:

  • LocalSettings.php: $wgLanguageCode = 'en'; and $wgUsePigLatinVariant = true;
  • Preferences: langauage set to en and the variant to en-x-piglatin
  • Test page contents: -{ en:this is en; en-x-piglatin:this is piglatin }-

It does seem like the exact issue here can be solved quite simply, with the addition of the variant API parameter to the live preview call — but the real issue is as @Fomafix points point above, that that parameter is not yet fit for use.

I guess we either stall this task until T117549 is resolved, or fix this by using the variant param as-s and dealing with having errors (which maybe isn't totally silly, because would those errors be worse than the status quo? the wrong variant is going to be used sometimes anyway… no no, it is a bit silly… ignore me…).

According to my investigation (T294848), we should be able to just use the "variant" parameter here. The status quo is that the caching bug only happens for logged-out users' requests, while live preview can only be used by logged-in users.

ldelench_wmf changed the point value for this task from 8 to 3.Nov 3 2021, 2:45 PM

Change 732618 merged by jenkins-bot:

[mediawiki/core@master] Send 'variant' API param for live preview

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

dom_walden subscribed.

I can no longer reproduce the bug in the description. LivePreview correctly returns the user's language variant as zh-tw.

language_variant.png (402×1 px, 75 KB)

(The user's language settings can be set in Special:Preferences, as shown on the left in the above image, e.g. https://en.wikipedia.org/wiki/Special:Preferences)

As well as setting your language variant via Special:Preferences, you can also set your language variant with two URL parameters:

(If I enter a variant or uselang parameter which is not a legitimate language variant, it defaults to whatever my user settings are in Special:Preferences)

They way this works is by sending a variant parameter to the Parse API. Not all wikis support language variants (for example, enwiki). On those wikis no variant parameter is sent.

The variant parameter is relatively new. I could not find much documentation on it (it is not listed here). Being new, I guess there might be bugs. I don't know it well enough to say one way or another.

Test environment: https://zh.wikipedia.beta.wmflabs.org MediaWiki 1.38.0-alpha (4c5102c) 09:42, 9 December 2021.

I can no longer reproduce the bug in the description.

@dom_walden The patch has been merged and deployed to that site. To reproduce this bug, you should try at https://zh.wikipedia.org, which still uses an old version of MediaWiki yet.

The variant parameter is relatively new. I could not find much documentation on it (it is not listed here). Being new, I guess there might be bugs. I don't know it well enough to say one way or another.

You're right--please see T117549 for more details.

In T284625#7559208, @Tranve wrote:

@dom_walden The patch has been merged and deployed to that site. To reproduce this bug, you should try at https://zh.wikipedia.org, which still uses an old version of MediaWiki yet.

Thanks. When I said

I can no longer reproduce the bug in the description.

I meant that as a good thing :) I was testing that I could no longer reproduce that bug.

In T284625#7559208, @Tranve wrote:

@dom_walden The patch has been merged and deployed to that site. To reproduce this bug, you should try at https://zh.wikipedia.org, which still uses an old version of MediaWiki yet.

Thanks. When I said

I can no longer reproduce the bug in the description.

I meant that as a good thing :) I was testing that I could no longer reproduce that bug.

Ah... Thank you for pointing that out :)