Page MenuHomePhabricator

Add machine translation suggestions in the SVG translate tool
Open, Needs TriagePublic

Description

Wikimedia's machine translation service should be used to provide suggestions for translations (in much the same way as is done on Translatewiki.net).

(Details t.b.d.)

Event Timeline

Samwilson renamed this task from Add automatic machine translations by default in the SVG translate tool to Add machine translation suggestions in the SVG translate tool.Oct 5 2025, 11:45 AM
Samwilson updated the task description. (Show Details)

I m trying to help with this task. here is a proposal
UI: mockup:

SVGtranslate-machine-suggestion-mockup-v2.png (928×1 px, 98 KB)

  1. machine translation is optional with a tick box, must be actioned by user
  2. if machine translation is selected, for each segments, propose a suggestion (API call)

3.user must intentionally accept translation before submitting

Code
For a technical perspective, going through the repo and the Mint service:

  1. Add an MT suggestions backend endpoint in svgtranslate that accepts POST requests from the tool (source language, target language, an array of segments)
  2. Authentication: Use the existing svgtranslate session (Toolforge or Wikimedia login) to gate the MT request; reject anonymous requests
  3. Wait for an answer and parse into segments back into the UI

hope it makes sense
please comment. thanks!

Would be good to have it remember if "Suggestion machine translation" was selected between an individuals users sessions.

James

When checking the "Suggest machine translation" would the text fields then get filled with the suggestions? (As a side note, it'd be good to show some visible loading state at that point.) Once the suggestions are in the text fields, what is the difference between "Accept Suggestions" and "Submit"? Or does it mean that the suggestions will be shown e.g. below each field, and the accept button will move them into the fields?

Note also that some fields may already have values, in which case the suggestions should ignore those fields (i.e. not send them for translation, and not fill them with anything, as we assume any existing value has been checked and approved by a human).

The way Translatewiki.net does it is to show the machine translations near the text field, and they can be copied in by clicking them:

image.png (321×987 px, 54 KB)

  1. checking the "Suggest machine translation": Yes, text field will be filled with machine translation. Will add a spinner / visible loading state when this happens.
  2. difference between "Accept Suggestions" and "Submit": i want to make sure the acceptance of machine translation is intentional to ensure the quality. I can remove the "accept suggestions" button and add a warning text box instead.
  3. I am not sure i understand the use case when a manual translation would already be in the box: is it if a user starts translating manually then ticks the 'suggest machine translation' ?

in any case, i propose to
3.a add the machine translation only when the text box is empty (no previous manual addition)
3.b change the background of machine translated box to light green to clearly indicate the boxes which are suggestions from the service
attaching a new mockup

  1. remember if "Suggestion machine translation" was selected between an individuals users sessions.

I am not sure it makes sense, because the case for machine translation will vary based on the language, and also the type of sentences translated (for instance, specific semantic such as medical language is harder to translate than plain conversational english)
in any case i can add this feature in a future version

  1. i do not have my dev account yet, i ll submit a ticket to get it validated.

mockup-v2.png (853×1 px, 99 KB)

difference between "Accept Suggestions" and "Submit": i want to make sure the acceptance of machine translation is intentional to ensure the quality. I can remove the "accept suggestions" button and add a warning text box instead.

The warning message you have there sounds good. It does sound like a user would need to click first the 'Accept suggestions' button and then the 'Submit' one.

Also, note that there are currently no buttons at all at the bottom of the form! The warning should I think go up at the top. The button for uploading to Commons is the one at top right, labelled 'Upload to Commons'.

I am not sure i understand the use case when a manual translation would already be in the box: is it if a user starts translating manually then ticks the 'suggest machine translation' ?

Someone might've started translating an image, and done some of the labels, and then uploaded the file. This would leave some labels blank in that language, so the next time someone loads that file, there would be some already done and some left to do.

3.a add the machine translation only when the text box is empty (no previous manual addition)

Perfect.

3.b change the background of machine translated box to light green to clearly indicate the boxes which are suggestions from the service

Great idea. Do note however that we shouldn't rely solely on color to convey state, so perhaps a note under the input box could be good as well. Although that would make the whole form a lot taller so perhaps not! Bold the field's label maybe? And at the top have a message that says something about "Please check the highlighted labels" or something? I'm not sure.

remember if "Suggestion machine translation" was selected between an individuals users sessions.

That might be useful, but I agree that for the first iteration it's probably not worth worrying about. Rather than a checkbox, I think make it a button, and users then click it when they want to fetch the machine translations. This would also reduce spurious requests for machine translations and so make the it all feel a bit faster.

Here is what it could look like with all comments taken into account:

mockup.v4.png (954×464 px, 96 KB)

I leave only the 'Upload to Commons' button, with the warning message if the tickbox 'suggest machine translation' is ticked
If machine translation suggested, I change the background color + font to italic and bold to mark the difference
if an existing translation exists, it is loaded in the box.

merge request (draft)
Priority:
implementing api call to cxserver to get translated field

Secondary implementation:

  • remember user preference on translation
  • color code translated field
  • display warning messages to confirm to translations