Page MenuHomePhabricator

Remove trailing whitespace from Phabricator message documentation
Closed, ResolvedPublic

Description

This is a continuation of T283327: Improve Phabricator translation synchronization process.

Every time message documentation is re-generated, all of message documentation shows as changed because there is trailing whitespace, which is not supported on translatewiki.net (because MediaWiki pages cannot have trailing whitespace).

Example:

"fcbde22d0f9ea64a": "Used in:\n\n[https://phabricator.wikimedia.org/source/phabricator/browse/wmf%252Fstable/src//applications/macro/controller/PhabricatorMacroViewController.php$161 PhabricatorMacroViewController.php:161]\n[https://phabricator.wikimedia.org/source/phabricator/browse/wmf%252Fstable/src//applications/macro/controller/PhabricatorMacroAudioController.php$101 PhabricatorMacroAudioController.php:101]\n"

Last \n is what causes trouble.

Event Timeline

Aklapper moved this task from To Triage to Misc on the Phabricator board.

Running grep -r "Used in:" . | grep "]\\\n\"," on a local checkout of https://gerrit.wikimedia.org/r/plugins/gitiles/phabricator/translations/+/refs/heads/wmf/stable I get zero matches (as a counter test, I manually changed a ]", to ]\n", and got one match). So I assume this is obsolete nowadays.

If I misunderstood something, please reopen.

We export qqq files and that removes the trailing spaces. The issue is when regenerating the qqq files outside translatewiki.net.

Aklapper reopened this task as Open.EditedOct 28 2023, 9:38 AM

Ah. Clear steps to reproduce for someone who knows nothing about the twn infrastructure would be welcome. Currently the entire Phab translations thingy is a blackbox to me.

That makes two of us :) I'd assume there is a script to regenerate the qqq files in the Phabricator translations repo or in Phabricator itself.

Looks like the relevant code that generate the qqq.json is at https://gerrit.wikimedia.org/r/plugins/gitiles/phabricator/translations/+/refs/heads/wmf/stable/src/management/TranslatewikiManagementExportWorkflow.php#302, which gets called via https://gerrit.wikimedia.org/r/plugins/gitiles/phabricator/translations/+/refs/heads/wmf/stable/export.sh

Although per the git history it hasn't been run since October 2021 (and then, of course T318763: Work out how to bring in new Phabricator translations again)

It would be technically straightforward to change the script to add a trim( ) call to the output of that function, but there's not much point when the upstream system is so broken and nobody with the ability to do anything seems to care.

For some reason I decided to step into this maze of broken windows anyway. Will post that patch to Gerrit soon, although since only four active people have the right to +2 patches to this repo, and they probably aren't checking for patches, don't expect it to get reviewed anytime soon.

Change 969515 had a related patch set uploaded (by Pppery; author: Pppery):

[phabricator/translations@wmf/stable] Avoid trailing newline in qqq.json

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

Change 969515 merged by Brennen Bearnes:

[phabricator/translations@wmf/stable] Avoid trailing newline in qqq.json

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