i18n and translating simple strings inside a Hydrogen store #1061
-
Hi! Almost finished development of our new store. We went from using the Storefront API and Gatsby, to a completely new Hydrogen 2.0 store. The CMS we are using is Sanity and this is where most of our translations are coming from as well. But there are some strings on the cart and account pages for instance, which we would like to translate as well. At first I came across the i18n(ext) packages everybody is using for translating their project but Hydrogen has already a i18n functionality, right? So what would be a great approach to translate those strings across the store? What I have done right now: root.tsx
And then in my components i will use useMatches to get the data from the root.
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Hi @DennisKraaijeveld there's many ways to do it, and we don't have an official example yet. Though it's a priority to get an example soon. |
Beta Was this translation helpful? Give feedback.
-
Hello there, |
Beta Was this translation helpful? Give feedback.
-
I made a simple example here:
3 packages: i18next, i18next-http-backend, react-i18next For autocompletion: |
Beta Was this translation helpful? Give feedback.
Hi @DennisKraaijeveld there's many ways to do it, and we don't have an official example yet. Though it's a priority to get an example soon.