Page MenuHomePhabricator

Import metadata and automatically mark page for translation when importing translatable bundles
Closed, ResolvedPublic4 Estimated Story Points

Description

Following up from T329043: Improved support for transferring translations between wikis.

Currently the import script does not import metadata (priority, transclusion information) from the page being exported to the target wiki. It also does not mark the page for translation automatically. The user has to do this manually.

Update the script to import the metadata, and mark the page for translation automatically.

Automatically marking the page for translation would require refactoring the code that is present in PageTranslationSpecialPage into a separate service.

Event Timeline

Change 960183 had a related patch set uploaded (by Tacsipacsi; author: Tacsipacsi):

[mediawiki/extensions/Translate@master] Create MarkPage service

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

I’ve actually had a half-ready patch refactoring PageTranslationSpecialPage, which I now finished and submitted. I don’t plan to do the part that makes use of it in the import script, but hopefully my patch will make that easier.

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

[mediawiki/extensions/Translate@master] ImportTranslatableBundle: Mark page for translation automatically

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

abi_ triaged this task as Medium priority.
abi_ set the point value for this task to 4.

I decided to start work on this since we've been getting requests to move translatable pages across wikis, and having to mark them manually would be a lot of manual work

The values for metadata have to be provided as parameters to the script, it does not read them from the file exported by the exportTranslatableBundle script.

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

[mediawiki/extensions/Translate@master] TranslatableBundleImporter: Replace callback with AfterImportPageHook

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

Change 992641 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] ImportTranslatableBundle: Mark page for translation automatically

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

Change 995179 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] TranslatableBundleImporter: Replace callback with AfterImportPageHook

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

Tested on translatewiki.net with the following command:

php extensions/Translate/scripts/importTranslatableBundle.php ~/Local-TestTranslatablePage-2024-02-29.xml --user "Abijeet_Patro" --interwiki-prefix "mw" --comment "Test Import, please ignore" --disallow-transclusion --force-priority-languages --priority-languages fr,es,it,hi,hi --priority-languages-reason "Please dont translate to other stuff" --skip-translating-title

All the metadata related to the translatable page was imported properly