title: Update translations in loader of ngx-translate
body: <p>I am creating a custom Angular ngx-translate Loader which either gets translations from cache or from an API. The point where I am stuck is Case 2 (see code below):</p>
  
  <p>Desired procedure:</p>
  
  <ol>
  <li>gets translations from cache (sync)</li>
  <li>returns cached translations (via observer)</li>
  <li>gets translations from api (async)</li>
  <li>compares cache and api (finds difference)</li>
  <li>sends updated version of translations  &lt;-- How?</li>
  </ol>
  
  <p>This is what I got:</p>
  
  <pre><code>getTranslation(lang: string): Observable&lt;any&gt; {
      return new Observable(observer =&gt; {
  
        // get translations from cache + start getting translations from API
        const cachedTranslations = this.cacheService.getTranslation(lang);
        const apiTranslations = this.http.get(environment.translationApi + lang);
  
  
        if (cachedTranslations) {
          // CASE #1: return cached translations
          observer.next(cachedTranslations);
        }
  
        apiTranslations.subscribe(translations =&gt; {
          // CASE #2: if cached translations are not up to date
          // or dont exist, add new translations and reload lang
          if (JSON.stringify(translations) !== JSON.stringify(cachedTranslations)) {
            this.cacheService.setTranslations(lang, translations);
            observer.next(translations);
          }
  
          observer.complete();
        }, () =&gt; {
          observer.complete();
        });
  
      });
  }
  </code></pre>
  
  <p>Using <code>observer.next()</code> works only once, even if it isn't completed yet. So how do I update the translations in Case 2 where an <code>observer.next()</code> already happend in Case 1?</p>