Js-lingui: Allow nested JSON messages

Created on 11 Sep 2018  路  3Comments  路  Source: lingui/js-lingui

Is your feature request related to a problem? Please describe.
Allow nested JSON as messages

Describe the solution you'd like
As far as I can tell, the --minimal format flag only accepts a flat structure.

My current translation files are in the format:

```
{
"SystemArea1": {
"Label_1": "Hello world"
}
"SystemArea2": {
"Label_1": "Another message"
}
}
````

Describe alternatives you've considered
I've had to flatten them to work with Lingui. This works but causes unnecessary bloat in the translation file.

I may have missed something but can't see a way of doing this at the moment.

wontfix 馃挕new feature 馃摝 cli

Most helpful comment

Thanks for the clarification.

I may well take a look at this one then and submit a PR.

All 3 comments

Hi @charliedavison,
no, this is not supported at the moment.

If you're interested, feel free to write another file format, e.g: json-nested. I believe this should be pretty easy. Take a look at existing formats here https://github.com/lingui/js-lingui/tree/master/packages/cli/src/api/formats

Just a note: Compiled catalog is always a flat json. There's an planned improvement to minify message IDs #139 though.

Thanks for the clarification.

I may well take a look at this one then and submit a PR.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gitschwifty picture gitschwifty  路  3Comments

ImADrafter picture ImADrafter  路  4Comments

tkvw picture tkvw  路  6Comments

SilentImp picture SilentImp  路  7Comments

ccamusso picture ccamusso  路  7Comments