Page MenuHomePhabricator

Show proper notice when translations to non-priority language is blocked
Closed, ResolvedPublicBug

Description

Steps to Reproduce:

  1. Mark a page for translation with a priority language set and the option - Prevent translations to languages other than the priority languages set,
  2. Now try to translate the page into another non-priority language.

Actual Results:

You see the message - Translating to XYZ is not a priority for this page

See image below,

This message does not give the translator an indication that translations to non-priority languages are disabled.

Expected Results:

Instead a message should be shown stating that translations to non-priority languages are disabled.

Related : T217416: Disable Save button when saving a non-priority language with "Prevent translations to languages other than the priority.." is set

Event Timeline

abi_ created this task.Mar 20 2019, 1:18 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 20 2019, 1:18 PM
abi_ moved this task from Backlog to In Progress on the User-abi_ board.Mar 20 2019, 1:25 PM

Change 498306 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Fix improper notice when translating to non-priority language

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

abi_ moved this task from In Progress to Under Review on the User-abi_ board.Mar 22 2019, 5:51 AM

This was a small change. Updated the code in the specific function (ext.translate.base.js -> getMessageGroup) to use version 2. This is being called from two places,

  1. Special:Translation - ext.translate.special.translate.js
  2. Workflow selector - ext.translate.workflowselector.js

Tested to ensure that the change works as expected in both the sections along with fixing the bug.


Test cases

Enable Message group states. Set this up with automatic state changes by following instructions here. Test cases were run with the following value for $wgTranslateWorkflowStates,

$wgTranslateWorkflowStates = array(
	'unset' => array( 'color' => 'FF0000' ), // red
	'proofreading' => array( 'color' => 'd7f7f3' ), // light blue
	'ready' => array( 'color' => '00FF00' ), // green
	'inprogress' => array(
		'color' => 'FFFF00', // yellow
	),
	'state conditions' => array(
		array( 'ready', array( 'PROOFREAD' => 'MAX' ) ),
		array( 'proofreading', array( 'TRANSLATED' => 'MAX' ) ),
		array( 'unset', array( 'UNTRANSLATED' => 'MAX', 'OUTDATED' => 'ZERO', 'TRANSLATED' => 'ZERO' ) ),
		array( 'inprogress', array( 'UNTRANSLATED' => 'NONZERO' ) ),
	)
);

Please find the test cases below,

TC #1 - Proper notice is displayed when translating to non-priority language

  1. Mark a page for translation, set one or more languages as priority languages. Check the option - Prevent translations to languages other than priority languages
  2. Click on translate the page.
  3. Set the target language to a language that is not in the priority language list.

Expected Behavior - You should see an notice stating that translation to languages other than the priority languages is disabled.

TC #2 - Workflow selector should display all the possible states and the correct state of the page

Continued from #TC #1,

  1. Translate the page and select the target lagnuage as one of the priority language.
  2. Translate messages, but not all.
  3. Translate all messages.

Expected Behavior

  • After step 2, the workflow state selector should show - State: inprogress
  • After step 3, the workflow state selector should show - State: proofreading

Note, that it takes a bit of time for the workflow state selector to show the update state. You might also need to switch between tabs or refresh the page.

TC #3 - Proper notice is dispalyed when translating to non-priority language without priority force set

priority force - true when option Prevent translations to languages other than priority languages is set.

  1. Mark another page for translation and set one or more languages as priority langauge. Do not check the option Prevent translations to languages other than priority languages
  2. Translate the page and select a non-priority langauge.

Expected Behavior - A notice should appear stating that focus is on translating to the priority languages.

TC #4 - No notice is displayed when no priority languages are set

  1. Mark another page for translation without any priority language.
  2. Translate the page and select a langage other than the source language.

Expected Behavior - No notice should appear on the page.

Change 498306 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Fix improper notice when translating to non-priority language

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

abi_ moved this task from Under Review to QA on the User-abi_ board.Mar 29 2019, 7:00 PM
abi_ removed a project: Patch-For-Review.

Moving to QA.

abi_ closed this task as Resolved.May 21 2019, 9:09 AM
abi_ moved this task from QA to Done on the User-abi_ board.

This is done. Screenshots from meta.wikimedia,

Translating to non-priority language.

Translating to priority language,

Translating to non priority language, without Prevent translations to languages other than the priority languages set, set

Translating to priority language, without Prevent translations to languages other than the priority languages set, set