Skip to content

Commit

Permalink
fix: Handle plural forms in template
Browse files Browse the repository at this point in the history
  • Loading branch information
pixelastic committed Sep 4, 2015
1 parent 8290542 commit 1bfd109
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions components/Stats/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Stats extends React.Component {
var template = this.props.template;
var data = {
nbHits: this.props.nbHits,
isPlural: this.props.nbHits > 1,

This comment has been minimized.

Copy link
@redox

redox Sep 4, 2015

Contributor

Unfortunately, this test doesn't work. In english, zero is plural for instance. I'm used to use frameworks that have 3 values:

  • zero
  • one
  • many
processingTimeMS: this.props.processingTimeMS
};

Expand Down
2 changes: 1 addition & 1 deletion widgets/stats/template.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div>
{{nbHits}} results
{{nbHits}} {{#isPlural}}results{{/isPlural}}{{^isPlural}}result{{/isPlural}}
<small>found in {{processingTimeMS}}ms</small>
</div>

0 comments on commit 1bfd109

Please sign in to comment.