// 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') window.moment = require('moment') const { translations } = require('./strings') const settings = require('./settings') 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; Object.entries(settings).forEach(entry => { window[entry[0]] = entry[1]; });