Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add flattening #39

Merged
merged 7 commits into from
Jan 25, 2022
Merged

Add flattening #39

merged 7 commits into from
Jan 25, 2022

Conversation

samhh
Copy link
Contributor

@samhh samhh commented Jan 24, 2022

Closes #30.

This is a breaking change to the CLI interface (cc @Magellol). The new structure is:

$ intlc compile <file> -l <locale>
$ intlc flatten <file>

The flattening needs testing more robustly. I forged ahead given the bulk of the rest of the PR won't be affected by any changes in the flattening algorithm.

The JSON output is currently not prettified due to this issue in what would have been the natural choice. As-is using the linked library would cause the keys to be output as "umessage" and "ubackend" per the field names. We could workaround this by changing them in Translation and UnparsedTranslation but that feels hacky. Not sure on the right path forward.

The flattening stuff in the compiler is quite verbose. I'm planning to experiment with lenses soon to help with the general verbosity around working with these nested sum types. There may also be an optimisation we could make somewhere to the core data structures (parameterising streams?), but I suspect that'll be a lot more complex to solve.

@samhh samhh mentioned this pull request Jan 24, 2022
@samhh
Copy link
Contributor Author

samhh commented Jan 25, 2022

Going to merge and open a few issues relating to the above.

@samhh samhh merged commit 9eb0fbe into master Jan 25, 2022
@samhh samhh deleted the flatten branch January 25, 2022 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

--flatten
1 participant