File tree 3 files changed +9
-1
lines changed
3 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ const pDefer = require('p-defer')
3
3
const logger = require ( './common/logger' )
4
4
5
5
/**
6
- * @typedef { 'tray' | 'tray-menu-state' | 'tray.update-menu' | 'countlyDeviceId' | 'manualCheckForUpdates' | 'startIpfs' | 'stopIpfs' | 'restartIpfs' | 'getIpfsd' | 'launchWebUI' | 'webui' | 'splashScreen' } ContextProperties
6
+ * @typedef { 'tray' | 'tray-menu-state' | 'tray.update-menu' | 'countlyDeviceId' | 'manualCheckForUpdates' | 'startIpfs' | 'stopIpfs' | 'restartIpfs' | 'getIpfsd' | 'launchWebUI' | 'webui' | 'splashScreen' | 'i18n.initDone' } ContextProperties
7
7
*/
8
8
9
9
/**
Original file line number Diff line number Diff line change @@ -6,8 +6,10 @@ const Backend = require('i18next-fs-backend')
6
6
const store = require ( './common/store' )
7
7
const ipcMainEvents = require ( './common/ipc-main-events' )
8
8
const logger = require ( './common/logger' )
9
+ const getCtx = require ( './context' )
9
10
10
11
module . exports = async function ( ) {
12
+ const ctx = getCtx ( )
11
13
logger . info ( '[i18n] init...' )
12
14
await i18n
13
15
// @ts -expect-error
@@ -26,6 +28,7 @@ module.exports = async function () {
26
28
}
27
29
} )
28
30
logger . info ( '[i18n] init done' )
31
+ ctx . setProp ( 'i18n.initDone' , true )
29
32
30
33
ipcMain . on ( ipcMainEvents . LANG_UPDATED , async ( _ , lang ) => {
31
34
if ( lang === store . get ( 'language' ) ) {
Original file line number Diff line number Diff line change @@ -43,6 +43,11 @@ async function buildMenu () {
43
43
const stopIpfs = ctx . getFn ( 'stopIpfs' )
44
44
const launchWebUI = ctx . getFn ( 'launchWebUI' )
45
45
const manualCheckForUpdates = ctx . getFn ( 'manualCheckForUpdates' )
46
+ /**
47
+ * we need to wait for i18n to be ready before we translate the tray menu
48
+ * @type {boolean }
49
+ */
50
+ await ctx . getProp ( 'i18n.initDone' )
46
51
47
52
// @ts -expect-error
48
53
return Menu . buildFromTemplate ( [
You can’t perform that action at this time.
0 commit comments