As part of T362259, the Campaigns-Product-Team would like to use ORES topics for a new feature. In particular, we would need a list of said topics, as well as translations. The same list and translations are currently already in use in two different MediaWiki extensions:
- GrowthExperiments, which stores the topic list in https://www.mediawiki.org/wiki/MediaWiki:NewcomerTopicsOres.json and has translations under the growthexperiments-homepage-suggestededits-topic-(name|group)- key prefixes (example)
- ContentTranslation (see T368422), which keeps the list in the ArticleTopicsDefinition class, and translations under the cx-articletopics-(topic|group)- key prefixes (example).
With this task, I am proposing that the list of topics and its translations be made easily available to MediaWiki extensions. In T368422 there had been an attempt to put these into the ORES extension, which is however not the appropriate place. Here, I'm proposing the WikimediaMessages extension. While not perfect, it has the advantages of being available on every wiki, and being Wikimedia-specific (just like the topic taxonomy).
There would be a new class basically identical to CX's ArticleTopicsDefinition class, providing both the raw topic names and their translated labels. The initial translations could presumably be imported from GrowthExperiments, since they've been around for a long time. The exact API is up for discussion. Now is a good time to identify what each team's needs are, and build it so that we all can use it.
I'm looking for general feedback on the proposal (for example, if there are better places than WikimediaMessages), and for specific feedback about what the new interface should provide. My initial proposal, based on the Campaigns team's needs, would be (method names are just examples):
/** Returns a plain list of topic IDs, for validation and the like */ public static function getTopicList(): array; /** * The "main" entry point, could be identical to ArticleTopicsDefinition::getTopics(). The main difference is that we either * make this use message keys (with l10n up to the caller), or add a MessageLocalizer/ITextFormatter parameter. */ public static function getGroupedTopicMessages(): array; /** * Returns localised labels for the given topic IDs. Like above, this could either return message keys, or take a * MessageLocalizer/ITextFormatter parameter. */ public static function getLocalizedLabels( array $topicIDs ): array;
In addition to us Campaigns-Product-Team, I am tagging Growth-Team (ref), Language and Product Localization, and Research as technical stakeholders. Please let me know if I need to use different tags or processes to reach y'all. Thanks in advance!