opral / inlang-paraglide-js

Tree-shakable i18n library build on the inlang ecosystem.
https://inlang.com/m/gerre34r/library-inlang-paraglideJs
42 stars 0 forks source link

nested keys in json files are not recognized #48

Closed palufra90 closed 6 months ago

palufra90 commented 6 months ago

Context: Astro app with paraglide and astro adapter an en.json file with { "hello": {"world": "Hello World"}, } gives the warning "WARN No messages found - Skipping compilation into ./src/paraglide", without compiling the localized file, while the same project with { "hello_world": "Hello World", } works correctly.

LorisSigrist commented 6 months ago

Nested keys aren't supported, as it makes it way harder for automated tooling (like the Sherlock IDE Extension) to interact with the messages. It also avoids discussions of how to organize messages (If you've ever had those you know how frustrating they are).

We recommend a flat structure for your messages using underscores for separation. I know this is a bit of a departure from how most libraries do it, but give it a try. Most people end up preferring the flat structure.

I agree that the error message is bad. It doesn't really tell you what's going on. We should change that

palufra90 commented 6 months ago

Thank you for the answer. Is it documented somewhere? It took me a lot to find that this was the issue

LorisSigrist commented 6 months ago

Actually I think it might not be. I'll update the documentation to mention it explicitly