Page MenuHomePhabricator

Special:ImportTranslations does not handle all Gettext parsing errors
Closed, ResolvedPublic2 Estimated Story Points

Description

Please import https://kizule.xyz/out-mantis-0-all_sr-el.po file for out-mantis-0-all (just for sr-el and I don't need to be provided with sr-ec file or something like that what I usually request for mediawiki group).

I was able to import the sr-ec file without any problems through Special:ImportTranslations. This one is giving me a hard time and throwing RuntimeException. Please import it server-side.

Steps to replicate the issue (include links if applicable):

  • Go to Special:ImportTranslations
  • Try to import the file which I provided

What happens?:
[5bfe49f3f3fba06f123a8109] 2025-05-19 21:40:04: Фатална грешка типа „RuntimeException”

What should have happened instead?:
Import should work without such errors.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):
/

Other information (browser name/version, screenshots, etc.):
/

Event Timeline

Kizule changed the subtype of this task from "Bug Report" to "Task".May 19 2025, 9:41 PM
Kizule moved this task from Backlog to System admin stuff on the translatewiki.net board.

Change #1148208 had a related patch set uploaded (by Nikerabbit; author: Nikerabbit):

[mediawiki/extensions/Translate@master] ImportTranslationsSpecialPage: Handle all Gettext errors

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

The file is incorrectly formatted, so server side import would give the same error. Here is the full error:

exception.ERROR: [b35af8a474f9e65a2f9e2cea] /wiki/Special:ImportTranslations   RuntimeException: Unable to parse msgstr:

msgctxt "s_project_delete_msg"
msgid "Are you sure you want to delete project \"%1$s\"?<br>This will also delete %2$s attached issue reports."
msgstr Da li ste sigurni da želite da obrišete projekat \"%1$s\"?<br>Ovim će biti obrisano %2$s prijavljenih problema na njemu."

Side note: I recommend against moving things to columns, as we triage from the backlog and may miss tickets that have been moved already.

With the patch it will look like this:

image.png (1×2 px, 133 KB)

The file is incorrectly formatted, so server side import would give the same error. Here is the full error:

exception.ERROR: [b35af8a474f9e65a2f9e2cea] /wiki/Special:ImportTranslations   RuntimeException: Unable to parse msgstr:

msgctxt "s_project_delete_msg"
msgid "Are you sure you want to delete project \"%1$s\"?<br>This will also delete %2$s attached issue reports."
msgstr Da li ste sigurni da želite da obrišete projekat \"%1$s\"?<br>Ovim će biti obrisano %2$s prijavljenih problema na njemu."

Side note: I recommend against moving things to columns, as we triage from the backlog and may miss tickets that have been moved already.

Thank you for letting me know, I made a fix, and I was able to import it now.

With the patch it will look like this:

image.png (1×2 px, 133 KB)

Thank you so much for this, it looks nice.

Latest version of the patch:

image.png (1×2 px, 118 KB)

Nice. ❤️

Nikerabbit renamed this task from Request for importing PO file for out-mantis-0-all to translatewiki.net to Special:ImportTranslations does not handle all Gettext parsing errors.May 22 2025, 7:17 AM

Change #1148208 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] ImportTranslationsSpecialPage: Handle all Gettext errors

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

Looks good on production too,