ELECTRON-1213 - Fix localization for more information window (#657)

This commit is contained in:
Kiran Niranjan 2019-05-22 12:31:54 +05:30 committed by Vishwas Shashidhar
parent 4e77f418d8
commit cdac0c4b89
9 changed files with 23 additions and 7 deletions

View File

@ -134,7 +134,7 @@ export const createComponentWindow = (
if (!browserWindow || !windowExists(browserWindow)) { if (!browserWindow || !windowExists(browserWindow)) {
return; return;
} }
browserWindow.webContents.send('set-locale-resource', { locale: i18n.getLocale(), resource: i18n.loadedResources }); browserWindow.webContents.send('page-load', { locale: i18n.getLocale(), resource: i18n.loadedResources });
}); });
browserWindow.setMenu(null as any); browserWindow.setMenu(null as any);

View File

@ -15,6 +15,8 @@
}, },
"MoreInfo": { "MoreInfo": {
"More Information": "More Information", "More Information": "More Information",
"Others": "Others",
"related": "related",
"Version Information": "Version Information" "Version Information": "Version Information"
}, },
"Bring All to Front": "Bring All to Front", "Bring All to Front": "Bring All to Front",

View File

@ -15,6 +15,8 @@
}, },
"MoreInfo": { "MoreInfo": {
"More Information": "More Information", "More Information": "More Information",
"Others": "Others",
"related": "related",
"Version Information": "Version Information" "Version Information": "Version Information"
}, },
"Bring All to Front": "Bring All to Front", "Bring All to Front": "Bring All to Front",

View File

@ -15,6 +15,8 @@
}, },
"MoreInfo": { "MoreInfo": {
"More Information": "Plus dinformations", "More Information": "Plus dinformations",
"Others": "Autres",
"related": "en relation",
"Version Information": "Information sur la version" "Version Information": "Information sur la version"
}, },
"Bring All to Front": "Amener tous au front", "Bring All to Front": "Amener tous au front",

View File

@ -15,6 +15,8 @@
}, },
"MoreInfo": { "MoreInfo": {
"More Information": "Plus dinformations", "More Information": "Plus dinformations",
"Others": "Autres",
"related": "en relation",
"Version Information": "Information sur la version" "Version Information": "Information sur la version"
}, },
"Bring All to Front": "Amener tous au front", "Bring All to Front": "Amener tous au front",

View File

@ -15,6 +15,8 @@
}, },
"MoreInfo": { "MoreInfo": {
"More Information": "詳しくは", "More Information": "詳しくは",
"Others": "その他",
"related": "関連した",
"Version Information": "バージョン情報" "Version Information": "バージョン情報"
}, },
"Bring All to Front": "すべて前面に表示", "Bring All to Front": "すべて前面に表示",

View File

@ -15,6 +15,8 @@
}, },
"MoreInfo": { "MoreInfo": {
"More Information": "詳しくは", "More Information": "詳しくは",
"Others": "その他",
"related": "関連した",
"Version Information": "バージョン情報" "Version Information": "バージョン情報"
}, },
"Bring All to Front": "すべて前面に表示", "Bring All to Front": "すべて前面に表示",

View File

@ -1,5 +1,8 @@
import * as React from 'react'; import * as React from 'react';
import { i18n } from '../../common/i18n-preload';
const MORE_INFO_NAMESPACE = 'MoreInfo';
/** /**
* Window that display app version and copyright info * Window that display app version and copyright info
*/ */
@ -11,13 +14,13 @@ export default class MoreInfo extends React.PureComponent {
public render(): JSX.Element { public render(): JSX.Element {
return ( return (
<div className='MoreInfo'> <div className='MoreInfo'>
<span><b>Version Information</b></span> <span><b>{i18n.t('Version Information', MORE_INFO_NAMESPACE)()}</b></span>
<div className='content'> <div className='content'>
<h4>Electron</h4> <h4>Electron</h4>
<span className='MoreInfo-electron'>{process.versions.electron || 'N/A'}</span> <span className='MoreInfo-electron'>{process.versions.electron || 'N/A'}</span>
</div> </div>
<div className='content'> <div className='content'>
<h4>v8 related</h4> <h4>v8 {i18n.t('related', MORE_INFO_NAMESPACE)()}</h4>
<table> <table>
<tbody> <tbody>
<tr> <tr>
@ -34,7 +37,7 @@ export default class MoreInfo extends React.PureComponent {
</table> </table>
</div> </div>
<div className='content'> <div className='content'>
<h4>Others</h4> <h4>{i18n.t('Others', MORE_INFO_NAMESPACE)()}</h4>
<table> <table>
<tbody> <tbody>
<tr> <tr>

View File

@ -51,6 +51,7 @@ const load = () => {
case components.moreInfo: case components.moreInfo:
loadStyle(components.moreInfo); loadStyle(components.moreInfo);
component = MoreInfo; component = MoreInfo;
document.title = i18n.t('More Information', 'MoreInfo')();
break; break;
case components.screenPicker: case components.screenPicker:
loadStyle(components.screenPicker); loadStyle(components.screenPicker);
@ -77,9 +78,9 @@ const load = () => {
ReactDOM.render(element, document.getElementById('Root')); ReactDOM.render(element, document.getElementById('Root'));
}; };
document.addEventListener('DOMContentLoaded', load); ipcRenderer.on('page-load', (_event, data) => {
ipcRenderer.on('set-locale-resource', (_event, data) => {
const { locale, resource } = data; const { locale, resource } = data;
i18n.setResource(locale, resource); i18n.setResource(locale, resource);
// Renders component as soon as the page is ready
load();
}); });