Page MenuHomePhabricator

Section Translation: Support expanding the existing section if it already exists
Open, In Progress, MediumPublic8 Estimated Story Points

Assigned To
Authored By
ngkountas
Mar 11 2025, 8:56 AM

Description

Description of the issue

Currently, when a user selects an existing section to translate, they are given two options -inside the "Compare contents" step:

  • Expand the existing section with the newly translated content (default option).
  • Publish the newly translated section as a new, independent section.

However, due to a bug, the system always publishes the translated section as a new, independent section, regardless of the user's selection. This inconsistency can confuse users who expected their translation to be merged with the existing section.

Additionally, this limitation prevents proper support for translating the lead section, since expanding an existing section is not functioning as intended.

Expected Behavior

If the user selects the expand option (default), the newly translated content should be appended to the existing section instead of creating a new one.
If the user selects the publish as a new section option, it should behave as it currently does.

Screeshots of the two options in "Compare contents" step:

Expand the existing section with the newly translated content

Screenshot 2025-03-11 at 11.01.47.png (961×1 px, 196 KB)

Publish the newly translated section as a new, independent section

Screenshot 2025-03-11 at 11.01.53.png (961×1 px, 196 KB)


Derived Requirement

Ensure that the Section Translation feature properly supports the Expand existing section functionality in the “Compare contents” step.
When users select Expand the existing section with the newly translated content (default option), the translated content should be appended to the corresponding existing section instead of publishing as a new, independent section.
If the user selects Publish the newly translated section as a new, independent section, the system should behave as it currently does and create a separate section.
This functionality should also enable proper support for translating and expanding the lead section.

Test Steps

Test Case 1: Verify translated content is appended to an existing section

  1. Open the Section Translation tool on Test wiki.
  2. Select an article that has an existing section (e.g., “Life and Career”).
  3. In the “Compare contents” step, choose Expand the existing section with the newly translated content (default option).
  4. Complete the translation and publish it.
  5. ✅❓❌⬜ AC1: Confirm that the translated content is appended to the existing “History” section instead of being published as a new one.

Test Case 2: Verify translated content publishes as a new section when that option is selected

  1. Open the Section Translation tool.
  2. Select the same or another article with an existing section.
  3. In the “Compare contents” step, choose Publish the newly translated section as a new, independent section.
  4. Publish the translation.
  5. ✅❓❌⬜ AC2: Confirm that the system creates a new section and does not merge content with the existing section.

QA Results - TestWiki

ACStatusDetails
1T388503#11396876
2T388503#11396876

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change #1136409 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Add "useExistingSectionPublishOption" composable

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

Change #1139523 had a related patch set uploaded (by Eamedina; author: Eamedina):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250428

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

Change #1139523 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250428

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

PWaigi-WMF changed the task status from Open to In Progress.May 26 2025, 2:14 PM
PWaigi-WMF moved this task from In-progress to Prioritized on the LPL Hypothesis board.

Change #1155664 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX section publishing: Add support for expanding existing section

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

Change #1155691 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX publishing section: Add existing section title to payload if exists

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

If the user selects the expand option (default), the newly translated content should be appended to the existing section instead of creating a new one.

Just want to validate, maybe with @Pginer-WMF, that this is really what we want. Appending a new translation of a section after the version of the section that was already there looks unlikely to result in a good edit if the user doesn't have to ability to deduplicate or "blend it" the new content with the existing content.

For cases where sections already exist, the idea was to let user control how contents were combined at the time of publishing.
From T252542, the options proposed were:

Publish as a new section
Add a new section to the article.

Add contents to existing section
Expand the existing section preserving their contents.

Replace existing section
Delete the existing section, adding your translation instead.

Publish to your Sandbox
Publish in your personal space for you to review and copy them elsewhere.

Publish - Conflicts.png (768×1 px, 184 KB)

If the user selects the expand option (default), the newly translated content should be appended to the existing section instead of creating a new one.

Just want to validate, maybe with @Pginer-WMF, that this is really what we want. Appending a new translation of a section after the version of the section that was already there looks unlikely to result in a good edit if the user doesn't have to ability to deduplicate or "blend it" the new content with the existing content.

As mentioned above, we should provide users with the alternatives for them to choose what is appropriate for each case. If we are not providing the option to replace the existing contents users may need to remove the old contents, but that may be easier than the actions required when a separate section is created.

Should this task include adding the "Add content to existing section" option in the Publish options dialog?

Should this task include adding the "Add content to existing section" option in the Publish options dialog?

We can think about the option in the "Compare contents" step as a way to adjust the publishing options. If we provide an option at an early step, it would be nice for users to have a chance to adjust it before publishing.

Change #1155664 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX section publishing: Add support for expanding existing section

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

Change #1155691 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX section publishing: Add existing section title to payload if exists

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

Change #1166771 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX: Add usePublishTarget composable

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

Change #1166887 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250707

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

Change #1166887 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250707

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

Change #1167584 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] SXPublisher: Properly support "expand" publishing target

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

Change #1166771 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Introduce usePublishTarget composable

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

Change #1170411 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250717

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

Change #1170412 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/ContentTranslation@wmf/1.45.0-wmf.10] CX3 Build 1.0.0+20250717

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

Change #1170411 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250717

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

Change #1170412 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@wmf/1.45.0-wmf.10] CX3 Build 1.0.0+20250717

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

Mentioned in SAL (#wikimedia-operations) [2025-07-17T20:09:08Z] <sbisson@deploy1003> Started scap sync-world: Backport for [[gerrit:1170412|CX3 Build 1.0.0+20250717 (T388503 T395417 T395418)]]

Mentioned in SAL (#wikimedia-operations) [2025-07-17T20:20:18Z] <sbisson@deploy1003> Finished scap sync-world: Backport for [[gerrit:1170412|CX3 Build 1.0.0+20250717 (T388503 T395417 T395418)]] (duration: 11m 10s)

Change #1167584 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SXPublisher: Properly support "expand" publishing target

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

Change #1171255 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250721

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

Change #1171255 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20250721

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

Nikerabbit set the point value for this task to 4.Sep 4 2025, 10:32 AM
ngkountas changed the point value for this task from 4 to 8.Sep 4 2025, 12:21 PM

@ngkountas Can you review videos below? Some of the stuff feels off.

Test Result - Test Wiki

Status: ❓Need More Info / ❌ FAIL
Environment: Test Wiki
OS: macOS Sequoia 15.5
Browser: Chrome 138
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://test.wikipedia.org/w/index.php?title=Special:ContentTranslation&filter-type=topic&filter-id=music&active-list=suggestions&from=en&to=es&page=Malcolm%20Forsyth&section=Life%20and%20career#/sx/section-selector

Test Steps

Test Case 1: Verify translated content is appended to an existing section

  1. Open the Section Translation tool on Test wiki.
  2. Select an article that has an existing section (e.g., “Life and Career”).
  3. In the “Compare contents” step, choose Expand the existing section with the newly translated content (default option).
  4. Complete the translation and publish it.
  5. AC1: Confirm that the translated content is appended to the existing “History” section instead of being published as a new one.

It published a new section. Since the section is present in Español, shouldn't it have just updated Biografía?

Manually Translated the Section Title

Test Case 2: Verify translated content publishes as a new section when that option is selected

  1. Open the Section Translation tool.
  2. Select the same or another article with an existing section.
  3. In the “Compare contents” step, choose Publish the newly translated section as a new, independent section.
  4. Publish the translation.
  5. AC2: Confirm that the system creates a new section and does not merge content with the existing section.

Feels buggy. Do you know why it took me a few times to refresh to finally get published? It's usually not that slow. It did create a new section though.

Change #1202069 had a related patch set uploaded (by Nik Gkountas; author: Nik Gkountas):

[mediawiki/extensions/ContentTranslation@master] CX: Add "targetsection" URL parameter when redirecting to desktop editor

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

Change #1202069 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Add "targetsection" URL parameter when redirecting to desktop editor

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

Change #1203534 had a related patch set uploaded (by Sbisson; author: Sbisson):

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20251110

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

Change #1203534 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX3 Build 1.0.0+20251110

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

@ngkountas Existing section instead of creating a new one and publishing a new section is working as designed, as seen in the videos below. I will move this to Sign-off. Thanks for all your work!

Test Result - Test Wiki

Status: ✅ PASS
Environment: Test Wiki
OS: macOS Sequoia 15.5
Browser: Chrome 138
Device: MBA
Emulated Device: NA

Test Artifact(s):

https://test.wikipedia.org/w/index.php?title=Special:ContentTranslation&filter-type=topic&filter-id=music&active-list=suggestions&from=en&to=es&page=Malcolm%20Forsyth&section=Life%20and%20career#/sx/section-selector

Test Steps

Test Case 1: Verify translated content is appended to an existing section

  1. Open the Section Translation tool on Test wiki.
  2. Select an article that has an existing section (e.g., “Life and Career”).
  3. In the “Compare contents” step, choose Expand the existing section with the newly translated content (default option).
  4. Complete the translation and publish it.
  5. AC1: Confirm that the translated content is appended to the existing “Biografia” section instead of being published as a new one.

Test Case 2: Verify translated content publishes as a new section when that option is selected

  1. Open the Section Translation tool.
  2. Select the same or another article with an existing section.
  3. In the “Compare contents” step, choose Publish the newly translated section as a new, independent section.
  4. Publish the translation.
  5. AC2: Confirm that the system creates a new section and does not merge content with the existing section.

GMikesell-WMF updated the task description. (Show Details)
GMikesell-WMF moved this task from Needs QA to Design Signoff on the LPL Hypothesis board.

The general functionality seems to be working as intended. A couple of observations as I was testing are captured below:

The list of present sections shows the message "cx-sx-present-lead-section-label" for the lead sectionThe preview step shows two translate buttons (using 752px wide "vertical tablet" style viewport).
bn.wikipedia.org_w_index.php_title=%E0%A6%AC%E0%A6%BF%E0%A6%B6%E0%A7%87%E0%A6%B7_%E0%A6%AC%E0%A6%BF%E0%A6%B7%E0%A6%AF%E0%A6%BC%E0%A6%AC%E0%A6%B8%E0%A7%8D%E0%A6%A4%E0%A7%81_%E0%A6%85%E0%A6%A8%E0%A7%81%E0%A6%AC%E0%A6%BE%E0%A6%A6&active-li (1).png (1×768 px, 117 KB)
bn.wikipedia.org_w_index.php_title=%E0%A6%AC%E0%A6%BF%E0%A6%B6%E0%A7%87%E0%A6%B7_%E0%A6%AC%E0%A6%BF%E0%A6%B7%E0%A6%AF%E0%A6%BC%E0%A6%AC%E0%A6%B8%E0%A7%8D%E0%A6%A4%E0%A7%81_%E0%A6%85%E0%A6%A8%E0%A7%81%E0%A6%AC%E0%A6%BE%E0%A6%A6&active-list=s.png (1×768 px, 241 KB)

The missing message is now fixed :)

The second issue mentioned in Pau's comment is not related to this task, and is now tracked in T413258.