From a26a1d609cf9922913b897645d72299cdf211338 Mon Sep 17 00:00:00 2001 From: Vishwas Shashidhar Date: Tue, 19 Jun 2018 20:26:04 +0530 Subject: [PATCH] ELECTRON-519: support Japanese localization for menus, dialogs and windows (#401) - add basic localisation implementation for menu items - add more strings to support localisation on menus - add more strings to support localisation on menus - add all menu items for localisation - refactor i18n code - Add localization for screen picker, basic auth and notification settings child windows - Add localization bridge - add i18n support to more strings - update translations - add events to change language and redo menu template - move config update logic to windowMgr - fix linting issues and refactor - add snipping tool messages --- .gitignore | 3 +- js/aboutApp/index.js | 5 +- js/basicAuth/basic-auth.html | 17 +- js/basicAuth/index.js | 7 +- js/basicAuth/renderer.js | 12 + js/desktopCapturer/index.js | 7 +- js/desktopCapturer/renderer.js | 24 +- js/desktopCapturer/screen-picker.html | 14 +- js/dialogs/showCertError.js | 5 +- js/dialogs/showLoadError.js | 7 +- js/enums/api.js | 3 +- js/mainApiMgr.js | 12 +- js/menus/menuTemplate.js | 520 ++++++++++-------- ...configure-notification-position-preload.js | 12 + .../configure-notification-position.html | 22 +- .../configure-notification-position.js | 4 +- js/preload/preloadMain.js | 12 + js/translation/i18n.js | 22 + js/windowMgr.js | 51 +- locale/en-US.json | 97 ++++ locale/en.json | 97 ++++ locale/ja-JP.json | 104 ++++ locale/ja.json | 97 ++++ 23 files changed, 859 insertions(+), 295 deletions(-) create mode 100644 js/translation/i18n.js create mode 100644 locale/en-US.json create mode 100644 locale/en.json create mode 100644 locale/ja-JP.json create mode 100644 locale/ja.json diff --git a/.gitignore b/.gitignore index 7d0a2cbf..47d85b35 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,5 @@ installer/win/Symphony-x86-cache installer/win/Symphony-x86-SetupFiles package-lock.json library -*.log \ No newline at end of file +*.log +js/translation/*_missing.json \ No newline at end of file diff --git a/js/aboutApp/index.js b/js/aboutApp/index.js index 43980d3e..c06c06fc 100644 --- a/js/aboutApp/index.js +++ b/js/aboutApp/index.js @@ -8,6 +8,7 @@ const log = require('../log.js'); const logLevels = require('../enums/logLevels.js'); const buildNumber = require('../../package.json').buildNumber; const { initCrashReporterMain, initCrashReporterRenderer } = require('../crashReporter.js'); +const i18n = require('../translation/i18n'); let aboutWindow; @@ -90,8 +91,8 @@ function openAboutWindow(windowName) { aboutWindow.webContents.on('crashed', function () { const options = { type: 'error', - title: 'Renderer Process Crashed', - message: 'Oops! Looks like we have had a crash.', + title: i18n.getMessageFor('Renderer Process Crashed'), + message: i18n.getMessageFor('Oops! Looks like we have had a crash.'), buttons: ['Close'] }; diff --git a/js/basicAuth/basic-auth.html b/js/basicAuth/basic-auth.html index fd5ea733..5291ef37 100644 --- a/js/basicAuth/basic-auth.html +++ b/js/basicAuth/basic-auth.html @@ -2,12 +2,13 @@ - Authentication Request +