Page MenuHomePhabricator

Invite to translate a section recently edited in another language
Closed, ResolvedPublic1 Estimated Story Points

Description

Research shows that editors find it easy to make a recent contribution they made into another language they speak. This ticket proposes to surface this kind of opportunity. For example, a user making a contribution to a section in English will get an invite to translate that section to Bengali when visiting the Bengali version (if such section is missing).

expand-edited2 copy 2.png (642×375 px, 77 KB)

  • The cog icon will lead to the settings system where users can opt-out to this kind of invite (to be supported when T290317 is ready. Meanwhile the cog can be skipped)
  • The "Translate <section-name>" option will lead to Section Translation with the article, languages, and section pre-selected.

Details about the logic

This invite will be shown when:

  • The user made, as part of their 10 latest significant edits (more about significant edits below), a contribution to the equivalent page they are visiting (in a different language).
  • The contribution is a significant addition to the section. Diff is +500 bytes or more to consider it "significant".
  • The section where the user contributed in the source language does not exist in the current language.

(The numbers above are suggested as a reference, they are open for discussion and can be tweaked to better capture the intent of the task)

After the initial implementation no events were registered for this entry point (T318910), so it would be good to double-check the instrumentation works as expected

Event Timeline

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

For this entry point, has the instrumentation part be considered as part of the current work or is it preferred to create a separate ticket (to implement or discuss details about it)?

ngkountas changed the task status from Open to In Progress.Feb 1 2022, 12:07 AM

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

[mediawiki/extensions/ContentTranslation@master] CX recent edit entrypoint: Add EditedSectionFinder service

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

Change 734870 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Add \"cx_significant_edits\" table to support entrypoint

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

Change 740887 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX recent edit entrypoint: Add edit model and store

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

Change 763179 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX recent edit entrypoint: Add EditedSectionFinder service

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

Screenshot from latest patch:

DesktopMobile
image.png (962×746 px, 291 KB)
image.png (962×746 px, 228 KB)

Issues noticed:

  1. Should we show this invite in desktop? I dont think so.
  2. Alignment issue for the + icon. Looks ok in Mobile though
  3. The link target takes to wrong URL(URL has missing title=Special:ContentTranslation part).
  4. The Translate button could be a link for accessibility reasons.
  5. Dismiss button hides it, but should we hide the message permanently? Remember it atleast in browser session?

I updated the related patch to fix above issues. @Pginer-WMF could you confirm we should not show this invite in desktop as Santhosh mentions in the first (1) issue above? Also, do you think we should add some additional logic to hide the invitation permanently when the close button is clicked (as asked in issue (5) above)?

Regarding the questions:

(1) I think we should not show the invite on desktop for now. Translating sections on desktop is not fully supported. Once desktop support for sections is more stable, we can consider exposing this. I'll create a separate ticket for this.

(5) Disabling "permanently" can have multiple interpretations:

  • Different articles. It is ok for the invite even if the user discarded it in a different article previously. A general way to opt-out for this kind of contribution invite (and others) will be provided through a cog icon when T290317 is ready.
  • Same article. Ideally, it would be great not to make the same exact suggestion for the same edited section on the same article once users have discarded it. That is, if I discard a suggestion to translate the "Legal status" of the Moon article:
    • It will not be expected to be shown just by refreshing or visiting the same page without any other edit activity.
    • It may be expected to be shown if the source article was edited again by me for the same or other section. In this case the invite would be understood as a suggestion to transfer the new contents. This is less important consideration than the previous one, so we can be flexible depending on technical complexity.

Change 736275 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX: Add after edit hook to create entries in significant-edits table

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

Change 738178 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX recent edit entrypoint: add hook to register JS module

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

Change 738192 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] SX: Add UI for entrypoint for translating recently edited section

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

Nikerabbit changed the task status from In Progress to Open.Sep 6 2023, 7:41 AM
Nikerabbit set the point value for this task to 1.

The above QA tested the "Invite after translation" entrypoint, but the task is about the "Invite to translate a section recently edited in another language" entrypoint (recent edit entrypoint).

Screenshot from 2025-07-02 13-00-16.png (739×1 px, 371 KB)

Confirming that the dashboard translation start events are being logged for this entry point with event source as followup_after_publishing

Event count at the destination table with this event source:

yearevent_count
20253894
20243483

@ngkountas

The above QA tested the "Invite after translation" entrypoint, but the task is about the "Invite to translate a section recently edited in another language" entrypoint (recent edit entrypoint).

What is the event_source for instrumentation?

There are not events with recent_edit as event source at the destination, but there are with recent_translation

yearevent_count
20252934
20245020
20232315

Thanks for the data @KCVelaga_WMF! It turns out that the recent_edit entrypoint is not instrumented at all! I'm submitting a patch to fix this.

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

[mediawiki/extensions/ContentTranslation@master] CX: Instrument mobile "recent-edit" entrypoint

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

Change #1165817 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] CX: Instrument mobile "recent-edit" entrypoint

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

@ngkountas thanks for clarifying, I will check your fix is complete

Is there any way to test this outside editing production wikis? At least the events should be flowing now so @KCVelaga_WMF should see if there are any.

@Nikerabbit I am checking with @ngkountas to find the steps to properly test this outside production wikis

The entrypoint URL uses the mfrecentedit campaign, as it should. That's all that's required for the entrypoint instrumentation to work properly — and it does, as demonstrated in the following screencast (from my local dev environment), where one can easily see the dashboard_open logged with the recent_edit event_source:

Once, @KCVelaga_WMF is back and confirms that the recent_edit event source properly receives events, we can close this task for good.

Nikerabbit changed the task status from Open to In Progress.Aug 12 2025, 7:23 AM

I queried the data destination, event.mediawiki_content_translation_event for August. There's 1 event with dashboard_open event type with event source as recent_edit.

This entrypoint is not expected to be much more prominent. At the same time it's impossible to test in production without significantly polluting the main namespace of some wiki. However, given that we receive instrumentation events from this entrypoint and based on the screencast of how the entrypoint looks like from my local dev environment, I think we can close this task as completed.