status translations

This commit is contained in:
SpikeHD
2022-05-15 22:13:01 -07:00
parent 0cfb73ac49
commit 081cc8b74f
2 changed files with 10 additions and 2 deletions

View File

@@ -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"

View File

@@ -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<IProps, IState> {
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,
})