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

1

9

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

Variegation answered 26/9, 2017 at 8:42 Comment(5)
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.Levania
it would be great indeed since ngx-translate developer hasn't provided any hint about.Roadside
Wilgert, did you find an answer for this?Uke
Unfortunately not.Variegation
Migrate to transloco and you will get everything for free.Klemm
P
0

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.

Phosphorite answered 11/4, 2019 at 13:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.