From 8f1ea84eb66e4a3eb17fb55441ddb6ed328d5c8e Mon Sep 17 00:00:00 2001 From: Germain Souquet Date: Fri, 23 Apr 2021 17:11:45 +0100 Subject: [PATCH] Broadcast language change to ElectroPlatform --- src/BasePlatform.ts | 4 +++- .../views/settings/tabs/user/GeneralUserSettingsTab.js | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/BasePlatform.ts b/src/BasePlatform.ts index b6012d7597..b7bc502dca 100644 --- a/src/BasePlatform.ts +++ b/src/BasePlatform.ts @@ -258,7 +258,9 @@ export default abstract class BasePlatform { return null; } - setLanguage(preferredLangs: string[]) {} + async setLanguage(language: string) { + throw new Error("Unimplemented"); + } setSpellCheckLanguages(preferredLangs: string[]) {} diff --git a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js index b1ad9f3d23..861e5cb1f8 100644 --- a/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js +++ b/src/components/views/settings/tabs/user/GeneralUserSettingsTab.js @@ -192,7 +192,11 @@ export default class GeneralUserSettingsTab extends React.Component { SettingsStore.setValue("language", null, SettingLevel.DEVICE, newLanguage); this.setState({language: newLanguage}); - PlatformPeg.get().reload(); + const platform = PlatformPeg.get(); + if (platform) { + platform.reload(); + platform.setLanguage(newLanguage); + } }; _onSpellCheckLanguagesChange = (languages) => {