Split unsubmittedSegmentCounts string into many to account for singular/plural forms of nouns

hopefully with enough context for translators to properly translate...
This commit is contained in:
mini-bomba
2022-08-20 11:50:41 +02:00
committed by Ajay
parent 9915d46ad4
commit bd292ff886
2 changed files with 27 additions and 2 deletions

View File

@@ -27,7 +27,12 @@ class UnsubmittedVideosComponent extends React.Component<UnsubmittedVideosProps,
return <>
<div>
{chrome.i18n.getMessage("unsubmittedSegmentCounts").replace("{0}", segmentCount.toString()).replace("{1}", videoCount.toString())}
{segmentCount == 0 ?
chrome.i18n.getMessage("unsubmittedSegmentCountsZero") :
chrome.i18n.getMessage("unsubmittedSegmentCounts")
.replace("{0}", `${segmentCount} ${chrome.i18n.getMessage("unsubmittedSegments" + (segmentCount == 1 ? "Singular" : "Plural"))}`)
.replace("{1}", `${videoCount} ${chrome.i18n.getMessage("videos" + (videoCount == 1 ? "Singular" : "Plural"))}`)
}
</div>
{videoCount > 0 && <div className="option-button inline" onClick={() => this.setState({tableVisible: !this.state.tableVisible})}>