From 0cfb73ac49337d394a5e3fe9936b8279f8b5f7c3 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 15 May 2022 22:06:43 -0700 Subject: [PATCH 1/2] translate main bar text --- lang/en.json | 4 +++- src/ui/components/common/MainProgressBar.tsx | 5 +++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lang/en.json b/lang/en.json index f7852ab..2df30bd 100644 --- a/lang/en.json +++ b/lang/en.json @@ -5,7 +5,9 @@ "launch_button": "Launch", "gc_enable": "Connect via Grasscutter", "ip_placeholder": "Server Address...", - "port_placeholder": "Port..." + "port_placeholder": "Port...", + "files_downloading": "Files Downloading: ", + "files_extracting": "Files Extracting: " }, "options": { "game_exec": "Set Game Executable", diff --git a/src/ui/components/common/MainProgressBar.tsx b/src/ui/components/common/MainProgressBar.tsx index 3a8071f..f43fc52 100644 --- a/src/ui/components/common/MainProgressBar.tsx +++ b/src/ui/components/common/MainProgressBar.tsx @@ -1,5 +1,6 @@ import React from 'react' import DownloadHandler from '../../../utils/download' +import Tr from '../../../utils/language' import './ProgressBar.css' interface IProps { @@ -67,9 +68,9 @@ export default class ProgressBar extends React.Component {
- Files Downloading: {this.state.files} ({this.state.speed}) + {this.state.files} ({this.state.speed})
- Files Extracting: {this.state.extracting} + {this.state.extracting}
) From 081cc8b74f1dca4985a9e2a2cb3b37a588e60e6c Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 15 May 2022 22:13:01 -0700 Subject: [PATCH 2/2] status translations --- lang/en.json | 7 +++++++ src/ui/components/common/ProgressBar.tsx | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lang/en.json b/lang/en.json index 2df30bd..0d27b7e 100644 --- a/lang/en.json +++ b/lang/en.json @@ -19,6 +19,13 @@ "grasscutter_latest": "Download Grasscutter Latest", "resources": "Download Grasscutter Resources" }, + "download_status": { + "downloading": "Downloading", + "extracting": "Extracting", + "error": "Error", + "finished": "Finished", + "stopped": "Stopped" + }, "components": { "select_file": "Select file or folder...", "download": "Download" diff --git a/src/ui/components/common/ProgressBar.tsx b/src/ui/components/common/ProgressBar.tsx index 6c93412..c838a61 100644 --- a/src/ui/components/common/ProgressBar.tsx +++ b/src/ui/components/common/ProgressBar.tsx @@ -4,6 +4,7 @@ import { capitalize } from '../../../utils/string' import Stop from '../../../resources/icons/close.svg' import './ProgressBar.css' import DownloadHandler from '../../../utils/download' +import { translate } from '../../../utils/language' interface IProps { path: string, @@ -31,11 +32,11 @@ export default class ProgressBar extends React.Component { componentDidMount() { // Periodically check the progress of passed file path - const intv = setInterval(() => { + const intv = setInterval(async () => { const prog = this.props.downloadManager.getDownloadProgress(this.props.path) this.setState({ progress: prog?.progress || 0, - status: prog?.status || 'stopped', + status: await translate(`download_status.${prog?.status || 'stopped'}`) || 'stopped', total: prog?.total || 0, })