Closed Namnika closed 10 months ago
regarding the array, you need to pass the joinArrays option:
i18next.t('arrayJoinWithInterpolation', { myVar: 'interpolate', joinArrays: ' ' });
Regarding the load and whitelist option:
The whitelist option does not exist anymore, use supportedLngs: https://www.i18next.com/misc/migration-guide#removed-deprecated And yes, you can have load and supportedLngs
Hi @adrai Thanks for your quick response! Yes, I used supportedLngs.
But I'm still getting this title
like this not the translation even in localStorage too!
sample : I did like this
<h4>{t("title", { title: "interpolate", joinArrays: " " })}</h4>
What I'm doing wrong? Thank you.
I don't understand exactly what you're trying to do, and where your translations should get from, but here you have an example: https://codesandbox.io/p/sandbox/cocky-hertz-vhm6sd
I think your issue is not related to the localstorage-backend or the http-backend at all
If you just show the data you receive (title, body, etc...), why do you need i18next for that? Simply display your data. i18next will not magically translate that data for you.
Thankyou. but sorry for misunderstanding, now I got the point like dynamically i18next can't translate the data. yes, I actually did to simply show the data.
but I am wondering will open ai can give something like dynamic translation or any other lib?
can you pls suggest actually I want to give the translated data to user when they change the language
option to get in multiple languages.
Normally, you have 3 options: Option 1) integrate an external service and translate on-the-fly (like google translate api etc...) Option 2) use a CMS and have your data there and translate it there or have your data translated already in your server side (or wherever the data is coming from) Option 3) move all your data out to an external TMS (like locize) and integrate that one with i18next to directly receive the translated content. (you still need to translate that content somehow in locize, with machine translations or manually, etc...)
🐛 Bug Report
Hi all, I'm facing problem related to this same issue #48 , but I have set my
locales
to my public dir, so there is no in-memory translation resources. I read all docs and closed issues even i18next-localstorage-backend and halfway I am stuck on how to get the translations in localStorage.I'm using
react-i18next
,i18next-browser-languagedetector
,i18next-http-backend
,i18next-localstorage-backend
andi18next-chained-backend
.So here is my process:
To Reproduce
my i18n.js config file:
translation.json:
I saw this
from Objects and Arrays and tried like this
interpolation {{myvar}}
but doesn't work for me.Demo.js:
This what I'm getting some changes in my localStorage:
Also, have one more question, Is it okay to use both
load
andwhitelist
or one of them? Can you give some suggestions on this issue?Expected behavior
I am expecting to get translations in localstorage.
Your Environment