Angular / ngx-translate Using separate translation in inner module does not work

Viewed 876

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 Answers

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.

Related