Skip to content

Conversation

sagittarius-rev
Copy link

When use the use() method of TranslateService to load an invalid language, it will result nothing. For example, the file assets/i18n/vvvv.json does not exist, so the "vvvv" language is invalid:

this.translateService.use('vvvv').pipe(
  mapTo(true),
  catchError(() => Observable.of(false)),
).subscribe((isSuccess: boolean) => console.warn('isSuccess: ', isSuccess));

The code above will not output anything.

Because there is an uncaught error within the use() method:

      pending.pipe(take(1))
        .subscribe((res: any) => {
          this.changeLang(lang);
        });

If the language file is missing, this code will break the running, the other subscribers of pending will be halt, missing the data of next(), error() or complete().

Adding a void error handler will fix this bug.

@ocombe
Copy link
Member

ocombe commented Feb 5, 2020

Hello, could you rebase your PR and add a test for that change please? thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants