Closed theomathieubhvr closed 7 years ago
Quick fix : clear every browser cache. But this should not happen in dev.
@theomathieubhvr I suppose you're using HMR
on spa build and I have exactly the same issue right here.
I digged it a little and found out that's more or less connected with copy-assets-webpack-plugin
and webpack-dev-server
.
It's a known issue with the HMR
; files copied through copy-assets-webpack-plugin
are not taken into account.
Rebuilding the project using npm run build:spa-dev
and then running npm run serve:spa
would definitely solve this problem.
On the other hand, if you're using ngx-cache
then the app seeks the cache (by default, should be local-storage) for i18n data. And yeah, clearing the cache (or just local-storage) would solve it.
Please feel free to to add anything if there're any points that I missed.
That's exactly it !
But in production, if I update my i18n keys, how can I force my users to reload their localstorage ?
Thanks !
You can set TTL (in terms of secs, ex: 300) right at the imports
section of you app.module
. I suppose there's no usage example on ngx-cache/core repository about TTL but see the cache.loader.ts
to what params to pass. Also, don't forget to set the expiry
param to undefined - otherwise it will override the TTL.
I'm submitting a ... (check one with "x")
Current behavior
When adding keys to i18n files, changes are not taken into account. This works well on universal server (dev + prod) but not with spa.
Thanks !
Expected/desired behavior
Keys should be translated when using {{'KEY' | translate}} and not showing KEY.
Minimal reproduction of the problem with instructions