From 8c1a9a05599c1e1b45992ab14fc391f89f34e63d Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 26 Mar 2019 14:43:48 +0100 Subject: adding i18n framework --- .../modules/pix2pixhd/views/pix2pixhd.live.js | 107 +++++++++++++-------- 1 file changed, 67 insertions(+), 40 deletions(-) (limited to 'app/client/modules') diff --git a/app/client/modules/pix2pixhd/views/pix2pixhd.live.js b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js index 52b4b61..ee7ece7 100644 --- a/app/client/modules/pix2pixhd/views/pix2pixhd.live.js +++ b/app/client/modules/pix2pixhd/views/pix2pixhd.live.js @@ -14,6 +14,8 @@ import * as queueActions from '../../../queue/queue.actions' import * as pix2pixhdTasks from '../pix2pixhd.tasks' import * as pix2pixhdActions from '../pix2pixhd.actions' +import i18n from '../../../i18n' + class Pix2PixHDLive extends Component { constructor(props){ super() @@ -99,10 +101,11 @@ class Pix2PixHDLive extends Component { } render(){ // console.log(this.props) - if (this.props.pix2pixhd.loading) { - return + const { pix2pixhd, i18n } = this.props + if (pix2pixhd.loading) { + return } - const { folderLookup, datasetLookup, sequences } = this.props.pix2pixhd.data + const { folderLookup, datasetLookup, sequences } = pix2pixhd.data const sequenceLookup = sequences.reduce((a,b) => { a[b.name] = true @@ -110,7 +113,7 @@ class Pix2PixHDLive extends Component { }, {}) const sequenceGroups = Object.keys(folderLookup).map(id => { - const folder = this.props.pix2pixhd.data.folderLookup[id] + const folder = folderLookup[id] if (folder.name === 'results') return const datasets = folder.datasets.map(name => { const sequence = sequenceLookup[name] @@ -126,7 +129,7 @@ class Pix2PixHDLive extends Component { }).filter(n => !!n && !!n.options.length).sort((a,b) => a.name.localeCompare(b.name)) const checkpointGroups = Object.keys(folderLookup).map(id => { - const folder = this.props.pix2pixhd.data.folderLookup[id] + const folder = folderLookup[id] if (folder.name === 'results') return const datasets = folder.datasets.map(name => { const dataset = datasetLookup[name] @@ -147,61 +150,62 @@ class Pix2PixHDLive extends Component {
@@ -217,64 +221,74 @@ class Pix2PixHDLive extends Component {
@@ -283,70 +297,80 @@ class Pix2PixHDLive extends Component {
@@ -359,46 +383,47 @@ class Pix2PixHDLive extends Component { } renderRestartButton(){ // console.log(this.props.runner.gpu) + const { i18n } = this.props if (this.props.runner.gpu.status === 'IDLE') { return ( + >{i18n.gpu.start} ) } if (this.props.runner.gpu.task.module !== 'pix2pixhd') { return ( + >{i18n.gpu.interrupt} ) } if (! this.props.opt.processing) { return (
+ >{i18n.gpu.restart} + >{i18n.gpu.interrupt}
) } return (
+ >{i18n.gpu.stop} + >{i18n.gpu.interrupt}
) } @@ -420,16 +445,17 @@ class Pix2PixHDLive extends Component { // ) } renderLiveButtons(){ + const { i18n } = this.props return (
{ @@ -437,7 +463,7 @@ class Pix2PixHDLive extends Component { }} > { @@ -461,6 +487,7 @@ const mapStateToProps = state => ({ epochs: state.live.epochs, sequences: state.live.sequences, runner: state.system.runner, + i18n: state.system.i18n.strings, pix2pixhd: state.module.pix2pixhd, }) -- cgit v1.2.3-70-g09d2