Fix split sentence: "% downloaded"

#4239
This commit is contained in:
infiinte-persistence 2020-05-26 18:31:49 +08:00 committed by Sean Yesmunt
parent 951300a1cd
commit 1ef182ed71
2 changed files with 10 additions and 5 deletions

View file

@ -581,7 +581,6 @@
"'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead": "'claimId' should no longer be used. Use 'streamClaimId' or 'channelClaimId' instead",
"View Tag": "View Tag",
"Block": "Block",
"% downloaded": "% downloaded",
"'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead": "'claimName' should no longer be used. Use 'streamClaimName' or 'channelClaimName' instead",
"Vietnamese": "Vietnamese",
"Thai": "Thai",
@ -1199,6 +1198,7 @@
"Share this channel": "Share this channel",
"File preview": "File preview",
"Go Home": "Go Home",
"%percent%% downloaded": "%percent%% downloaded",
"Uploading (%progress%%) ": "Uploading (%progress%%) ",
"Confirming": "Confirming",
"Unfollow this channel": "Unfollow this channel",

View file

@ -71,11 +71,16 @@ function FileDownloadLink(props: Props) {
// @if TARGET='app'
if (downloading || loading) {
const progress = fileInfo && fileInfo.written_bytes > 0 ? (fileInfo.written_bytes / fileInfo.total_bytes) * 100 : 0;
const label =
fileInfo && fileInfo.written_bytes > 0 ? progress.toFixed(0) + __('% downloaded') : __('Connecting...');
if (hideDownloadStatus) {
return null;
}
return hideDownloadStatus ? null : <span className="download-text">{label}</span>;
if (fileInfo && fileInfo.written_bytes > 0) {
const progress = (fileInfo.written_bytes / fileInfo.total_bytes) * 100;
return <span className="download-text">{__('%percent%% downloaded', { percent: progress.toFixed(0) })}</span>;
} else {
return <span className="download-text">{__('Connecting...')}</span>;
}
}
// @endif