Skip to content

Commit

Permalink
use electron reload command when changing language (arduino#953)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alberto Iannaccone authored Apr 14, 2022
1 parent 03a7527 commit a3640cf
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down Expand Up @@ -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>>();
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a3640cf

Please sign in to comment.