should the i18n packages be imported once globally, or in every component/server action where valibot is used #914
Answered
by
fabian-hiller
stefanprobst
asked this question in
Q&A
-
should the i18n packages be imported once globally, or in every component/server action where valibot is used? |
Beta Was this translation helpful? Give feedback.
Answered by
fabian-hiller
Nov 7, 2024
Replies: 1 comment 2 replies
-
It depends. Have you read our i18n guide? https://valibot.dev/guides/internationalization/ |
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
Ideally, you should only import the specific translations you need once, for example in the same file where you define your schemas. If you define your schemas on a per-route level, you should check that the translations are loaded correctly due to code splitting. There's no real harm in importing the translations more than once, so don't worry too much about it. But if you can only import them once, it's of course better. If a translation is imported twice, they will just overwrite each other.