Core: translation loader is not updating translations on change

Created on 27 Nov 2017  路  4Comments  路  Source: ngx-translate/core

I'm submitting a ... (check one with "x")

[ ] bug report => check the FAQ and search github for a similar issue or PR before submitting
[x] support request => check the FAQ and search github for a similar issue before submitting
[ ] feature request

Current behavior
I'm using a custom loader, similar to FIREBASE_EXAMPLE.md, to get translations from Firebase. But it seems like if I change the db (from the FB dashboard), the changes are not reflected in the views.

Expected/desired behavior
The changes should be reflected when the translations observable emits.

Reproduction of the problem
If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar. You can use this template as a starting point: http://plnkr.co/edit/tpl:XXwyUYS6ZL7qVD9I2l0g

What is the expected behavior?

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • ngx-translate version: 9.0.1

  • Angular version: 5.0.3

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]

Most helpful comment

This is important to fix as there are scenarios where you may wan to load a LocalStorage based default translation before retrieving the one from Firebase, which could have a visible delay. Also applies to PWA scenario.

All 4 comments

It won't reflect the changes from the Observable AngularFireDatabase.object() because it only takes the first emitted value.

At lib/src/translate.service.ts:267, the TranslationService.getTranslation() uses take(1) from RxJS.

Please, feel free to implement the solution and submit MR.

This is important to fix as there are scenarios where you may wan to load a LocalStorage based default translation before retrieving the one from Firebase, which could have a visible delay. Also applies to PWA scenario.

It won't reflect the changes from the Observable AngularFireDatabase.object() because it only takes the first emitted value.

At lib/src/translate.service.ts:267, the TranslationService.getTranslation() uses take(1) from RxJS.

Please, feel free to implement the solution and submit MR.

@alexndreazevedo I would like this to be in the library as well. I have a slightly less intrusive solution open in a PR right now. It would be great if either the solution that @kkotak implemented (#777) or the one I implemented (#1028) could be merged

@MKhowaja, I'm not actively contributing to the library. Please address it to some active contributor: https://github.com/ngx-translate/core/graphs/contributors

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bjornharvold picture bjornharvold  路  3Comments

webprofusion-chrisc picture webprofusion-chrisc  路  4Comments

louisdoe picture louisdoe  路  3Comments

rbaumi picture rbaumi  路  4Comments

alkemist picture alkemist  路  3Comments