From 4d0dee0ae0c57a29e2de25b868461183da37e4f5 Mon Sep 17 00:00:00 2001 From: Alberto Iannaccone Date: Fri, 15 Apr 2022 09:49:27 +0200 Subject: [PATCH] set the current language on the localization provider --- .../src/browser/dialogs/settings/settings.tsx | 4 ++-- arduino-ide-extension/src/node/arduino-daemon-impl.ts | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/arduino-ide-extension/src/browser/dialogs/settings/settings.tsx b/arduino-ide-extension/src/browser/dialogs/settings/settings.tsx index 4abe6ba35..cc0dfa85f 100644 --- a/arduino-ide-extension/src/browser/dialogs/settings/settings.tsx +++ b/arduino-ide-extension/src/browser/dialogs/settings/settings.tsx @@ -278,9 +278,9 @@ export class SettingsService { // after saving all the settings, if we need to change the language we need to perform a reload // Only reload if the language differs from the current locale. `nls.locale === undefined` signals english as well if ( - currentLanguage !== nls.locale && - !(currentLanguage === 'en' && nls.locale === undefined) + currentLanguage !== (await this.localizationProvider.getCurrentLanguage()) ) { + await this.localizationProvider.setCurrentLanguage(currentLanguage); if (currentLanguage === 'en') { window.localStorage.removeItem(nls.localeId); } else { diff --git a/arduino-ide-extension/src/node/arduino-daemon-impl.ts b/arduino-ide-extension/src/node/arduino-daemon-impl.ts index e8ff9f27b..1ce6869e8 100644 --- a/arduino-ide-extension/src/node/arduino-daemon-impl.ts +++ b/arduino-ide-extension/src/node/arduino-daemon-impl.ts @@ -12,7 +12,6 @@ import { Event, Emitter } from '@theia/core/lib/common/event'; import { environment } from '@theia/application-package/lib/environment'; import { EnvVariablesServer } from '@theia/core/lib/common/env-variables'; import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application'; -import { LocalizationProvider } from '@theia/core/lib/node/i18n/localization-provider'; import { ArduinoDaemon, NotificationServiceServer } from '../common/protocol'; import { DaemonLog } from './daemon-log'; import { CLI_CONFIG } from './cli-config'; @@ -32,9 +31,6 @@ export class ArduinoDaemonImpl @inject(NotificationServiceServer) protected readonly notificationService: NotificationServiceServer; - @inject(LocalizationProvider) - protected readonly localizationProvider: LocalizationProvider; - protected readonly toDispose = new DisposableCollection(); protected readonly onDaemonStartedEmitter = new Emitter(); protected readonly onDaemonStoppedEmitter = new Emitter();