signal-desktop/preload.js
lilia 63657db3be
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
2017-09-14 16:53:35 -07:00

13 lines
395 B
JavaScript

/*
* Pending electron 1.6.x
* const env = require('url').parse(window.location, true).query;
*/
window.env = {};
window.location.search.substring(1).split('&').forEach(function(variable) {
var pair = variable.split('=');
env[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]);
});
const ipc = require('electron').ipcRenderer
window.env.locale_json = ipc.sendSync('locale-data');