Page MenuHomePhabricator

Provide option to select the lead section in the pick a section step
Closed, ResolvedPublic8 Estimated Story Points

Description

The "pick a section" step allows to select the section you want to translate from an article. Although the emphasis is on sections missing, it is also possible to select sections that are already present in the translated article (to expand their contents or replace them). However, this is not possible for the lead section.

This ticket proposes to include the option to select the lead section as part of the "Section present in <language-name>". The section will be listed as:

  • "(Top)" as title, to make it consistent with the New Vector term used in the table of contents.
  • An excerpt of the initial text of the page in the target language is used as description (only one line of text, cropped with ellipsis). This intended to clarify what this special section is really about by exemplifying it since the terms to refer to the lead section may not be widely known.

bn.m.wikipedia.org_w_index.php_title=Special_ContentTranslation&from=en&page=Moon&sx=true&to=bn(iPhone SE).png (667×375 px, 65 KB)

Although most of the time articles in both languages will have the lead section, the system should be able to handle the case where the source language has a lead section but the article in the target language does not have one (e.g., only consist of sections). In such case, the lead section option will appear in the "Section missing in <language-name>" and will include a description with an excerpt from the source article instead.


Derived Requirement

The "pick a section" step of the Content Translation workflow must allow users to select the lead section. The lead section should be represented consistently and appear in the appropriate list:

  • If the target article already contains a lead section, it must appear under "Section present in <language-name>" with:
    • Title set to '(Top)'
    • A one-line excerpt from the target article’s lead section as the description, cropped with ellipsis if needed
  • If the target article does not contain a lead section but the source article does, the lead section must appear under "Section missing in <language-name>" with:
    • Title set to '(Top)'
    • A one-line excerpt from the source article’s lead section as the description, cropped with ellipsis if needed

The lead section must always be selectable like any other section.

Test Steps

Test Case 1: Display Lead Section Under “Section present in <language-name>”

  1. Open Content Translation on desktop and proceed to the "pick a section" step for an article where the target language article already has a lead section.
  2. Observe the list under "Section present in <language-name>".
  3. ✅❓❌⬜ AC1: Confirm that the lead section appears with the title '(Top)' and a one-line excerpt from the target article’s lead section.

Test Case 2: Display Lead Section Under “Section missing in <language-name>”

  1. Open Content Translation on desktop and proceed to the "pick a section" step for an article where the target article does not have a lead section but the source article does.
  2. Observe the list under "Section missing in <language-name>".
  3. ✅❓❌⬜ AC2: Confirm that the lead section appears with the title '(Top)' and a one-line excerpt from the source article’s lead section.

Test Case 3: Verify Lead Section Is Selectable

  1. Open the "pick a section" step for an article under either scenario (lead section present or missing).
  2. Click on the entry titled '(Top)'.
  3. ✅❓❌⬜ AC3: Confirm that the lead section can be selected like any other section.

QA Results - TestWiki

ACStatusDetails
1T345845#11406605
2T345845#11406605
3T345845#11406605

Event Timeline

@Pginer-WMF I do not believe that this task should have T353244: Resolve key regressions preventing the unified dashboard to replace the desktop one as parent task, since this is a new feature and not a regression fix.

@Pginer-WMF I do not believe that this task should have T353244: Resolve key regressions preventing the unified dashboard to replace the desktop one as parent task, since this is a new feature and not a regression fix.

Good point. However I still think it makes sense here. With the current desktop version it is possible to publish an initial version of the translation for a new article (e.g., just the lead section) and then continue translating it further later (using the pencil icon from the "published" view).

With the new dashboard, what we provide by default is the possibility of extending the existing article with new sections. So from the user perspective they won't be able to translate further the lead section of a new article, while it was possible before.

So here the regression is in terms of not being able to support a certain behaviour. Even if the way we propose to support it involves replacing an old feature with a new one, the purpose is to still support this behaviour (avoid breaking backwards compatibility).

ngkountas changed the task status from Open to In Progress.Oct 15 2025, 8:24 AM
ngkountas claimed this task.
ngkountas moved this task from Prioritized to In-progress on the LPL Hypothesis board.
ngkountas set the point value for this task to 8.Oct 23 2025, 8:26 AM

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

[mediawiki/extensions/ContentTranslation@master] Add useSectionPresenceStatus composable

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

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

[mediawiki/extensions/ContentTranslation@master] Add useTitleForPublishing composable

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

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

[mediawiki/extensions/ContentTranslation@master] CX: Support publishing of present lead section in "cxpublishsection" API

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

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

[mediawiki/extensions/ContentTranslation@master] CX: Revise confirmer messages for existing lead section support

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

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

[mediawiki/extensions/ContentTranslation@master] CX: Add support for translating existing lead section on mobile

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

Change #1198942 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Add useSectionPresenceStatus composable

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

Change #1198943 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Add useTitleForPublishing composable

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

Change #1198944 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Support publishing of present lead section in "cxpublishsection" API

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

Change #1198945 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Revise confirmer messages for existing lead section support

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

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

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

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

Change #1201184 merged by jenkins-bot:

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

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

Change #1198973 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Add support for translating existing lead section on mobile

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

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 Please review AC2, thanks!

Test Result - Test Wiki

Status: ✅ PASS
Environment: Test Wiki
OS: macOS Tahoe 26.1
Browser: Chrome 142
Device: MBA
Emulated Device: NA

Test Artifact(s):

Test Steps

Test Case 1: Display Lead Section Under “Section present in <language-name>”

  1. Open Content Translation on desktop and proceed to the "pick a section" step for an article where the target language article already has a lead section.
  2. Observe the list under "Section present in <language-name>".
  3. AC1: Confirm that the lead section appears with the title '(Top)' and a one-line excerpt from the target article’s lead section.

Test Case 2: Display Lead Section Under “Section missing in <language-name>”

  1. Open Content Translation on desktop and proceed to the "pick a section" step for an article where the target article does not have a lead section but the source article does.
  2. Observe the list under "Section missing in <language-name>".
  3. AC2: Confirm that the lead section appears with the title '(Top)' and a one-line excerpt from the source article’s lead section.

UPDATE: T345845#11407054
Do you know of any articles where the target language with an empty lead section and appears in the section missing?

Test Case 3: Verify Lead Section Is Selectable

  1. Open the "pick a section" step for an article under either scenario (lead section present or missing).
  2. Click on the entry titled '(Top)'.
  3. AC3: Confirm that the lead section can be selected like any other section.

See AC1

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

@GMikesell-WMF it is my understanding that the lead section is always supposed to be there, and this is the reason why even the parse endpoint doesn't return it in the tocdata response (e.g. https://en.wikipedia.org/w/api.php?action=parse&format=json&formatversion=2&prop=tocdata&page=Moon). So, I believe that the lead section can be empty, but not "missing", and it's never expected to be in the missing sections list.

Handling empty lead sections is something that we could support but I believe that this is a corner case, that we may never need to address. Even if we need to, that can be done as part of some other task.

@GMikesell-WMF it is my understanding that the lead section is always supposed to be there, and this is the reason why even the parse endpoint doesn't return it in the tocdata response (e.g. https://en.wikipedia.org/w/api.php?action=parse&format=json&formatversion=2&prop=tocdata&page=Moon). So, I believe that the lead section can be empty, but not "missing", and it's never expected to be in the missing sections list.

Handling empty lead sections is something that we could support but I believe that this is a corner case, that we may never need to address. Even if we need to, that can be done as part of some other task.

Thanks for the explanation. If we do have an empty lead section, as you said, this can be handled in another task. I will mark this as Sign-off. Thanks for all your work!

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 lead section label is showing the raw message key cx-sx-present-lead-section-label instead of "(Top)" when translating from English to Hindi. See attached screenshot. This appears to be an i18n issue where the message is not being resolved for Hindi locale. |

Screenshot 2025-12-08 at 10.54.14 AM.png (917×1 px, 119 KB)

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

[mediawiki/extensions/ContentTranslation@master] CX: Include "cx-sx-present-lead-section-label" in mx.cx3 module messages

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

We have placed a fix for label issue hence moving it to product signoff task

Change #1217166 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Include "cx-sx-present-lead-section-label" in mx.cx3 module messages

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