Page MenuHomePhabricator

Community configuration: i18n messages are not generated correctly
Open, HighPublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

Use the following as SuggestedEditsSchema (includes/Config/Schemas/SuggestedEditsSchema.php in GrowthExperiments):

class SuggestedEditsSchema extends JsonSchema {

	public const GEInfoboxTemplates = [
		self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
	];

// ***** STRUCTURED TASKS *****
	public const image_recommendation = [
		self::TYPE => self::TYPE_OBJECT,
		self::PROPERTIES => [
			'disabled' => [
				self::TYPE => self::TYPE_BOOLEAN,
				self::DEFAULT => false,
			],
			'excludedTemplates' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
			],
			'excludedCategories' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
			],
			'learnmore' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ],
			],
			'maxTasksPerDay' => [
				self::TYPE => self::TYPE_NUMBER,
			],
		],
	];

	public const section_image_recommendation = [
		self::TYPE => self::TYPE_OBJECT,
		self::PROPERTIES => [
			'disabled' => [
				self::TYPE => self::TYPE_BOOLEAN,
				self::DEFAULT => false,
			],
			'excludedTemplates' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
			],
			'excludedCategories' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitles' ],
			],
			'learnmore' => [
				self::REF => [ 'class' => MediaWikiDefinitions::class, 'field' => 'PageTitle' ],
			],
			'maxTasksPerDay' => [
				self::TYPE => self::TYPE_NUMBER,
			],
		],
	];
}

Ensure the following i18n messages exist:

{
"communityconfiguration-growthsuggestededits-geinfoboxtemplates-label": "Infobox templates",
	"communityconfiguration-growthsuggestededits-geinfoboxtemplates-help-text": "These templates are needed for the image suggestions newcomer task feature. Articles containing these templates will not be listed as image suggestion tasks.",
	"communityconfiguration-growthsuggestededits-copyedit-label": "Copyedit",
	"communityconfiguration-growthsuggestededits-expand-label": "Expand short articles",
	"communityconfiguration-growthsuggestededits-links-label": "Add links (unstructured)",
	"communityconfiguration-growthsuggestededits-references": "Find references",
	"communityconfiguration-growthsuggestededits-update": "Update articles",
	"communityconfiguration-growthsuggestededits-image_recommendation-label": " Add an image to an unillustrated article",
	"communityconfiguration-growthsuggestededits-image_recommendation-disabled-label": "Is the task enabled?",
	"communityconfiguration-growthsuggestededits-image_recommendation-disabled-control-label": "The task is disabled.",
	"communityconfiguration-growthsuggestededits-image_recommendation-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
	"communityconfiguration-growthsuggestededits-image_recommendation-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type",
	"communityconfiguration-growthsuggestededits-image_recommendation-learnmore-label": "Destination page for learning more about image recommendation task type",
	"communityconfiguration-growthsuggestededits-image_recommendation-maxtasksperday-label": "The maximum number of \"Add an image to an unillustrated article\" suggested tasks a newcomer can complete daily",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-label": "Add an image to an article section",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-disabled-label": "Is the task enabled?",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-disabled-control-label": "The task is disabled.",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-excludedtemplates-label": "Articles containing templates defined here will not be shown to users as tasks for this task type.",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-excludedcategories-label": "Articles containing categories defined here will not be shown to users as tasks for this task type",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-learnmore-label": "Destination page for learning more about image recommendation task type",
	"communityconfiguration-growthsuggestededits-section_image_recommendation-maxtasksperday-label": "The maximum number of \"Add an image to an unillustrated article\" suggested tasks a newcomer can complete daily"
}

Once that is done, go to http://localhost:8080/wiki/Special:CommunityConfiguration/GrowthSuggestedEdits.

What happens?:

image.png (1×2 px, 188 KB)

As you can see, the i18n messages for section_image_recommendation do not get displayed. Adding console.log to init.js shows that the messages are not requested from the server at all. This is confusing, as both image_recommendation and section_image_recommendation have the same code.

What should have happened instead?:

The bottom half of the form looks the same as the top part.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

urbanecm@wmf3345 CommunityConfiguration % git show -s HEAD
commit 633a0ddbb5491a0036afcaa35d82b9a1ed5488e3 (HEAD -> master, origin/master, origin/HEAD)
Author: Michael Große <mgrosse@wikimedia.org>
Date:   Fri Apr 19 17:37:50 2024 +0200

    Add validation warnings
    
    Only warning about some issues instead of failing will be necessary when
    migrating a Schema to a newer version that might have new parameters or
    might drop some.
    
    This could in principle be implemented with the existing
    `IValidator::validate` method by fully relying on the difference between
    `StatusValue::isOK` and `StatusValue::isGood`. However, that difference
    is subtle and prone to confusion and thus errors. Though this could be
    mitigated with thorough and explicit testing.
    For now, this change introduces a second method on `IValidator` to make
    it explicit that this will return a StatusValue that is still `OK` if
    there are warnings. `::validate` has been renamed to make the intended
    functionality explicit.
    
    For now, this change assumes that IValidator will not be stable neither
    to implement nor to call by external code. If this assumption changes,
    then we may want to reconsider whether these public method signatures
    are the best to make stable, or whether we should find a solution that
    is more extendable under a stable interface policy. This could, for
    example, mean to only expose a single ::validate() method that then
    would have a second "mode" parameter that could either be
    `IValidator::FOR_READS` or `IValidator::FOR_WRITES`.
    
    Bug: T362042
    Change-Id: Ie53284c56f43684256bb3a8cb0e10cf4fd24986e
urbanecm@wmf3345 CommunityConfiguration % 

urbanecm@wmf3345 core % git show -s HEAD
commit ce9d259317b876fdd2334d4065230b2f9e1f1510 (HEAD -> master, origin/master, origin/HEAD)
Merge: 10ec2e342a9 ed7e787f32e
Author: [BOT] jenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Date:   Mon Apr 22 17:11:41 2024 +0000

    Merge "Ignore/fix MediaWiki.Commenting.PropertyDocumentation.WrongStyle"
urbanecm@wmf3345 core % 

urbanecm@wmf3345 CommunityConfigurationExample % git show -s HEAD
commit 5596a3e42014e8d88bef8f571d5940ed5d2bacf6 (HEAD -> main, origin/main, origin/HEAD)
Author: Martin Urbanec <martin.urbanec@wikimedia.cz>
Date:   Sat Mar 30 20:30:45 2024 +0100

    i18n: Add default form labels
urbanecm@wmf3345 CommunityConfigurationExample %

Other information (browser name/version, screenshots, etc.):

The snippets from this task are based on my patches for T360471: Growth features: Migrate Suggested edits from Special:EditGrowthConfig to Community configuration 2.0.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript
Urbanecm_WMF triaged this task as High priority.
Urbanecm_WMF added a subscriber: Sgs.

Assigning to @Sgs per our meeting today.

Change #1025367 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/CommunityConfiguration@master] Editor: fix the editor messages generation

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

Change #1025367 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] Editor: fix the editor messages generation

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

Change #1025715 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/CommunityConfiguration@master] i18n: fix array label generation

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

Change #1025715 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] i18n: fix array label generation

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