Inflection Helpers

Handlebars provides a set of built-in helpers for working with inflection. These helpers are used to format and manipulate words, making it easier to display text in a readable format.

inflection

{{inflect}}

Returns either the singular or plural inflection of a word based on the given count.

Params

  • count {Number}
  • singular {String}: The singular form
  • plural {String}: The plural form
  • includeCount {Boolean}
  • returns {String}

Example

{{inflect 0 "string" "strings"}}

{{inflect 1 "string" "strings"}}

{{inflect 1 "string" "strings" true}}

{{inflect 2 "string" "strings"}}

{{inflect 2 "string" "strings" true}}

{{ordinalize}}

Returns an ordinalized number as a string.

Params

  • value {Number|String}: The value to ordinalize.
  • returns {String}: The ordinalized number

Example

{{ordinalize 1}}

{{ordinalize 21}}

{{ordinalize 29}}

{{ordinalize 22}}