Page MenuHomePhabricator

Phabricator-translations should not extract strings from test cases
Closed, ResolvedPublic

Description

Per analysis at T363215

Upstream task: https://we.phorge.it/T15815

Event Timeline

Or I guess I could propose that exact patch on Wikimedia Gitlab if you don't want to wait for upstream.

Thanks for investing! IMO upstream first makes sense so I filed a ticket at https://we.phorge.it/T15815 , and after applying https://gerrit.wikimedia.org/r/c/phabricator/translations/+/1028887 in a local upstream Phorge checkout I can confirm your one-liner patch does what it should, yay.

@Pppery: Would you like to propose your one-liner in upstream, or do you want me to do that?

Quick commit message proposal for upstream:

Make i18n string extraction ignore strings in test case files

Summary:
Do not extract strings from test case files for localization / translation.
They are not exposed to users, and localizing wastes translators' time.

Closes T15815

Test Plan:
* Install Wikimedia downstream `translations` extension via `git clone https://gerrit.wikimedia.org/r/phabricator/translations` and put it on the same filesystem level as `phorge` and `arcanist`, and follow https://we.phorge.it/w/docs/extensions/install/
* Apply https://gerrit.wikimedia.org/r/c/phabricator/translations/+/1028887 on top, to make the `translations` extension work with upstream Phorge.
* In the downstream `translations` extension path, run `./export.sh`, then run `grep -r "__tests__" .` and get a list of `qqq.json` files with context for strings from test files.
* Apply this patch.
* In the downstream `translations` extension path, run `./export.sh`, then run `grep -r "__tests__" .` to verify that no `qqq.json` files include any strings from test files anymore.

if you don't want to wait for upstream.

I vaguely hope that in late May or in June we'll pull/rebase a more recent Phorge upstream release into Wikimedia Phabricator (because still quite some downstream cleanup work on my list first, once I get to it among a bunch of other things). So I'd wait for upstream here ideally

Updating the rPHTR repo with the new code will be tracked in T363188

For the records, we just pulled and deployed the 2024.19 upstream version in Wikimedia Phabricator.