mirror of
https://github.com/pavlobu/deskreen.git
synced 2025-05-31 14:50:09 -07:00
remove remote from i18next.config.client
This commit is contained in:
parent
468bc83c9a
commit
143ec1644c
@ -1,7 +1,7 @@
|
|||||||
/* istanbul ignore file */
|
/* istanbul ignore file */
|
||||||
|
|
||||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||||
import { remote, ipcRenderer } from 'electron';
|
import { ipcRenderer } from 'electron';
|
||||||
import i18n from 'i18next';
|
import i18n from 'i18next';
|
||||||
import { initReactI18next } from 'react-i18next';
|
import { initReactI18next } from 'react-i18next';
|
||||||
import SyncBackend from 'i18next-node-fs-backend';
|
import SyncBackend from 'i18next-node-fs-backend';
|
||||||
@ -67,8 +67,8 @@ export const getShuffledArrayOfHello = (): string[] => {
|
|||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
const appPath = remote.getGlobal('appPath');
|
async function initI18NextOptions() {
|
||||||
|
const appPath = await ipcRenderer.invoke('get-app-path');
|
||||||
const i18nextOptions = {
|
const i18nextOptions = {
|
||||||
interpolation: {
|
interpolation: {
|
||||||
escapeValue: false,
|
escapeValue: false,
|
||||||
@ -95,12 +95,15 @@ const i18nextOptions = {
|
|||||||
wait: false,
|
wait: false,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
i18n.use(SyncBackend);
|
|
||||||
i18n.use(initReactI18next);
|
|
||||||
|
|
||||||
if (!i18n.isInitialized) {
|
if (!i18n.isInitialized) {
|
||||||
i18n.init(i18nextOptions);
|
i18n.init(i18nextOptions);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
initI18NextOptions();
|
||||||
|
|
||||||
|
i18n.use(SyncBackend);
|
||||||
|
i18n.use(initReactI18next);
|
||||||
|
|
||||||
i18n.on('languageChanged', () => {
|
i18n.on('languageChanged', () => {
|
||||||
ipcRenderer.send('client-changed-language', i18n.language);
|
ipcRenderer.send('client-changed-language', i18n.language);
|
||||||
|
@ -79,4 +79,9 @@ export default function initIpcMainHandlers(
|
|||||||
}
|
}
|
||||||
return '255.255.255.255';
|
return '255.255.255.255';
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcMain.handle('get-app-path', () => {
|
||||||
|
const deskreenGlobal = getDeskreenGlobal();
|
||||||
|
return deskreenGlobal.appPath;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user