Skip to content

API reference / @localizer/translate / plural

Function: plural()
experimental

plural<T>(value, map): Localizable

Defined in: plural.ts:114

Plural translation function.

Determines the appropriate translation for a given numeric value based on the provided plural translation map and the locale's pluralization rules.

Type Parameters

Type ParameterDescription
T extends numberThe type of numeric values that the function can handle.

Parameters

ParameterTypeDescription
valueTThe numeric value to be pluralized.
mapPluralTranslationMap<T>The translation map containing plural categories and values.

Returns

Localizable

The localized pluralized value.

Throws

If no "other" plural category is defined in the map.