question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Observerable from TranslateService called only once

See original GitHub issue

I’m submitting a bug

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

Current behavior Function as parameter inside subscribe (translateService.get().subscribe()) called only once. In case of using translateService.get().subscribe() after change language function in subscribe never calls again

Expected/desired behavior Observerable from translateService.get(key) should be endless to be able to call subscribe after any changes which can affect return value for key.

Reproduction of the problem

  1. open plunker
  2. click Toogle lang button

AR1=ER1: text after “Pipe” changed AR2: text after “Service” not changed ER2: text after “Service” changed (AR - actual result \ current behavoir; ER - expected result \expected behavoir)

What is the motivation / use case for changing the behavior? Use case to make work translateService.get().subscribe() same as pipe or directive.

Please tell us about your environment:

  • ngx-translate version: 6.x.x

  • Angular version: 2.x.x

  • Browser: [all]

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5

github_iconTop GitHub Comments

5reactions
CodeAndWebcommented, Apr 24, 2018

Use .stream() instead of .get()

0reactions
yassernasccommented, Apr 23, 2018

any update about this missing feature?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ngx-translate .instant returns key instead of value
So you should use the get(messageKey) method to get the translation - it's asynchronous and returns an Observable : this.translateService.get(' ...
Read more >
Build your own custom-loader for translations in Angular8
The CustomLoader class should implement TranslateLoader and the only required method in it is getTranslation that must return an Observable. We ...
Read more >
@ngx-translate/core - Awesome JS
core/http-loader: add support for Angular v13 and RxJS 7 (3a4c7ee), ... TranslateService: compile translations only once (#956) (920b95d), closes #955.
Read more >
How to use Ngx-Translate in Angular? - Better Programming
You have 2 free member-only stories left this month. ... languages are spoken, you don't want to design a website that only targets...
Read more >
ngx-translate Documentation - CodeAndWeb
Covers: TranslateService API, Translate Pipe & Directive. ... Make sure you only call this method in the root module of your application, most...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found