You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an application is loaded initially the translations are compiled for every subscription to translateService.get on the current page because the translations are still pending when the observables are created.
loadingTranslations could be set to an observable returning the compiled translations (maybe by piping a map in getTranslation(). Keep the return value of the method the same observable but set loadingTranslations to an observable with the piped map)
Minimal reproduction of the problem with instructions
Current behavior
When an application is loaded initially the translations are compiled for every subscription to translateService.get on the current page because the translations are still pending when the observables are created.
The initial loading of the translations is triggered by calling translateService.setDefaultLang() in the app.component.ts. When translateService.get is called afterwards it re-compiles the translations in the subscription, because the initial loading is still pending (https://github.com/ngx-translate/core/blob/master/projects/ngx-translate/core/src/lib/translate.service.ts#L372).
Expected behavior
Translations are only compiled once.
How do you think that we should fix this?
loadingTranslations could be set to an observable returning the compiled translations (maybe by piping a map in getTranslation(). Keep the return value of the method the same observable but set loadingTranslations to an observable with the piped map)
Minimal reproduction of the problem with instructions
https://stackblitz.com/edit/github-kr4c1v
Every call to compile writes a message to the console
Environment
The text was updated successfully, but these errors were encountered: