Page MenuHomePhabricator

Disable Save button when saving a non-priority language with "Prevent translations to languages other than the priority.." is set
Open, LowPublic

Description

When a page is marked for translation with a priority language set and the option - Prevent translations to languages other than the priority languages set, translators are still allowed to translate a translation unit and then click on the save button. After clicking on the save button, the translators are moved to the next message but the translation is not actually saved due to the Prevent translations to languages other ... option being set.

The translator can see the error by reopening the previous translation unit.

See below images,

After discussing with @Nikerabbit, we've decided to disable the save button and if possible show the warning at the beginning, when the translator opens the translation unit for translating purpose.

As per discussion in T217046

Event Timeline

abi_ created this task.Mar 1 2019, 4:07 PM
abi_ triaged this task as Low priority.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 1 2019, 4:07 PM
abi_ moved this task from Backlog to In Progress on the User-abi_ board.Mar 16 2019, 2:20 PM
abi_ added a comment.EditedMar 18 2019, 2:21 PM

This will require more work than I initially anticipated.

First, something that I noticed which is causing a bug that is important in this context. If priority force is set to true, then the response from the API (/api.php?action=query&format=json&meta=messagegroups) contains the priorityforce field with the value empty, whereas if it is false, the property is completely absent. This breaks the functionality here. This code shows a different message to the user if priorityforce property evaluates to true. If this is fixed, the UI has an updated message. Please see the image below,

This API response is in-accordance with JSON version 1 which I think we can update to request for JSON response version 2. You can read more about this here.

I think with this fixed, it is much more clearer to translators that translation has been disabled for other languages.


Now, coming to our functionality, the messagetable module is responsible to display the translateeditor. The API call (/api.php?action=query&format=json&list=messagecollection) that the messagetable module makes, does not have any information regarding the priorityforce property.

I can think of two approaches to work around this,

  1. Add that information to the messagecollection API under the metadata property.
  2. Pass that information to the messagetable module, once we receive it from the messagegroups API call.

After that we'll have to add a sort of readonly mode to the editor module, that allows translators to view the translation but not edit them. This readonly mode can be achieved by disabling the Save button as it is done now when there is no value in the editor. In addition, translators will have to be shown the reason why the readonly mode is enabled.

CC: @Nikerabbit

abi_ moved this task from In Progress to Backlog on the User-abi_ board.

To fix the underlying bug discovered during the analysis for this task, created - T218777: Show proper notice when translations to non-priority language is blocked

Putting this in backlog as per discussion with @Nikerabbit. We've decided that the front-end code could use a some rewrite, and this will be handled as part of that.