CrowdIn docs mention there is built-in support for react-intl’s ICU Message JSON format, but when I build+download translations, it appears to unnecessarily include English descriptions for all strings.
Example input:
"buttonCredits": {
"defaultMessage": "Credits",
"description": "Text shown on the button to open the credits message box"
},
Produced output:
"buttonCredits": {
"defaultMessage": "Разработчики",
"description": "Text shown on the button to open the credits message box"
}
Ideally, I would like to omit the “description” property for each message (messages are just properties of the root JSON object), i.e.:
I tried using the “Configurable JSON & YAML” tool, but aside from not apparently doing anything, it seems to be geared toward filtering JSON input, whereas I’m trying to filter the output.
I’ve spent quite a bit of time searching and I can’t seem to find a solution.
Anyone run into this? Got any suggestions?
Thanks!
Edit: My current plan is to just post-process the downloaded translations myself, but I suspect CrowdIn can do this for me… I just have to figure out how
We need to search for (note there should be 4 spaces before description but Discourse doesn’t show it below in preview…): ",\n "description": "(.*?)"\n
This sounds like what I need, but I can’t seem to get it to do anything. Does this run when I use the Translations → Build & Download button? Or do I need to go through some other entry point?
I setup a rule to change “description” to “hello”, and it doesn’t appear to modify the output JSON file at all, so I’m kind of stumped.
Ok, I figured it out. Adding a file processor or changing its configuration only affects translation files that have subsequently been updated, so I wasn’t seeing any effect because I wasn’t also modifying any translations.
Honestly, that’s not how I’d expect it to work. I wonder if that’s expected? Regardless, it’s easy to work around.
For the record, I ended up using a slightly different configuration:
Turns out some of my strings with values don’t work with the above regular expression, so I wouldn’t recommend anyone else copy it since it’s not robust!