mirror of
https://github.com/pavlobu/deskreen.git
synced 2025-05-29 13:50:08 -07:00
remove remote from i18next.config.client
This commit is contained in:
parent
468bc83c9a
commit
143ec1644c
@ -1,7 +1,7 @@
|
||||
/* istanbul ignore file */
|
||||
|
||||
/* eslint-disable @typescript-eslint/ban-ts-comment */
|
||||
import { remote, ipcRenderer } from 'electron';
|
||||
import { ipcRenderer } from 'electron';
|
||||
import i18n from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
import SyncBackend from 'i18next-node-fs-backend';
|
||||
@ -67,9 +67,9 @@ export const getShuffledArrayOfHello = (): string[] => {
|
||||
return res;
|
||||
};
|
||||
|
||||
const appPath = remote.getGlobal('appPath');
|
||||
|
||||
const i18nextOptions = {
|
||||
async function initI18NextOptions() {
|
||||
const appPath = await ipcRenderer.invoke('get-app-path');
|
||||
const i18nextOptions = {
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
@ -94,14 +94,17 @@ const i18nextOptions = {
|
||||
react: {
|
||||
wait: false,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
if (!i18n.isInitialized) {
|
||||
i18n.init(i18nextOptions);
|
||||
}
|
||||
}
|
||||
initI18NextOptions();
|
||||
|
||||
i18n.use(SyncBackend);
|
||||
i18n.use(initReactI18next);
|
||||
|
||||
if (!i18n.isInitialized) {
|
||||
i18n.init(i18nextOptions);
|
||||
}
|
||||
|
||||
i18n.on('languageChanged', () => {
|
||||
ipcRenderer.send('client-changed-language', i18n.language);
|
||||
});
|
||||
|
@ -79,4 +79,9 @@ export default function initIpcMainHandlers(
|
||||
}
|
||||
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