diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 62db01c19..89a6f3ad5 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -96,19 +96,17 @@ export class AppComponent { */ ngOnInit(): void { this.storage.get('settings').subscribe((settings: Settings) => { - if ( - settings && - Object.keys(settings).length > 0 && - settings.epgUrl - ) { - this.translate.setDefaultLang(settings.language ?? 'en'); - this.electronService.ipcRenderer.send(EPG_FETCH, { - url: settings.epgUrl, - }); - this.snackBar.open('Fetch EPG data...', 'Close', { - verticalPosition: 'bottom', - horizontalPosition: 'right', - }); + if (settings && Object.keys(settings).length > 0) { + this.translate.use(settings.language ?? 'en'); + if (settings.epgUrl) { + this.electronService.ipcRenderer.send(EPG_FETCH, { + url: settings.epgUrl, + }); + this.snackBar.open('Fetch EPG data...', 'Close', { + verticalPosition: 'bottom', + horizontalPosition: 'right', + }); + } } }); } diff --git a/src/app/settings/settings.component.ts b/src/app/settings/settings.component.ts index c2bd70af7..0083b971a 100644 --- a/src/app/settings/settings.component.ts +++ b/src/app/settings/settings.component.ts @@ -134,6 +134,11 @@ export class SettingsComponent implements OnInit, OnDestroy { .set('settings', this.settingsForm.value) .subscribe(() => { this.settingsForm.markAsPristine(); + // check whether the epg url was changed or not + if (this.settingsForm.value.epgUrl) { + this.fetchEpg(); + } + this.translate.use(this.settingsForm.value.language); this.snackBar.open( this.translate.instant('SETTINGS.SETTINGS_SAVED'), null, @@ -141,13 +146,6 @@ export class SettingsComponent implements OnInit, OnDestroy { duration: 2000, } ); - // check whether the epg url was changed or not - if (this.settingsForm.value.epgUrl) { - this.fetchEpg(); - } - this.translate.setDefaultLang( - this.settingsForm.value.language - ); }) ); }