-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
Disable translations keys nesting #560
Comments
I looked a bit into the code and I have seen that making a change of "disabling nesting" is too much of refactoring, but i may have found a solution that could cover any case. @amannn If you think this is something you would like to support I could also create a PR to help you with most of the work. It's sad because I'm loving next-intl and its simplicity but I would also really like to have a flat structure 🥲 |
Hmm, the This was also discussed in #105 before. |
@amannn I see the problem. In my case I don't even need the namespace so I think I will fork the repo and remove the nesting logic completely. Unfortunately I will lose the lib updates but it is what it is I guess. Thanks for the reply. |
Hmm, I see! You can btw also use https://www.npmjs.com/package/patch-package to avoid a fork and allow for easier updates. I’ll keep an eye on this topic in case more people run into this! |
Thanks for the suggestion! I would certainly use that. I will keep an eye for changes on this topic but for the moment I will close this. |
I ran into the same problem... I'm working on an extremely dynamic app where strings are used multiple times on different components so keeping strings-as-keys approach solves string search and avoid duplicities. next-translate lib has an option to disable key nesting but does not support app router + SSG so we're looking for another lib and next-intl is amazing at SSG but lacks of key nesting customization. |
+1 |
Nested keys makes it hard to find which translations are being used. I expect translation keys being 1:1 copyable and findable in the code (ex. |
+1 |
Is your feature request related to a problem? Please describe.
I wanted to migrate from lingui.js and currently I really like using flat messages (instead of creating translations keys, I just use the whole translation text).
e.g.
Instead of
t('card.title')
i would havet('Welcome to my website. This is a subtitle')
(written in the default language) so that I don't have to spend time on making translations keys.I tried but it gave me an error because the '.' is used for nesting.
Describe the solution you'd like
Would it be possible to have a flag to disable this behavior?
I'm really loving using next-intl so it would be amazing to have also this small feature. Unfortunately it's the last thing that's "blocking" me to migrate all over to next-intl.
Describe alternatives you've considered
I haven't any other solution than using translation keys but I would really like to continue with "explicit" translations.
The text was updated successfully, but these errors were encountered: