ngx-translate / core

The internationalization (i18n) library for Angular
MIT License
4.5k stars 571 forks source link

ngx-translate with nrwl #1082

Open BVSureshBabu opened 5 years ago

BVSureshBabu commented 5 years ago

Hi,

I am using ngx-translate with nrwl. It is working fine if I keep all translation file in app and loading all once. But I want to load translation files per lib lazily i.e whenever module loads that time I want to load translation files loaded in that lib. libs are lazyloaded. I am using below versions

"@nrwl/nx": "1.0.0",
"@ngx-translate/core": "9.1.1",
"@ngx-translate/http-loader": "2.0.1",
"@angular/compiler-cli": "5.2.7",

Please help me to achieve this. Thanks in advance.

Thanks & Regards, Suresh

chrismclarke commented 5 years ago

I'm trying to achieve the same, I suggest you open a question on stackoverflow to discuss there as I don't think this is an issue with the ngx-translate platform

Salahudeen commented 4 years ago

Hi,

I am using ngx-translate with nrwl. It is working fine if I keep all translation file in app and loading all once. But I want to load translation files per lib lazily i.e whenever module loads that time I want to load translation files loaded in that lib. libs are lazyloaded. I am using below versions

"@nrwl/nx": "1.0.0",
"@ngx-translate/core": "9.1.1",
"@ngx-translate/http-loader": "2.0.1",
"@angular/compiler-cli": "5.2.7",

Please help me to achieve this. Thanks in advance.

Thanks & Regards, Suresh

Did you find a solution for the same? I am also looking for a way to achieve the same...can you help?

eulersson commented 3 years ago

Same. I am using nx. Here's the further I have got. Still can't have the behaviour to really extend but I think I got pretty close, evolving from other people's StackBlitz.

For lazy-loaded modules with different translation loaders (loading .json from different files) it seems to be either (in the case of the lazy-loaded):

It's like I can't blend the two.

https://stackblitz.com/edit/translations-and-lazy-loading?file=README.md

vmagalhaes commented 1 year ago

@docwhite any updates of this?

eulersson commented 1 year ago

Sadly not @vmagalhaes. I ended up learning another tool called transloco.

vmagalhaes commented 1 year ago

Sadly not @vmagalhaes. I ended up learning another tool called transloco.

And did you have a better result with lib <> app interaction?

eulersson commented 1 year ago

@vmagalhaes yes you can craft it using what they call "scopes" https://ngneat.github.io/transloco/docs/lazy-load/scope-configuration/