Page MenuHomePhabricator

Edit previews do not render with correct variant when using new Parsoid LanguageConverter implementation
Closed, ResolvedPublic

Description

We don't set the ParserOptions correctly in the preview paths -- the same code we use in the Article path should be used in preview as well.

Things to test:

  • "Preview your changes" dialog in VisualEditor
  • The "reload after save" in VisualEditor (uses action=parse)
  • The "traditional" edit preview page
  • others?

Event Timeline

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

[mediawiki/extensions/ParserMigration@master] Ensure that new articles are previewed with the correct parser

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

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

[mediawiki/core@master] Ensure that new articles are previewed with the correct parser

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

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

[mediawiki/extensions/VisualEditor@master] Ensure parse-after-edit and previews match user settings

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

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

[mediawiki/core@master] Move language variant parser option setting from Article to WikiPage

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

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

[mediawiki/core@master] Skin::editUrlOptions: pass `uselang` and `variant` in the edit links

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

What specifically should I be testing? Can you expand the test steps?

Change #1272839 merged by jenkins-bot:

[mediawiki/core@master] Move language variant parser option setting from Article to WikiPage

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

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

[mediawiki/core@wmf/1.46.0-wmf.24] Move language variant parser option setting from Article to WikiPage

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

Here's my recommended test set up:

First, set up your test wiki with a language that uses language variants. I recommend:

$wgLanguageCode = 'en';
$wgUsePigLatinVariant = true;

but you could also set your local wiki language to sr or zh, etc.

Then perform the following tests. I recommend using all three (?) available editors, whether you want to do that by uninstalling/installing VisualEditor or via user preferences is up to you. It is worth testing that the following works both with Parsoid as your default parser and with the legacy parser.

  1. Go to an non-existing page on your wiki, eg [[Non Existing Page]]. Select a language variant in the drop down (eg Igpay Atinlay). Then click on 'Create' and/or 'Create source'. Type some text with language converter markup, eg:
-{raw text} Pig Latin -{N|sr-ec}-

Click 'show preview'. The preview *should* appear as: raw text Igpay Atinlay српски (ћирилица) (ie, rendered in the selected variant). If you then save the page it /should/ also display in your selected variant.

image.png (491×512 px, 73 KB)

  1. Open an existing page. Select a non-default variant. As before, edit the page and confirm that the previews are in the proper variant, and then save the page and confirm that the page is in the proper variant (and that the drop down dialog matches the selected variant).
  1. For bonus credit, do all of the above but with ?uselang=es (or some other language) on the URL command line. The user interface language should remain consistently Spanish throughout the edit, preview, and display-after-edit.

(you'll probably need Ensure parse-after-edit and previews match user settings (1272835) for all the steps to work properly with Visual Editor.)

Change #1272875 merged by jenkins-bot:

[mediawiki/core@wmf/1.46.0-wmf.24] Move language variant parser option setting from Article to WikiPage

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

Mentioned in SAL (#wikimedia-operations) [2026-04-16T21:58:32Z] <cscott@deploy1003> Started scap sync-world: Backport for [[gerrit:1272908|ConverterRule: convert null to false when needed (T423639)]], [[gerrit:1272771|Convert language to internal code in tests]], [[gerrit:1272750|ParsoidCachePrewarmJob: Define the title in the req context (T422780)]], [[gerrit:1272875|Move language variant parser option setting from Article to WikiPage (T423534)]]

Mentioned in SAL (#wikimedia-operations) [2026-04-16T22:00:12Z] <cscott@deploy1003> cscott: Backport for [[gerrit:1272908|ConverterRule: convert null to false when needed (T423639)]], [[gerrit:1272771|Convert language to internal code in tests]], [[gerrit:1272750|ParsoidCachePrewarmJob: Define the title in the req context (T422780)]], [[gerrit:1272875|Move language variant parser option setting from Article to WikiPage (T423534)]] synced to the testservers (see https://wikitech

Mentioned in SAL (#wikimedia-operations) [2026-04-16T22:08:13Z] <cscott@deploy1003> Finished scap sync-world: Backport for [[gerrit:1272908|ConverterRule: convert null to false when needed (T423639)]], [[gerrit:1272771|Convert language to internal code in tests]], [[gerrit:1272750|ParsoidCachePrewarmJob: Define the title in the req context (T422780)]], [[gerrit:1272875|Move language variant parser option setting from Article to WikiPage (T423534)]] (duration: 09m 41s)

Change #1272801 abandoned by C. Scott Ananian:

[mediawiki/extensions/ParserMigration@master] Ensure that new articles are previewed with the correct parser

Reason:

Abandoned in favor of I45700c0b52679406a11c92a0e69f00533c934fd3

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

Change #1272805 merged by jenkins-bot:

[mediawiki/core@master] Ensure that new articles are previewed with the correct parser

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

Change #1272840 merged by jenkins-bot:

[mediawiki/core@master] Skin::editUrlOptions: pass `uselang` and `variant` in the edit links

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

Change #1272835 merged by jenkins-bot:

[mediawiki/extensions/VisualEditor@master] Ensure parse-after-edit and previews match user settings

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

@Diskdance's Variant Ally currently does some of the query parameter patching on zhwiki. I suspect it may need adaptations.

Created https://github.com/wikimedia-gadgets/VariantAlly/issues/17 to track the issues with Variant Ally (if there are any).