diff --git a/src/browser/window-handler.ts b/src/browser/window-handler.ts index 678a4853..9c059599 100644 --- a/src/browser/window-handler.ts +++ b/src/browser/window-handler.ts @@ -199,7 +199,7 @@ export class WindowHandler { this.mainWindow.webContents.insertCSS( fs.readFileSync(path.join(__dirname, '..', '/renderer/styles/snack-bar.css'), 'utf8').toString(), ); - this.mainWindow.webContents.send('page-load', { isWindowsOS, resources: i18n.loadedResources }); + this.mainWindow.webContents.send('page-load', { isWindowsOS, locale: i18n.getLocale(), resources: i18n.loadedResources }); this.appMenu = new AppMenu(); this.monitorWindowActions(); // Ready to show the window diff --git a/src/common/i18n-preload.ts b/src/common/i18n-preload.ts index 266da385..5b08eccb 100644 --- a/src/common/i18n-preload.ts +++ b/src/common/i18n-preload.ts @@ -64,9 +64,11 @@ class Translation { /** * Keeps ref of loaded resources from the main process * - * @param resource + * @param locale {LocaleType} + * @param resource {JSON} */ - public setResource(resource: JSON): void { + public setResource(locale: LocaleType, resource: JSON): void { + this.locale = locale; this.loadedResources = resource; } diff --git a/src/renderer/preload-main.ts b/src/renderer/preload-main.ts index eae37fdf..1c3d504b 100644 --- a/src/renderer/preload-main.ts +++ b/src/renderer/preload-main.ts @@ -38,9 +38,9 @@ const createAPI = () => { createAPI(); // When the window is completely loaded -ipcRenderer.on('page-load', (_event, { isWindowsOS, resources }) => { +ipcRenderer.on('page-load', (_event, { isWindowsOS, locale, resources }) => { - i18n.setResource(resources); + i18n.setResource(locale, resources); if (isWindowsOS) { // injects custom window title bar