diff --git a/src/background.js b/src/background.js index 3bbc5beecb..a1f8926568 100644 --- a/src/background.js +++ b/src/background.js @@ -3,7 +3,7 @@ import querystring from 'querystring'; import url from 'url'; import jetpack from 'fs-jetpack'; import idle from '@paulcbetts/system-idle-time'; -import { app, ipcMain, Menu } from 'electron'; +import { app, ipcMain, BrowserWindow, Menu } from 'electron'; import autoUpdate from './background/autoUpdate'; import certificate from './background/certificate'; @@ -108,3 +108,22 @@ app.on('window-all-closed', () => { ipcMain.on('getSystemIdleTime', (event) => { event.returnValue = idle.getIdleTime(); }); + +ipcMain.on('show-about-dialog', () => { + getMainWindow().then((mainWindow) => { + const win = new BrowserWindow({ + title: i18n.__('About', app.getName()), + parent: mainWindow, + width: 400, + height: 300, + resizable: false, + maximizable: false, + minimizable: false, + center: true, + show: false, + }); + win.setMenuBarVisibility(false); + win.once('ready-to-show', () => win.show()); + win.loadURL(`file://${ __dirname }/public/about.html`); + }); +}); diff --git a/src/i18n/index.js b/src/i18n/index.js index 853b653434..99d242b88e 100644 --- a/src/i18n/index.js +++ b/src/i18n/index.js @@ -33,17 +33,26 @@ class I18n { * @constructor */ constructor() { - let dir = path.join(__dirname, '../i18n/lang'); - if (!fs.existsSync(dir)) { - dir = path.join(__dirname, 'i18n/lang'); - } - const defaultLocale = path.join(dir, 'en.i18n.json'); - loadedLanguage = JSON.parse(fs.readFileSync(defaultLocale, 'utf8')); - const locale = path.join(dir, `${ eApp.getLocale() }.i18n.json`); - if (fs.existsSync(locale)) { - const lang = JSON.parse(fs.readFileSync(locale, 'utf8')); - loadedLanguage = Object.assign(loadedLanguage, lang); + const load = () => { + let dir = path.join(__dirname, '../i18n/lang'); + if (!fs.existsSync(dir)) { + dir = path.join(__dirname, 'i18n/lang'); + } + const defaultLocale = path.join(dir, 'en.i18n.json'); + loadedLanguage = JSON.parse(fs.readFileSync(defaultLocale, 'utf8')); + const locale = path.join(dir, `${ eApp.getLocale() }.i18n.json`); + if (fs.existsSync(locale)) { + const lang = JSON.parse(fs.readFileSync(locale, 'utf8')); + loadedLanguage = Object.assign(loadedLanguage, lang); + } + }; + + if (eApp.isReady()) { + load(); + return; } + + eApp.once('ready', load); } /** diff --git a/src/i18n/lang/en.i18n.json b/src/i18n/lang/en.i18n.json index d81b09d4af..389cd1f7ab 100644 --- a/src/i18n/lang/en.i18n.json +++ b/src/i18n/lang/en.i18n.json @@ -47,6 +47,7 @@ "New_Version": "New Version:", "No": "No", "No_suggestions": "No suggestions", + "No updates are available.": "No updates are available.", "No_valid_server_found": "No valid server found at the URL", "Open_DevTools": "Open DevTools", "Open_Language_Dictionary": "Open Language Dictionary", diff --git a/src/i18n/lang/pt-br.i18n.json b/src/i18n/lang/pt-br.i18n.json index 0d87d4384a..9ff4a9a39c 100644 --- a/src/i18n/lang/pt-br.i18n.json +++ b/src/i18n/lang/pt-br.i18n.json @@ -44,6 +44,7 @@ "New_Version": "Nova Versão:", "No": "Não", "No_suggestions": "Sem sugestões", + "No updates are available.": "Não há atualizações disponíveis.", "No_valid_server_found": "Nenhum servidor válido encontrado neste endereço", "Open_DevTools": "Abrir DevTools", "Open_Language_Dictionary": "Abrir Dicionário Idioma", diff --git a/src/public/about.html b/src/public/about.html index ccb91e57a5..4dec9f3eb7 100644 --- a/src/public/about.html +++ b/src/public/about.html @@ -1,85 +1,20 @@
--