-
-
Notifications
You must be signed in to change notification settings - Fork 764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why my next-i18next isnot working and even though translated content is written in json file instantly. #2109
Comments
Sorry, this is still not a minimal reproducible example... |
@adrai sorry here is the minimal reproducible example: https://drive.google.com/drive/folders/1f_wnaljymN24BgajcR50LK10tuBMu2w8?usp=sharing Sorry it couldn't be repo, i am authenticated on another account is pc and very tired to change it to this account |
@adrai either way it doesn't work :( Did it work on your side? Is my implementation correct? |
Yes, with 13.2.2 I don't get an error anymore. |
@adrai mate its not about the error, my main problem was not fetching latest json while the page refreshes |
That's because of 2 things:
|
@adrai thanks. but if I don't overide how will the json change and latest data is fetched? |
I don't know your use case, but normally the translation resources are not changed programmatically... but if your use case needs that, ok. |
@adrai mate thats what I am trying to tell. I am complete beginner to this. whats your recommendation for my use case: We have translations in the database. What I want is when user goes to /destinations, I want latest translation served to them. I understand other static contents doesn't change much(which we won't fetch and use statically) but for like getting latest destinations/products, I need that. |
Alternatively, you can create your custom i18next backend (https://www.i18next.com/misc/creating-own-plugins#backend) and use it similar to this: https://github.com/i18next/i18next-http-backend/tree/master/example/next |
@adrai thanks! I did came to your example previously. No time to create custom one. Is client side the only option for my case? |
no, the client side, is just an example. |
@adrai thank you very much! It worked. last question, how much effect will https://github.com/i18next/i18next-http-backend/tree/master/example/next have on SEO & performance, since we will have useEffect in each pages. Any suggestion to minimize the effects? |
As long as you use serverSideTranslations SEO should work... performance depends on your backend |
@adrai Thanks boss! |
@adrai mate is it possible to serve the translation from CDN itself? |
yes, you can serve the translations directly from the cdn (just define the used backends in the config accordingly), but this will generate a lot of requests on server and on client side... |
@adrai ahh man what to do then. With my previous process it seem its lots of trouble in production, with multi-instance, with writing in json files. |
Sorry, I can't code everything for you... |
Same problem here but my backend is inside next.js . |
🐛 Bug Report
As said in the title, the app doesn't get the latest content from json file. I have translations in database. For a page /product/3, I do serverside props, but it doesn't get latest json file.
To Reproduce
or at least steps to reproduce the behavior:
serverside props in the page:
that api file:
next-i18next.config.js:
Expected behavior
I want the latest json file loaded as soon as the api is called and json in changed, or when user goes to the page
// Paste the expected results here
Your Environment
The text was updated successfully, but these errors were encountered: