Hi @IbenTesara
I've noticed something that might need a different approach.
This issue happens when I change routes, mostly when that route-change is to a route that has a resolver in charge of the data.
Step 1: The resolver triggers the this.i18nService.initI18n method:
|
return this.i18nService.initI18n(this.i18nService.currentLanguage).pipe( |
Step 2: The initI18n method will then trigger the this.translateService.reloadLang method:
https://github.com/IbenTesara/opensource/blob/main/libs/angular/i18n/src/lib/services/i18n/i18n.service.ts#L57
Step 3: The reloadLang method will trigger the this.store.deleteTranslations action:
https://github.com/ngx-translate/core/blob/44b22d641ae350c0035bbddaf1091f53ec29a176/projects/ngx-translate/src/lib/translate.service.ts#L1012
So the translations of the current page (before navigation has ended) are being unloaded when fetching the translations for the next page. This creates a very short window in which the current page is visible with the translation paths/markers instead of the corresponding translation strings.
I don't have a clear fix in mind yet, but maybe we should let the new translations live next to the old ones, and only switch them out when the navigation has ended?
What do you think?
Hi @IbenTesara
I've noticed something that might need a different approach.
This issue happens when I change routes, mostly when that route-change is to a route that has a resolver in charge of the data.
Step 1: The resolver triggers the
this.i18nService.initI18nmethod:opensource/libs/angular/i18n/src/lib/resolvers/i18n/i18n.resolver.ts
Line 30 in d806eec
Step 2: The
initI18nmethod will then trigger thethis.translateService.reloadLangmethod:https://github.com/IbenTesara/opensource/blob/main/libs/angular/i18n/src/lib/services/i18n/i18n.service.ts#L57
Step 3: The
reloadLangmethod will trigger thethis.store.deleteTranslationsaction:https://github.com/ngx-translate/core/blob/44b22d641ae350c0035bbddaf1091f53ec29a176/projects/ngx-translate/src/lib/translate.service.ts#L1012
So the translations of the current page (before navigation has ended) are being unloaded when fetching the translations for the next page. This creates a very short window in which the current page is visible with the translation paths/markers instead of the corresponding translation strings.
I don't have a clear fix in mind yet, but maybe we should let the new translations live next to the old ones, and only switch them out when the navigation has ended?
What do you think?