Fix Localisation Issues (#620)

* ELECTRON-1073: localise more info window content

* fix localisation on network error strings

* ELECTRON-1074: fix localisation for right click context menu in child windows

* ELECTRON-1097: fix japanese localisation string name for screen sharing indicator

* ELECTRON-1052: add localisation support for screen names in screen sharing window
This commit is contained in:
Vishwas Shashidhar
2019-03-28 18:09:05 +05:30
committed by GitHub
parent dd5dbda122
commit ef392b2c60
11 changed files with 80 additions and 20 deletions

View File

@@ -85,6 +85,8 @@ function openMoreInfoWindow(windowName) {
});
moreInfoWindow.webContents.on('did-finish-load', () => {
const moreInfoContext = i18n.getMessageFor('MoreInfo');
moreInfoWindow.webContents.send('i18n-more-info', moreInfoContext);
// initialize crash reporter
initCrashReporterMain({ process: 'more info window' });
initCrashReporterRenderer(moreInfoWindow, { process: 'render | more info window' });

View File

@@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>More Information</title>
<title data-i18n-text="More Information"></title>
<style>
html, body {
margin: 0;
@@ -30,7 +30,7 @@
</head>
<body>
<div class="content">
<span><b>Version Information</b></span>
<span><b data-i18n-text="Version Information"></b></span>
<span id="electron" class="content"></span>
<span id="chromium" class="content"></span>
<span id="v8" class="content"></span>

View File

@@ -36,6 +36,18 @@ ipcRenderer.on('register-crash-reporter', (event, arg) => {
}
});
ipcRenderer.on('i18n-more-info', (event, content) => {
if (content && typeof content === 'object') {
const i18nNodes = document.querySelectorAll('[data-i18n-text]');
for (let node of i18nNodes) {
if (node.attributes['data-i18n-text'] && node.attributes['data-i18n-text'].value) {
node.innerText = content[node.attributes['data-i18n-text'].value] || node.attributes['data-i18n-text'].value;
}
}
}
});
// note: this is a workaround until
// https://github.com/electron/electron/issues/8841
// is fixed on the electron. where 'will-navigate'