ing
This commit is contained in:
parent
a664e2cf0c
commit
80c6017ed0
|
@ -40,14 +40,15 @@ export class AppComponent implements OnInit, AfterContentInit, AfterViewInit, On
|
|||
this.showTitleBar = false;
|
||||
this.block = false;
|
||||
|
||||
// this.translateService.onLangChange.subscribe(() => {
|
||||
// this.changeDetector.detectChanges();
|
||||
this.translateService.addLangs(['en', 'ko']);
|
||||
this.translateService.setDefaultLang('en');
|
||||
// this.translateService.onLangChange.subscribe((e) => {
|
||||
// this.changeDetector.markForCheck();
|
||||
// });
|
||||
// this.translateService.onTranslationChange.subscribe(() => {
|
||||
// this.translateService.onTranslationChange.subscribe((e) => {
|
||||
// this.changeDetector.detectChanges();
|
||||
// });
|
||||
|
||||
this.translateService.setDefaultLang('en');
|
||||
|
||||
// const i18ns = ['en', 'ko'];
|
||||
// i18ns.forEach((lang) => {
|
||||
|
@ -67,6 +68,7 @@ export class AppComponent implements OnInit, AfterContentInit, AfterViewInit, On
|
|||
this.menuSubscription = this.electronProxyService.menuObservable()
|
||||
.pipe(
|
||||
map((name: MenuEvent) => {
|
||||
let requireDetectChanges = true;
|
||||
switch (name) {
|
||||
case 'show-about':
|
||||
this.displayAbout = true;
|
||||
|
@ -87,15 +89,23 @@ export class AppComponent implements OnInit, AfterContentInit, AfterViewInit, On
|
|||
this.displayPrint = true;
|
||||
break;
|
||||
case 'change-language-english':
|
||||
this.translateService.use('en');
|
||||
requireDetectChanges = false;
|
||||
this.translateService.use('en').pipe(take(1)).subscribe((res: any) => {
|
||||
__this.changeDetector.detectChanges();
|
||||
});
|
||||
break;
|
||||
case 'change-language-korean':
|
||||
this.translateService.use('ko');
|
||||
requireDetectChanges = false;
|
||||
this.translateService.use('ko').pipe(take(1)).subscribe((res: any) => {
|
||||
__this.changeDetector.detectChanges();
|
||||
});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
__this.changeDetector.detectChanges();
|
||||
if (requireDetectChanges) {
|
||||
__this.changeDetector.detectChanges();
|
||||
}
|
||||
}),
|
||||
catchError(error => {
|
||||
return of(error);
|
||||
|
|
|
@ -4,9 +4,7 @@ import { Observable, of } from 'rxjs';
|
|||
import { TranslateLoader } from '@ngx-translate/core';
|
||||
import { ElectronProxyService } from './electron-proxy.service';
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
})
|
||||
@Injectable()
|
||||
export class I18nService extends TranslateLoader {
|
||||
private prefix: string;
|
||||
private suffix: string;
|
||||
|
|
Loading…
Reference in New Issue
Block a user