From e6e6c1508a3e99b73846e708bcffee41c13e757f Mon Sep 17 00:00:00 2001 From: infiinte-persistence Date: Tue, 26 May 2020 18:31:49 +0800 Subject: [PATCH] Fix split sentence: "% downloaded" #4239 --- static/app-strings.json | 2 +- ui/component/fileDownloadLink/view.jsx | 13 +++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/static/app-strings.json b/static/app-strings.json index 4a61c3634..fca1abd15 100644 --- a/static/app-strings.json +++ b/static/app-strings.json @@ -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", diff --git a/ui/component/fileDownloadLink/view.jsx b/ui/component/fileDownloadLink/view.jsx index 18c197495..aa0b4800c 100644 --- a/ui/component/fileDownloadLink/view.jsx +++ b/ui/component/fileDownloadLink/view.jsx @@ -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 : {label}; + if (fileInfo && fileInfo.written_bytes > 0) { + const progress = (fileInfo.written_bytes / fileInfo.total_bytes) * 100; + return {__('%percent%% downloaded', { percent: progress.toFixed(0) })}; + } else { + return {__('Connecting...')}; + } } // @endif