Skip to content

Commit

Permalink
Reword the subtitles for various task types. Fixes #68.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Kelley committed Mar 27, 2018
1 parent ef3f16e commit 1e41a2d
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 29 deletions.
54 changes: 35 additions & 19 deletions _locales/en/messages.json
Expand Up @@ -182,30 +182,34 @@
"message": "Pause",
"description": "Tooltip for pause button on a task list item."
},
"ZpercentZ_ZcurrentZ_of_ZtotalZ_at_ZspeedZ": {
"message": "$PERCENT$ ($CURRENT$ of $TOTAL$ at $SPEED$)",
"ZpercentZ_ZestimateZ_ZcurrentZ_of_ZtotalZ_at_ZspeedZ": {
"message": "$PERCENT$ \u2013 $ESTIMATE$ \u2013 $CURRENT$ of $TOTAL$ at $SPEED$",
"description": "Subtitle prefix for currently-downloading task showing stats.",
"placeholders": {
"percent": {
"content": "$1",
"example": "65.5%"
},
"current": {
"estimate": {
"content": "$2",
"example": "1:23 remaining"
},
"current": {
"content": "$3",
"example": "100KB"
},
"total": {
"content": "$3",
"content": "$4",
"example": "10MB"
},
"speed": {
"content": "$4",
"content": "$5",
"example": "50KB/s"
}
}
},
"_ZetaZ_remaining": {
"message": " \u2013 $ETA$ remaining",
"ZetaZ_remaining": {
"message": "$ETA$ remaining",
"description": "Subtitle suffix for currently-downloading task.",
"placeholders": {
"eta": {
Expand All @@ -214,26 +218,30 @@
}
}
},
"_no_estimate": {
"message": " \u2013 no estimate",
"no_estimate": {
"message": "no estimate",
"description": "Subtitle suffix for currently-downloading task."
},
"ZtotalZ_uploaded_ZspeedZ": {
"message": "$TOTAL$ uploaded ($SPEED$)",
"ZratioZ_ratio_ZtotalZ_uploaded_at_ZspeedZ": {
"message": "$RATIO$ ratio \u2013 $TOTAL$ uploaded at $SPEED$",
"description": "Subtitle for currently-uploading task showing stats.",
"placeholders": {
"total": {
"ratio": {
"content": "$1",
"example": "1.23"
},
"total": {
"content": "$2",
"example": "10MB"
},
"speed": {
"content": "$2",
"content": "$3",
"example": "50KB/s"
}
}
},
"ZtotalZ_downloaded": {
"message": "$TOTAL$ downloaded",
"100_ZtotalZ_downloaded": {
"message": "100% \u2013 $TOTAL$ downloaded",
"description": "Subtitle for completed, not-uploading task showing stats.",
"placeholders": {
"total": {
Expand All @@ -242,16 +250,24 @@
}
}
},
"ZcurrentZ_of_ZtotalZ_downloaded": {
"message": "$CURRENT$ of $TOTAL$ downloaded",
"ZstatusZ_ZpercentZ_ZcurrentZ_of_ZtotalZ_downloaded": {
"message": "$STATUS$ \u2013 $PERCENT$ \u2013 $CURRENT$ of $TOTAL$ downloaded",
"description": "Subtitle for status-unknown task showing stats (best effort).",
"placeholders": {
"current": {
"status": {
"content": "$1",
"example": "Paused"
},
"percent": {
"content": "$2",
"example": "1.23%"
},
"current": {
"content": "$3",
"example": "100KB"
},
"total": {
"content": "$2",
"content": "$4",
"example": "10MB"
}
}
Expand Down
24 changes: 14 additions & 10 deletions src/popup/Task.tsx
Expand Up @@ -90,42 +90,46 @@ export class Task extends React.PureComponent<Props, State> {
const eta = this.computeSecondsRemaining();
return renderStatusLine(
'fa fa-arrow-down',
browser.i18n.getMessage('ZpercentZ_ZcurrentZ_of_ZtotalZ_at_ZspeedZ', [
browser.i18n.getMessage('ZpercentZ_ZestimateZ_ZcurrentZ_of_ZtotalZ_at_ZspeedZ', [
(Number.isFinite(fraction) ? formatPercentage(fraction) : '0%'),
(Number.isFinite(eta as number)
? browser.i18n.getMessage('ZetaZ_remaining', [ formatTime(eta as number) ])
: browser.i18n.getMessage('no_estimate')),
`${formatMetric1024(this.props.task.additional!.transfer!.size_downloaded)}B`,
`${formatMetric1024(this.props.task.size)}B`,
`${formatMetric1024(this.props.task.additional!.transfer!.speed_download)}B/s`
]) + (Number.isFinite(eta as number)
? browser.i18n.getMessage('_ZetaZ_remaining', [ formatTime(eta as number) ])
: browser.i18n.getMessage('_no_estimate'))
`${formatMetric1024(this.props.task.additional!.transfer!.speed_download)}B/s`,
])
);
} else if (matchesFilter(this.props.task, 'uploading')) {
return renderStatusLine(
'fa fa-arrow-up',
browser.i18n.getMessage('ZtotalZ_uploaded_ZspeedZ', [
browser.i18n.getMessage('ZratioZ_ratio_ZtotalZ_uploaded_at_ZspeedZ', [
`${(this.props.task.additional!.transfer!.size_uploaded / this.props.task.size).toFixed(2)}`,
`${formatMetric1024(this.props.task.additional!.transfer!.size_uploaded)}B`,
`${formatMetric1024(this.props.task.additional!.transfer!.speed_upload)}B/s`,
])
);
} else if (matchesFilter(this.props.task, 'completed')) {
return renderStatusLine(
'fa fa-check',
browser.i18n.getMessage('ZtotalZ_downloaded', [
browser.i18n.getMessage('100_ZtotalZ_downloaded', [
`${formatMetric1024(this.props.task.size)}B`
])
);
} else if (matchesFilter(this.props.task, 'errored')) {
return renderStatusLine(
'fa fa-exclamation-circle',
return (
<span className='intent-error'>
<span className='fa fa-exclamation-triangle error-icon'/>
{upperCase(this.props.task.status)} {this.props.task.status_extra ? `\u2013 ${startCase(this.props.task.status_extra.error_detail)}` : ''}
</span>
);
} else {
const fraction = this.computeFractionComplete();
return renderStatusLine(
'far fa-clock',
browser.i18n.getMessage('ZcurrentZ_of_ZtotalZ_downloaded', [
browser.i18n.getMessage('ZstatusZ_ZpercentZ_ZcurrentZ_of_ZtotalZ_downloaded', [
upperCase(this.props.task.status),
(Number.isFinite(fraction) ? formatPercentage(fraction) : '0%'),
`${formatMetric1024(this.props.task.additional!.transfer!.size_downloaded)}B`,
`${formatMetric1024(this.props.task.size)}B`
])
Expand Down

0 comments on commit 1e41a2d

Please sign in to comment.