Closed theolampert closed 4 years ago
Humm... What's the point of using expo-localization plus i18n? Why not just i18n? Just thinking about what happen if we eject app from expo
I'm not sure it's the best way actually I just saw it in the docs. I think i18n does not concern itself with detetecting the device language / country / currency while expo-localization provides some abstraction for that. There might be another package less specific to expo though.
I don't understand much from the doc of i18n-js
: https://github.com/fnando/i18n-js
react-i18next
seems easier https://github.com/i18next/react-i18next
The ideal would be to have something like :
my-component
folder with inside my-component.tsx
and then a translation
folder with inside en.ts
,fr.ts
...
Translation file for e.g fr.ts
should look like :
export default { SAY_HELLO: 'Bonjour!' }
And then use it like this :
<Text>{t('SAY_HELLO')}</Text>
I'm not sure it's the best way actually I just saw it in the docs. I think i18n does not concern itself with detetecting the device language / country / currency while expo-localization provides some abstraction for that. There might be another package less specific to expo though.
Humm I see, let's use expo right now. Other packages I've seen need linking so we can't use them
Yeah I'm not super familiar with how to do it in RN / expo maybe it's straightforward to get the device locale and just use i18n-js
I can do a bit more research.
One possibility: https://docs.expo.io/versions/latest/sdk/localization/