ngx-translate / http-loader

A loader for ngx-translate that loads translations with http calls
MIT License
191 stars 69 forks source link

Waiting for the translations being loaded before translating #59

Closed millerf closed 5 years ago

millerf commented 5 years ago

Hi,

I am using a CustomLoader over http to get my translations (Angular 5).

Unfortunately, I am requesting some translations in a service at app launch, so the translations are done straight away, before the files are loaded.

Is there a way to tell the Translater to wait for the HttpLoader to be done before doing the translations?

I tried to look around on stackoverflow without success...

Thanks!

rokulis commented 5 years ago

I have encountered with same problem. @millerf, did you find the solution?

millerf commented 5 years ago

Yes, @taskiukas You can find it here on issue #517: https://github.com/ngx-translate/core/issues/517#issuecomment-299637956

Use the AppInitializer. In my case I prefered to have a "loader" on the AppComponent until the translate.use() is finished, in order not to have the feeling the app is stuck on a white screen...