Skip to content

Commit 1bfd109

Browse files
committed
fix: Handle plural forms in template
1 parent 8290542 commit 1bfd109

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

components/Stats/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ class Stats extends React.Component {
77
var template = this.props.template;
88
var data = {
99
nbHits: this.props.nbHits,
10+
isPlural: this.props.nbHits > 1,
1011
processingTimeMS: this.props.processingTimeMS
1112
};
1213

widgets/stats/template.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<div>
2-
{{nbHits}} results
2+
{{nbHits}} {{#isPlural}}results{{/isPlural}}{{^isPlural}}result{{/isPlural}}
33
<small>found in {{processingTimeMS}}ms</small>
44
</div>

0 commit comments

Comments
 (0)