8
votes

What we want to do

Use a separate translateLoader that loads it's own translations for a certain module in our app.

What we have tried

Al lot of different combinations of TranslateModule.forChild/TranslateModule.forRoot, with or without isolate: true

Plunker to show the issue

https://embed.plnkr.co/iw7fnwRwK0BbySVKxnZd/

Are we doing something wrong or is this an issue in ngx-translate?

p.s. I have posted the same issue in the GitHub issues of ngx-translate: https://github.com/ngx-translate/core/issues/682

1
Would be awesome if someone knew a solution for that. Right now I'm building my custom tranlsator (simple JSON file), but it would be nice to have an out of the box solution.dave0688
it would be great indeed since ngx-translate developer hasn't provided any hint about.Bruno Bruzzano
Wilgert, did you find an answer for this?alphapilgrim
Unfortunately not.Wilgert
Migrate to transloco and you will get everything for free.undefined

1 Answers

0
votes

Is the inner module lazy loaded? All services provided in an eagerly loaded module are global and singleton (basically the same as providing them in AppModule).... the same goes for any services provided in modules that are imported in these modules.... Therefore, importaing TranslateModule in an eagerly loaded module will use the same instance of the service that already exists.You can try appending the definitions, and use nesting in your resulting JSON.... or if possible, switch your child module to be lazy loaded.