Page MenuHomePhabricator

Apply machine translation limits for sections translated on desktop
Closed, ResolvedPublic

Description

Content Translation uses a limit system to encourage users to review the initial machine translation.
When considering the support for a mode on desktop to edit a single section we want the calculation to be applied to that section (even if additional parts of the article are loaded behind the scenes (to support cross-section references, etc.).

This ticket proposes to apply the limit system to the section scope when the editor is in such mode.

Note that there are plans to evolve the limit system. Thus code reuse and other improvements that make it easier for the rules to evolve without issues could be considered.

Derived Requirement

When using the desktop Content Translation editor in single-section translation mode, the machine translation (MT) limits must apply only to the section being translated, regardless of any background content loaded to support features like cross-section references. This ensures accurate enforcement of review requirements per section and prevents false limit calculations due to content outside the translated scope.

Test Steps

Test Case 1: Ensure MT Limit Applies Only to Translated Section

  1. Open CX in desktop mode via Special:ContentTranslation.
  2. Choose a source and target language (e.g., English → Hindi).
  3. Select an article and opt to translate a single section (e.g., “Production”).
  4. Let MT autofill the entire section.
  5. Do not make any edits to the MT content.
  6. Attempt to publish the section.
  7. ✅❓❌⬜ AC1: A warning or block appears indicating the MT usage limit is exceeded for the current section.

Test Case 2: Verify Limit Adjusts After Editing MT Content

  1. In the same section, manually edit or rephrase some MT sentences (reduce unchanged MT content to below threshold).
  2. Attempt to publish again.
  3. ✅❓❌⬜ AC2: The warning is dismissed, and the section is allowed to be published if MT usage is below the threshold.

Test Case 3: Confirm No MT Limit Error When Translating Manually

  1. Start translating a section without using MT (manual translation).
  2. ✅❓❌⬜ AC3: Publishing is allowed without triggering MT limit messages.

QA Results - TestWiki

ACStatusDetails
1T317021#10959753
2T317021#10959753
3T317021#10959753

Event Timeline

Pginer-WMF triaged this task as Medium priority.

Friendly reminder to review the "subscribers" list when creating sub-tasks. Thanks,

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

[mediawiki/extensions/ContentTranslation@master] CX desktop editor: Check MT abuse before section publishing

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

Change #1124721 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX desktop editor: Check MT abuse before section publishing

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

@ngkountas Confirmed desktop Content Translation editor in single-section translation mode, the machine translation (MT) limits must apply only to the section being translated, as seen in the gifs below. I will move this to Sign-off. Thanks for all your work!

Test Result - TestWiki

Status: ✅ PASS
Environment:TestWiki
OS: macOS Sequoia 15.5
Browser: Chrome 137
Device: MBA
Emulated Device: NA

Test Artifact(s): Screenshots or console logs showing MT limit indicators per section

Test Steps

Test Case 1: Ensure MT Limit Applies Only to Translated Section

  1. Open CX in desktop mode via Special:ContentTranslation.
  2. Choose a source and target language (e.g., English → Spanish).
  3. Select an article and opt to translate a single section (e.g., “Production”).
  4. Let MT autofill the entire section.
  5. Do not make any edits to the MT content.
  6. Attempt to publish the section.
  7. AC1: A warning or block appears indicating the MT usage limit is exceeded for the current section.

2025-06-30_08-51-56.mp4.gif (1×1 px, 3 MB)

Test Case 2: Verify Limit Adjusts After Editing MT Content

  1. In the same section, manually edit or rephrase some MT sentences (reduce unchanged MT content to below threshold).
  2. Attempt to publish again.
  3. AC2: The warning is dismissed, and the section is allowed to be published if MT usage is below the threshold.

2025-06-30_09-04-40.mp4.gif (1×1 px, 2 MB)

Test Case 3: Confirm No MT Limit Error When Translating Manually

  1. Start translating a section without using MT (manual translation).
  2. AC3: Publishing is allowed without triggering MT limit messages.

2025-06-30_09-08-48.mp4.gif (1×1 px, 912 KB)

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