Skip to content

Global Helpers

pluralize()

pluralize() — returns string

Available in: controller, model, mapper, migrator Category: String Functions

Returns the plural form of the passed in word. Can also pluralize a word based on a value passed to the count argument. CFWheels stores a list of words that are the same in both singular and plural form (e.g. “equipment”, “information”) and words that don’t follow the regular pluralization rules (e.g. “child” / “children”, “foot” / “feet”). Use get(“uncountables”) / set(“uncountables”, newList) and get(“irregulars”) / set(“irregulars”, newList) to modify them to suit your needs.

NameTypeRequiredDefaultDescription
wordstringyesThe word to pluralize.
countnumericno-1Pluralization will occur when this value is not 1.
returnCountbooleannotrueWill return count prepended to the pluralization when true and count is not -1.
// Pluralize a word, will result in "people" 
#pluralize("person")#

// Pluralize based on the count passed in 
Your search returned #pluralize(word="person", count=users.RecordCount)#