You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
777 B
26 lines
777 B
// All of the Node.js APIs are available in the preload process. |
|
// It has the same sandbox as a Chrome extension. |
|
|
|
const { ipcRenderer } = require('electron'); |
|
const { translations } = require('./strings'); |
|
const settings = require('./settings'); |
|
const sjcl = require("./vendor/sjcl"); |
|
|
|
|
|
window.myLocale = (new Intl.NumberFormat()).resolvedOptions().locale; |
|
const simpleLocale = window.myLocale.split('-')[0]; |
|
|
|
if(translations[window.myLocale]) { |
|
window.strings = translations[window.myLocale]; |
|
} else if(translations[simpleLocale]) { |
|
window.strings = translations[simpleLocale]; |
|
} else { |
|
window.strings = translations['en'] |
|
} |
|
|
|
window.electronIpc = ipcRenderer; |
|
window.sjcl = sjcl; |
|
|
|
Object.entries(settings).forEach(entry => { |
|
window[entry[0]] = entry[1]; |
|
}); |