Discovered while working on T318763 - the scripts that produce JSON files from the Phabricator repo produce JSON files indented with two space (which is hardcoded somewhere along the line in Arcanist), whereas translatewiki produces JSON files indented with one tab. Since both scripts update qqq.json, this produces inconsistencies and dirty diffs that should be fixed.
Description
Details
Subject | Repo | Branch | Lines +/- | |
---|---|---|---|---|
Export source strings again so en.json is indented with tabs | phabricator/translations | wmf/stable | +60 K -60 K |
Related Objects
Event Timeline
indented with two space (which is hardcoded somewhere along the line in Arcanist)
That seems to be return str_repeat(' ', $depth); in https://phabricator.wikimedia.org/source/arcanist/browse/wmf%252Fstable/src/parser/PhutilJSON.php$146-159 .
I'm curious if we could simply overwrite that with a tab or if in theory anything could break (which shouldn't).
aklapper opened https://gitlab.wikimedia.org/repos/phabricator/arcanist/-/merge_requests/3
Indent JSON files with tab instead of two spaces
Tested https://gitlab.wikimedia.org/repos/phabricator/arcanist/-/merge_requests/3 by going to http://phorge.localhost/file and uploading a random JSON file and checking the rendering.
Before, using upstream return str_repeat(' ', $depth); :
After, using custom return str_repeat("\t", $depth); :
I guess we have a trade-off here between reading JSON on smaller screens versus making translatewiki.net happier.
aklapper merged https://gitlab.wikimedia.org/repos/phabricator/arcanist/-/merge_requests/3
Indent JSON files with tab instead of two spaces
Change #1049599 had a related patch set uploaded (by Pppery; author: Pppery):
[phabricator/translations@wmf/stable] Export source strings again so en.json is indented with tabs
Change #1049599 merged by Aklapper:
[phabricator/translations@wmf/stable] Export source strings again so en.json is indented with tabs
I guess we have a trade-off here between reading JSON on smaller screens versus making translatewiki.net happier.
CSS tab-size can be used here if desired.
Also, this seems like something that should be less opinionated in a CMS and otherwise dictated by a language's rules. Some default is probably reasonable, but probably this should be a config option upstream.