Page MenuHomePhabricator

Special:PageMigration - "query - messagecollection" API throws an error
Closed, ResolvedPublicBUG REPORT

Description

Outcome

Page migration now works on Translatewiki.net as well.

  1. translate-language-disabled-source was converted to a warning instead of an error
  2. Special:Translate was update to handle this warning, and not allow translators to translate to the source language.
  3. English was removed from the list of disabled languages on translatewiki.net
  4. QueryMessageCollection api was updated to not throw an error if the group source language is disabled.

Steps to reproduce

  1. Open Special:PageMigration
  2. Search in the Textbox for the name of a page that has a translation. Eg: Main Page/fr
  3. Click on Import

Expected behavior
UI should update and show all message collection for page migration.

Actual behavior
Nothing happens, the UI does not update at all nor does it show any errors.

Additional info

The following API call made from getSourceUnits method in file ext.translate.special.pagemigration.js is failing,

API URL -

/api.php?action=query&format=json&list=messagecollection&mcgroup=page-T160511&mclanguage=en&mcprop=definition

Response -

{
  "error": {
    "code": "translate-language-disabled-source",
    "info": "The source language of this group is English. Please select another language to translate into.",
    "*": "See http://127.0.0.1:8080/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."
  }
}

Comments from Niklas -

That would mean converting the translate-language-disabled error to warning and making sure Special:Translate still handles it in the same way as it does currently

Event Timeline

abi_ triaged this task as High priority.Mar 6 2019, 7:42 AM
abi_ created this task.
abi_ updated the task description. (Show Details)
abi_ lowered the priority of this task from High to Medium.Mar 6 2019, 7:57 AM
abi_ moved this task from Backlog to In Progress on the User-abi_ board.

Change 496113 had a related patch set uploaded (by Abijeet Patro; owner: Abijeet Patro):
[mediawiki/extensions/Translate@master] Fix broken Special:PageMigration due to error from MessageCollection API

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

This was being caused because fetching message collections from the API in the source language of the message group throws an error. Message collections in the source language are needed on the Special:PageMigration.

Following changes have been made,

  1. Changed the error - translate-language-disabled-source to a warning in ApiQueryMessageCollection.
  2. Updated necessary language files.
  3. Changed the behavior of the messagetable component to treat the warning as an error.

I've also added a test case to ensure that if message collections are requested in the source language a warning is issued rather than an error.

Other observations

Few code improvements can be done in the script for PageMigration - ext.translate.special.pagemigration.js

  1. Handle unforeseen API errors in page migration.
  2. Display loading symbols when certain actions are performed such as importing old translation, saving translations etc.
  3. Currently getFuzzyTimestamp and getSourceUnits are called parallely, but based on response from getFuzzyTimestamp we determine if a page exists or has any old translations. In such cases the getSourceUnits call is unnecessary.

Note that I've not been able to test the TranslationStash page where the messagetable component is used. I think this page is disabled? I've not made any changes to the corresponding script - ext.translate.special.translationstash.js.

Test cases


Please find the test cases below,

TC #1 - PageMigration should display list of messages

  1. Go to Special:PageMigration.
  2. Enter a page that contains old translations.

Expected Behavior

You should see a list of messages appearing in the UI. See image below for reference,

T217727 - page-migration.png (688×1 px, 31 KB)

TC #2 - Translate page should show error on selecting the source language

  1. Create a page and mark it for translation.
  2. Start translating the page.
  3. Select the source language of the page as the target language.

Expected Behavior

A warning should appear stating,

The source language of this group is English. Please select another language to translate into.

abi_ renamed this task from Special:PageMigration - "query - messagecollection" API throws an error to Special:PageMigration - "query - messagecollection" API throws an error.Mar 13 2019, 6:46 PM

Change 496113 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Fix broken Special:PageMigration due to error from MessageCollection API

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

abi_ removed a project: Patch-For-Review.

Moving to QA.

Checked this on https://translatewiki.net/wiki/Special:PageMigration and it seems to be failing again with a similar warning. Will need to investigate further how the changes related to this patch got reverted.

Aklapper removed abi_ as the assignee of this task.Jul 2 2021, 5:18 AM

Removing task assignee due to inactivity, as this open task has been assigned for more than two years (see emails sent to assignee on May26 and Jun17, and T270544). Please assign this task to yourself again if you still realistically [plan to] work on this task - it would be very welcome!

(See https://www.mediawiki.org/wiki/Bug_management/Assignee_cleanup for tips how to best manage your individual work in Phabricator.)

Change 723813 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[mediawiki/extensions/Translate@master] QueryMessageCollection: Warn if source language is disabled

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

Change 724010 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[translatewiki@master] Remove English from disabled target language list

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

Change 723813 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] QueryMessageCollection: Warn if source language is disabled

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

Change 724010 merged by jenkins-bot:

[translatewiki@master] Remove English from disabled target language list

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

abi_ claimed this task.

This was happening because "English" was added to disabled target language list. We've updated the check in QueryMessageCollection to exclude the source language from that check.