Quick fix for i18n
Just use the english locale for now. Load locale data from the filesystem in the main process and pass it to the renderer preload script via ipc. Note that we need the locale data to be available by the time view scripts are loaded. // FREEBIE
This commit is contained in:
parent
88893079d2
commit
63657db3be
5 changed files with 51 additions and 12 deletions
13
main.js
13
main.js
|
@ -6,6 +6,7 @@ const url = require('url')
|
|||
const fs = require('fs')
|
||||
const autoUpdater = require('electron-updater').autoUpdater
|
||||
const autoUpdaterInterval = 60 * 60 * 1000;
|
||||
const ipc = electron.ipcMain;
|
||||
|
||||
app.setAppUserModelId('org.whispersystems.signal-desktop')
|
||||
|
||||
|
@ -47,12 +48,22 @@ function createWindow () {
|
|||
}
|
||||
})
|
||||
|
||||
// Load locale
|
||||
const locale = 'en'; // FIXME
|
||||
const localeData = JSON.parse(fs.readFileSync(path.join(__dirname, '_locales', locale, 'messages.json'), 'utf-8'))
|
||||
ipc.on('locale-data', function(event, arg) {
|
||||
event.returnValue = localeData;
|
||||
});
|
||||
|
||||
// and load the index.html of the app.
|
||||
mainWindow.loadURL(url.format({
|
||||
pathname: path.join(__dirname, 'background.html'),
|
||||
protocol: 'file:',
|
||||
slashes: true,
|
||||
query: { node_env: NODE_ENV }
|
||||
query: {
|
||||
node_env: NODE_ENV,
|
||||
locale: locale
|
||||
}
|
||||
}))
|
||||
|
||||
// Open the DevTools.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue