Skip to content

Commit

Permalink
Enable i18next translations in newly created windows from Renderer pr…
Browse files Browse the repository at this point in the history
…ocess
  • Loading branch information
pczyzyk committed May 31, 2023
1 parent dfb2f5d commit d36acaa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/electron/main.js
Expand Up @@ -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
Expand All @@ -291,4 +294,4 @@ app.on("web-contents-created", (event, contents) => {
action: "allow"
};
});
});
});

0 comments on commit d36acaa

Please sign in to comment.