Page MenuHomePhabricator

Rewrite ContentTranslation's ArticleTopicsDefinition to make use of the ArticleTopicFiltersRegistry class
Closed, ResolvedPublic

Description

As part of T380825: Make ORES topics and their translations easily available to MediaWiki extensions, the logic and messages for article topics has been moved to the WikimediaMessages exension. This functionality is exposed via the ArticleTopicFiltersRegistry, so that callers don't have to know about the message keys used or other aspects such as grouping.

ContentTranslation should update its ArticleTopicsDefinition class to use ArticleTopicFiltersRegistry; or even remove the class altogether and inline the relevant functionality if possible.

Note that this seemingly introduces a hard dependency on the WikimediaMessages extension. This is kind of a pre-exisiting problem though, as the topic list is based on a Wikipedia-specific model. If the extension isn't meant to be Wikimedia-specific, then it should have a fallback for when the list of topics is not available. See for example how the CampaignEvents extension does that.

Derived Requirement

Update ContentTranslation's ArticleTopicsDefinition class to utilize the ArticleTopicFiltersRegistry for handling article topics. If feasible, remove ArticleTopicsDefinition entirely and inline its functionality. Ensure that the implementation properly handles cases where the WikimediaMessages extension is unavailable, providing an appropriate fallback.

Test Steps

Test Case 1: Verify ArticleTopicsDefinition Uses ArticleTopicFiltersRegistry

  1. Open Wikipedia and navigate to the ContentTranslation tool.
  2. Initiate a translation for an article with predefined topics.
  3. ✅❓❌⬜ AC1: Confirm that article topics are retrieved via ArticleTopicFiltersRegistry.

Test Case 2: Ensure Article Topics Are Displayed Correctly in Translations

  1. Start a new translation in ContentTranslation in a different language (ex. uselang=es).
  2. Observe the topics assigned to the source article.
  3. ✅❓❌⬜ AC2: Confirm that the topics match those expected from ArticleTopicFiltersRegistry.

QA Results - Test Wiki

ACStatusDetails
1T387159#10671511
2T387159#10671511

Event Timeline

Change #1122952 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/ContentTranslation@master] Switch to topic definitions from the WikimediaMessages extension

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

Change #1122954 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[integration/config@master] zuul: Make ContentTranslation and GrowthExperiments depend on WikimediaMessages

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

I have implemented a first revision of this with a hard dependency on the WikimediaMessages extension. As mentioned in the task description, this is unnecessary and can be replaced with a soft dependency. However, I'm not familiar with the extension and am not confident doing it without breaking anything, hence deferring to the LPL team as maintainers.

Change #1122954 merged by jenkins-bot:

[integration/config@master] Make ContentTranslation and GrowthExperiments depend on WikimediaMessages

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

Change #1122952 merged by jenkins-bot:

[mediawiki/extensions/ContentTranslation@master] Switch to topic definitions from the WikimediaMessages extension

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

Having done the initial work, I'm unassigning myself and letting the team decide how much cleanup they want to do and how. Obviously, I remain available for questions etc.

Nikerabbit triaged this task as Medium priority.Feb 27 2025, 8:47 AM
Nikerabbit moved this task from Needs Triage to Enhancements on the ContentTranslation board.
SBisson subscribed.

I don't see anymore cleanup required here.

I'll boldly park this is "pending deployment" and resolve it after it's been in production for a few days without hiccups.

I don't see anymore cleanup required here.

I believe the main cleanup would be the hard dependency on WikimediaMessages that I added. Strictly speaking, it doesn't have to be cleaned up, but it effectively makes the extension only usable on Wikimedia wikis.

I don't see anymore cleanup required here.

I believe the main cleanup would be the hard dependency on WikimediaMessages that I added. Strictly speaking, it doesn't have to be cleaned up, but it effectively makes the extension only usable on Wikimedia wikis.

ContentTranslation is not built to be reusable by 3rd parties. It already has so many explicit and implicit dependencies on other extensions are services that allowing for conditional enablement topic-related features doesn't seem worth it.

There actually is a 3rd party user that we learned about recently but they surely have heavy customization.

Okay, thanks for the clarification! Then yes, I think this is done modulo any QA findings.

@SBisson Confirmed that article topics are retrieved via ArticleTopicFiltersRegistry as seen in the screenshots below. I will mark this as a sign-off. Thanks for all your work!

Test Result - Test Wiki

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

Test Artifact(s):

https://test.m.wikipedia.org/w/index.php?title=Special:ContentTranslation&filter-type=automatic&filter-id=previous-edits&active-list=suggestions&from=en&to=it#/

Test Steps

Test Case 1: Verify ArticleTopicsDefinition Uses ArticleTopicFiltersRegistry

  1. Open Wikipedia and navigate to the ContentTranslation tool.
  2. Initiate a translation for an article with predefined topics.
  3. AC1: Confirm that article topics are retrieved via ArticleTopicFiltersRegistry.

2025-03-14_11-20-18.png (784×1 px, 157 KB)

2025-03-14_11-31-43.png (987×1 px, 447 KB)

Test Case 2: Ensure Article Topics Are Displayed Correctly in Translations

  1. Start a new translation in ContentTranslation in a different language (ex. uselang=es).
  2. Observe the topics assigned to the source article.
  3. AC2: Confirm that the topics match those expected from ArticleTopicFiltersRegistry.

2025-03-14_11-19-43.png (787×1 px, 154 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.

The topic areas seem to be displayed according to the models. Some of the alignment of naming discussed in other tickets is already present. For example. "Biography (women)" is used now.

However, some of the filters are not listed alphabetically. In particular, the "Biography (women)" is shown at the end of the "History and society" list while "Biography (all)" is shown at the beginning, and the rest follow the expected alphabetical order.
For this case it seems relevant that "Biography (all)" and "Biography (women)" were shown together since they complement their meaning (all vs. a sub-set of biographies). In addition, alphabetical order seems a reasonable expectation (although we need to consider how that plays with internationalization).

There are a couple more cases of alphabetical order being broken (marked below), but they affect the "Regions" group, which will be revamped as country support is available.

bn.m.wikipedia.org_w_index.php_title=Special_ContentTranslation&active-list=suggestions&filter-id=previous-edits&filter-type=automatic&from=en&to=bn(Wiki Tablet).png (966×768 px, 153 KB)

Moving to product sing-off with the note on T387159#10674918 for the possible creation of a new ticket or incorporating the observations into existing relevant ones.

Moving to product sing-off with the note on T387159#10674918 for the possible creation of a new ticket or incorporating the observations into existing relevant ones.

I filed T389984: Order article topics alphabetically