Skip to content

charton API


charton API / @chart-on/core / index / pluralText

Function: pluralText() ​

pluralText(localization, key, count, params?, fallback?): string

Defined in: packages/core/src/util/locale.ts:200

The message key for count in the plural form of the language: key.one, key.few, key.many, … as Intl.PluralRules picks for the locale (key.zero too where the language has it), else key.other, else fallback (default: the message key itself). E.g. with { 'measureBars.one': '{count} barre', 'measureBars.other': '{count} barres' }, French writes 0 barre and 2 barres.

Parameters ​

localization ​

Pick<Localizer, "locale" | "text">

key ​

string

count ​

number

params? ​

Readonly<Record<string, string | number>>

fallback? ​

string = ...

Returns ​

string