Replies: 1 comment 2 replies
-
Hey @jorgebef, that's perfectly fine from my perspective, great to hear if this works well for you! The If you export all messages from a single file, you probably want to ensure that this module is only used on the server side, but as far as I understand, that's already the case in your setup. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I've started needing i18n for a couple of projects and I've encountered the usage of JSON for the translation dictionaries.
However, they can get kind of extensive and are prone to errors when you update in the main language, but forget to update all the others, or mistype the key for the JSON object.
I would like to know if there is any inconvenience to use Typescript objects as the dictionary at all that I'm missing?
I've used TS objects for this purpose and I'm testing the RSC branch right now and it works just fine with it, while providing autocompletion and screaming at you if you forget to update any language or mistype any key for the dictionary objects.
For example, here is a
config.ts
file I use to set up the project and provide some useful types:Additionally, I use a global declaration to have type safety for the usage of the messages as it is described in the docs:
With both of these, I feel like the DX is almost unbeatable.
Please let me know if there are any inconveniences with using Typescript that I've missed or if it's worth changing the examples and/or docs to maybe encourage said usage instead of plain JSON objects.
Beta Was this translation helpful? Give feedback.
All reactions