Page MenuHomePhabricator

Add automation to assist with preparing wish pages for translation
Closed, ResolvedPublic

Description

User Story
As a staff member administering the Community Wishlist I would like to be able to easily prepare a wish for translation so that I don't have to fully do it manually.

CWS Manager is a gadget used by staff to manage previous Community Wishlist Surveys.

A summary of its functionality can be found at https://meta.wikimedia.org/w/index.php?title=Community_Wishlist_Survey/Staff_instructions&oldid=26624729#CWS_Manager_gadget

The CWS Manager opens a dialog from which to choose the action to take, but as there is now only one action it's easier to not have a dialog window and just start the process when the button is clicked.

Acceptance criteria:

A new 'Prepare for translation' button is added, visible only to WMF users and positioned near the 'Edit wish' button that does the following:

Steps:

  1. Open the wish for editing in wikitext mode
  2. Adds <translate> tags to the page around the applicable fields ("title", "problem", "otherproject" and "audience")

For translation admins:

When marking a wish page for translation at Special:PageTranslation, the gadget should:

  • Uncheck the "Allow translation of page title" option, if it was by default checked
    • Rationale is that we store the wish title as a field in the wish template, and we don't want to duplicate translator's work.

Designs:

The position of the new button is not in the current Figma designs.

Details for QA:

  • Check if this is only available to staff accounts.
  • Check that the button only shows on wishes that have not yet been setup for translation.
  • Make sure if translation tags are applied correctly.

Details

Other Assignee
dom_walden
Related Changes in Gerrit:
Related Changes in GitLab:
TitleReferenceAuthorSource BranchDest Branch
Grant pagelang to sysop grouptoolforge-repos/wishlist-test!2samwilsonsysop-pagelangmaster
Update submodules to get recent fixes for Translate and coretoolforge-repos/wishlist-test!1samwilsonupdate-translatemaster
Customize query in GitLab

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
Restricted Application added a subscriber: Aklapper. · View Herald Transcript
MusikAnimal renamed this task from Decide what if anything we want from CWS Manager to Port CWS Manager to new wishlist system.May 22 2024, 7:34 AM

Grr, I need to work staff ability to change the status, first (T363228).

JWheeler-WMF renamed this task from Port CWS Manager to new wishlist system to Inform translators that a wish is ready for translation. .Jun 20 2024, 3:50 PM
MusikAnimal renamed this task from Inform translators that a wish is ready for translation. to Add automation to assist with preparing pages for translation.Jun 20 2024, 6:58 PM

A few things I'm not quite sure of here:

  • Do we want a confirmation alert when the button is pressed?
  • Should the button be hidden for some statuses, or can a wish be prepared for translation at any time? I figure that rather than using the status as an indicator of whether a wish has been prepared for translation yet, we can instead check for the existence of the subpage.
  • Does it make sense to have the subpage name be Community_Wishlist/Wishes/Lorem_ipsum/Proposal? I saw somewhere that there was mention of using /Translatable as the subpage name, to make it clearer what it's for (can't find that discussion now, maybe I imagined it).

Oh right, yep: /Translatable is what we're using for Focus areas, so we should use the same for Wishes I think.

After more discussion, it sounds like we don't actually need the subpage to be created for wishes, because all discussion for them will happen on their talk pages. That means that the wish page itself can be marked for translation.

So I think the main work for for this task is to add a way to quickly add <translate> tags to the title, problem, and audience fields (i.e. the three free-text fields that are translatable). This could perhaps be a button that's visible to anyone if a wish has status=open and hasn't already been marked for translation.

We talked about the probability of having to prohibit editing via the form after a wish had been marked for translation, but this is maybe not necessary. Editing with the form after translation tags are added should work okay, except the translate tags will be visible. Is that an issue? It seems that it'd still be easier to e.g. add phab tags or change the status or whatever with the form, so there's maybe no need to avoid using the form. For example, the title field would look like:

Screenshot 2024-06-24 at 10-39-19 Wikimedia Foundation [...].png (677×92 px, 13 KB)

Does this all sound correct? I'll update the task description if so.

Similar to the idea at T368349#9927714, we can have the bot set the page language on creation, then when we add the translate tags, we'll be translating to English using Extension:Translate. Fancy!

This would be dependent on https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1050038

Change #1050038 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/core@master] MainConfigSchema: add 'pagelang' as a permission for 'editpage'

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

Change #1050087 had a related patch set uploaded (by MusikAnimal; author: MusikAnimal):

[mediawiki/extensions/Translate@master] extension.json: add translate-message permission to editpage grant

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

MusikAnimal renamed this task from Add automation to assist with preparing pages for translation to Add automation to assist with preparing wish pages for translation.Jun 27 2024, 3:34 AM
MusikAnimal updated the task description. (Show Details)

Change #1050038 merged by jenkins-bot:

[mediawiki/core@master] MainConfigSchema: add 'pagelang' as a permission for 'editpage'

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

Change #1050087 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] extension.json: add translate-message permission to editpage grant

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

@MusikAnimal

  • Check if this is only available to staff accounts.

I can use the button even if my account has no special rights.

  • Check that the button only shows on wishes that have not yet been setup for translation.

The button still appears even after a wish has had <translate> tags added and been marked for translation (e.g. https://wishlist-test.toolforge.org/wiki/Community_Wishlist/Wishes/Blocked_wish_1)

Although I see there are some that aren't, e.g. https://wishlist-test.toolforge.org/wiki/Community_Wishlist/Wishes/A_more_performant_bot_to_replace_ListeriaBot. Not sure why.

  • Make sure if translation tags are applied correctly.

I tried adding translate tags to (almost) all the wishes currently on https://wishlist-test.toolforge.org. It was mostly fine.

I found a few exceptions where content after pipes was lost. Perhaps these represent wikitext proposers are unlikely to use. Examples:

musikanimal opened https://gitlab.wikimedia.org/repos/commtech/wishlist-intake/-/merge_requests/171

WishlistManager: restrict 'Prepare for translation' to staff accounts

@MusikAnimal

  • Check if this is only available to staff accounts.

I can use the button even if my account has no special rights.

Fixed with above MR (not deployed yet).

  • Check that the button only shows on wishes that have not yet been setup for translation.

The button still appears even after a wish has had <translate> tags added and been marked for translation (e.g. https://wishlist-test.toolforge.org/wiki/Community_Wishlist/Wishes/Blocked_wish_1)

Although I see there are some that aren't, e.g. https://wishlist-test.toolforge.org/wiki/Community_Wishlist/Wishes/A_more_performant_bot_to_replace_ListeriaBot. Not sure why.

Could you provide repro steps? There should be a "Marked for translation" button if it has indeed been marked for translation. The script doesn't currently check for the intermediate step of there being <translate> tags but it's not marked for translation. This situation should be rare or even nonexistent though because we're going to automate the "marking" part.

  • Make sure if translation tags are applied correctly.

I tried adding translate tags to (almost) all the wishes currently on https://wishlist-test.toolforge.org. It was mostly fine.

I found a few exceptions where content after pipes was lost. Perhaps these represent wikitext proposers are unlikely to use. Examples:

Indeed, these examples broke the syntax of the Wish template, thus we aren't able to parse it and add translate tags properly. I would not many expect wishes like this in the real-world.

samwilson merged https://gitlab.wikimedia.org/repos/commtech/wishlist-intake/-/merge_requests/171

WishlistManager: restrict 'Prepare for translation' to staff accounts

I can use the button even if my account has no special rights.

Fixed with above MR (not deployed yet).

Thanks. I checked that I don't see the button anymore as a non-admin user.

Could you provide repro steps? There should be a "Marked for translation" button if it has indeed been marked for translation. The script doesn't currently check for the intermediate step of there being <translate> tags but it's not marked for translation. This situation should be rare or even nonexistent though because we're going to automate the "marking" part.

Immediately after marking a wish for translation I still see the "Prepare for translation" button. After refreshing the page I instead see the "Marked for translation". Perhaps it is caching or bot delay.

Nevertheless, I will move this to done.

Immediately after marking a wish for translation I still see the "Prepare for translation" button. After refreshing the page I instead see the "Marked for translation". Perhaps it is caching or bot delay.

Job queue delay, yes. In production it'll be much faster and hopefully this won't be a problem.