Skip to content

Commit

Permalink
translation loading timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
x87 committed Dec 3, 2022
1 parent a281014 commit 710ced6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion editor/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,20 @@ import { LibraryPageComponent } from './components/library-page/library-page.com
import { KNOWN_LANGUAGES } from './models';
import { DecisionTreeComponent } from './components/decision-tree/decision-tree.component';
import { ServiceWorkerModule } from '@angular/service-worker';
import { catchError, timeout } from 'rxjs/operators';
import { of } from 'rxjs';

class CustomTranslateLoader extends TranslateHttpLoader {
getTranslation(lang: string) {
return super.getTranslation(lang).pipe(
timeout(3000),
catchError(() => of({}))
);
}
}

export function HttpLoaderFactory(http: HttpClient) {
return new TranslateHttpLoader(http);
return new CustomTranslateLoader(http);
}

export function loadTranslations(
Expand Down

0 comments on commit 710ced6

Please sign in to comment.