use electron reload command when changing language (#953)

This commit is contained in:
Alberto Iannaccone 2022-04-14 09:38:23 +02:00 committed by GitHub
parent 03a75273e3
commit a3640cf812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -15,8 +15,9 @@ import {
FileSystemExt,
Network,
} from '../../../common/protocol';
import { nls } from '@theia/core/lib/common';
import { CommandService, nls } from '@theia/core/lib/common';
import { AsyncLocalizationProvider } from '@theia/core/lib/common/i18n/localization';
import { ElectronCommands } from '@theia/core/lib/electron-browser/menu/electron-menu-contribution';
export const EDITOR_SETTING = 'editor';
export const FONT_SIZE_SETTING = `${EDITOR_SETTING}.fontSize`;
@ -82,6 +83,9 @@ export class SettingsService {
@inject(AsyncLocalizationProvider)
protected readonly localizationProvider: AsyncLocalizationProvider;
@inject(CommandService)
protected commandService: CommandService;
protected readonly onDidChangeEmitter = new Emitter<Readonly<Settings>>();
readonly onDidChange = this.onDidChangeEmitter.event;
protected readonly onDidResetEmitter = new Emitter<Readonly<Settings>>();
@ -282,7 +286,7 @@ export class SettingsService {
} else {
window.localStorage.setItem(nls.localeId, currentLanguage);
}
window.location.reload();
this.commandService.executeCommand(ElectronCommands.RELOAD.id);
}
return true;