Skip to content
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

Language file is loaded multiple times (once per each lazy-loaded module) #876

Open
Parez opened this issue Jun 24, 2018 · 2 comments
Open

Comments

@Parez
Copy link

Parez commented Jun 24, 2018

I've been struggling to set up ngx-translate with lazy-loading. In our application we don't need to create a separate translations file per module as the overall language file is not very big. We just want to use the same en.json for all modules.

I've started implementing lazy-loading. The original issue was that translations didn't work in lazy-loaded modules. Then I came up with a solution - to instantiate and configure TranslateService in a SharedModule (as I described here).

Now there is another problem I've noticed - this en.json file is loaded all over again for each lazy-loaded module. I've been trying out lots of different configurations. And for any of them - either translations are not shown (empty) or en.json is loaded multiple times.

Can anyone suggest a solution to this? Thank you.

Angular Version: 6.0.6
Ngx-translate Version: 10.0.2
@ngx-translate/http-loader: 3.0.1

@phsims
Copy link

phsims commented Jun 28, 2018

have you tried using a core module instead of shared?

@ShinRai1090
Copy link

ShinRai1090 commented Mar 11, 2021

Sorry for necro~ing this topic, but have seen something similar in my app.

Edit:
There seems to be some issue with the HTTP Loader, solution provided under Multiple HTTP requests worked for me - Custom Cached Loader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants