Skip to content

Commit

Permalink
fix max dist translations
Browse files Browse the repository at this point in the history
  • Loading branch information
reZach committed Apr 21, 2021
1 parent 1dbc242 commit 89a0709
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
12 changes: 10 additions & 2 deletions app/localization/i18n.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,21 @@ const reactI18Next = require("react-i18next");
const i18nBackend = require("i18next-electron-fs-backend").default;
const whitelist = require("./whitelist");

// On Mac, the folder for resources isn't
// in the same directory as Linux/Windows;
// https://www.electron.build/configuration/contents#extrafiles
const path = require("path");
const isMac = process.platform === "darwin";
const isDev = process.env.NODE_ENV === "development";
const prependPath = isMac && !isDev ? path.join(process.resourcesPath, "..") : ".";

i18n
.use(i18nBackend)
.use(reactI18Next.initReactI18next)
.init({
backend: {
loadPath: "./app/localization/locales/{{lng}}/{{ns}}.json",
addPath: "./app/localization/locales/{{lng}}/{{ns}}.missing.json",
loadPath: prependPath + "/app/localization/locales/{{lng}}/{{ns}}.json",
addPath: prependPath + "/app/localization/locales/{{lng}}/{{ns}}.missing.json",
ipcRenderer: window.api.i18nextElectronBackend
},
debug: false,
Expand Down
12 changes: 10 additions & 2 deletions app/localization/i18n.mainconfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,20 @@ const i18n = require("i18next");
const backend = require("i18next-fs-backend");
const whitelist = require("./whitelist");

// On Mac, the folder for resources isn't
// in the same directory as Linux/Windows;
// https://www.electron.build/configuration/contents#extrafiles
const path = require("path");
const isMac = process.platform === "darwin";
const isDev = process.env.NODE_ENV === "development";
const prependPath = isMac && !isDev ? path.join(process.resourcesPath, "..") : ".";

i18n
.use(backend)
.init({
backend: {
loadPath: "./app/localization/locales/{{lng}}/{{ns}}.json",
addPath: "./app/localization/locales/{{lng}}/{{ns}}.missing.json"
loadPath: prependPath + "/app/localization/locales/{{lng}}/{{ns}}.json",
addPath: prependPath + "/app/localization/locales/{{lng}}/{{ns}}.missing.json"
},
debug: false,
namespace: "translation",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "secure-electron-template",
"version": "9.5.0",
"version": "9.5.1",
"description": "The best way to build Electron apps with security in mind.",
"private": true,
"main": "app/electron/main.js",
Expand Down

0 comments on commit 89a0709

Please sign in to comment.