For this, GlotPress needs a new format class to enable exporting JSON files. Ideally, these would be compatible with the format Jed expects, but I can also see how this might not be ideal. If that's the case, translate.wordpress.org could always override/extend any JSON format in GlotPress.
Looking at #297 and existing formats, implementing this should be quite easy and I would be more than happy to work on a patch for this.
You might want to start this as a plugin and then we can look at integrating it in to core. Take a look at this plugin for an example.
I'd support it as part of core once all the details are worked out.
Thanks for your feedback. Set up https://github.com/swissspidy/glotpress-json now. Let's see where it goes :-)
The plugin I set up now has full test coverage and exports and imports data in the Jed 1.x format.
If anyone's got time to test it, that would be awesome.
@atimmer (Yoast) has successfully tested the plugin on their install. There was only one bug with plural forms which I've now fixed. The only difference between an exported POT file converted to JSON and a direct JSON export is some whitespace.
@swissspidy Could you clarify which JSON format the plugin supports?
I'm looking at https://github.com/mikeedwards/po2json#methods which lists four formats:
raw produces a "raw" JSON output
jed produces an output that is 100% compatible with Jed < 1.1.0
jed1.x produces an output that is 100% compatible with Jed >= 1.1.0
mf produces simple key:value output.
Is the plugin only for Jed?
The plugin currently only supports the Jed 1.x format. It would be easy to support the mf format though in a separate class. raw is simply the PO file in JSON, which I don't think is that useful. The old Jed format is similar to that, but not worth supporting IMHO as there is a new version.
Should this format then be called Jed(1x) and GP_Format_JSON used as a base class GP_Format_Jed1x extends GP_Format_JSON?
GP_Format_Jed1x extends GP_Format_JSON
Sure, that could work. Expect some results in time for today's meeting.
Thanks for changing the milestone 🎉