Notify electron of language changes

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
pull/21833/head
Michael Telatynski 2020-02-24 17:11:08 +00:00
parent 2bd32050fc
commit 9bcea0aeca
2 changed files with 8 additions and 0 deletions

View File

@ -162,4 +162,6 @@ export default class BasePlatform {
getEventIndexingManager(): BaseEventIndexManager | null {
return null;
}
async setLanguage(preferredLangs: string[]): Promise<void> {}
}

View File

@ -21,6 +21,7 @@ import request from 'browser-request';
import counterpart from 'counterpart';
import React from 'react';
import SettingsStore, {SettingLevel} from "./settings/SettingsStore";
import PlatformPeg from "./PlatformPeg";
// $webapp is a webpack resolve alias pointing to the output directory, see webpack config
import webpackLangJsonUrl from "$webapp/i18n/languages.json";
@ -285,6 +286,11 @@ export function setLanguage(preferredLangs) {
preferredLangs = [preferredLangs];
}
const plaf = PlatformPeg.get();
if (plaf) {
plaf.setLanguage(preferredLangs);
}
let langToUse;
let availLangs;
return getLangsJson().then((result) => {