-
Notifications
You must be signed in to change notification settings - Fork 371
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
JSON translations don't work in SSR Spartacus 4.x #14372
Comments
seeking feedback from dev time, will come back soon |
No simple answer for this ticket from top of my head. I’ll need to dive and debug. |
Hello, a coworker of mine find out this possible solution related to i18next configuration In So here's the code:
I hope this might help. |
I confirm it's a bug. The JSON translations work in CSR, but don't work OOTB in SSR:
To reproduce in our repo: config: i18n: {
- resources: translations,
+ backend: {
+ loadPath: 'assets/i18n-assets/{{lng}}/{{ns}}.json',
+ },
} |
Hi @fgrecchi-aswatson. I confirm, the fix is to set Detailed results of investigation:
Since This is a priority task now. |
Previously, the periodical reloading of JSON translations in SSR was enabled by default by `i18next-http-backend`. The never-ending async task `setInterval()` invoked inside `i18next-http-backend` caused the SSR to hang. To prevent it, we're setting explicitly `reloadInterval: false` in the options of `i18next`. fixes #14372
…ort to 4.3.x] (#15319) Previously, the periodical reloading of JSON assets in SSR was enabled by default by `i18next-http-backend`. The never-ending async task `setInterval()` invoked inside `i18next-http-backend` caused the SSR to hang. To prevent it, we're setting explicitly `reloadInterval: false` in the options of `i18next`. fixes #14372 it's a backport of PR #15297 to 4.3.x
For reference: |
Hello,
I am opening a bug after creating a topic here.
I have implemented the Lazy Loading of the translations as in this guide. If I run the application in SSR mode it always falls back in CSR, even if I increase the timeout to over 1 minute.
If I remove the backend configuration and restore the static files, the SSR works fine.
This issue occurs on both version 4.1 and 4.2 of Spartacus.
Steps to reproduce:
(I am using of course mine SAP Cloud baseUrl)
Change the file
src/app/spartacus/spartacus-configuration.module.ts
in this way (as per the documentation):Then finally run
And when you open the application in the browser it will fall back in the CSR mode without any error on server side.
If you revert the spartacus-configuration.module.ts and re-build and re-run the application, SSR works fine.
I have created a simple repo that reproduces the error: https://github.com/fgrecchi-aswatson/spartacus-ssr-issue
Thanks
Filippo Grecchi
The text was updated successfully, but these errors were encountered: