From d36acaa163f651e2da1cd93895fd9faa56ae4525 Mon Sep 17 00:00:00 2001 From: Piotr Date: Wed, 31 May 2023 08:34:12 +0200 Subject: [PATCH] Enable i18next translations in newly created windows from Renderer process --- app/electron/main.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/app/electron/main.js b/app/electron/main.js index d4fb124..b2a6136 100644 --- a/app/electron/main.js +++ b/app/electron/main.js @@ -266,7 +266,10 @@ app.on("web-contents-created", (event, contents) => { // Disable Node.js integration webPreferences.nodeIntegration = false; }); - + // enable i18next translations in popup window + contents.on("did-create-window", (window) => { + i18nextBackend.mainBindings(ipcMain, window, fs); + }); // https://electronjs.org/docs/tutorial/security#13-disable-or-limit-creation-of-new-windows // This code replaces the old "new-window" event handling; // https://github.com/electron/electron/pull/24517#issue-447670981 @@ -291,4 +294,4 @@ app.on("web-contents-created", (event, contents) => { action: "allow" }; }); -}); \ No newline at end of file +});