Page MenuHomePhabricator

Special:PageMigration - "query - messagecollection" API throws an error
Open, NormalPublicBug

Description

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.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptMar 6 2019, 7:42 AM
abi_ updated the task description. (Show Details)Mar 6 2019, 7:44 AM
abi_ updated the task description. (Show Details)
abi_ lowered the priority of this task from High to Normal.Mar 6 2019, 7:57 AM
abi_ claimed this task.Mar 11 2019, 12:44 PM
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

abi_ moved this task from In Progress to Under Review on the User-abi_ board.Mar 13 2019, 7:49 AM

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,

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_ moved this task from Under Review to QA on the User-abi_ board.Mar 18 2019, 2:26 PM
abi_ removed a project: Patch-For-Review.

Moving to QA.