interface PluralFormulaInterface (View source)

An interface for a service providing plural formulae.

Methods

setPluralFormula(string $langcode, int $plural_count, array $formula)

No description

int
getNumberOfPlurals(null|string $langcode = NULL)

Returns the number of plurals supported by a given language.

array
getFormula(string $langcode)

Gets the plural formula for a langcode.

reset()

Resets the static formulae cache.

Details

PluralFormulaInterface setPluralFormula(string $langcode, int $plural_count, array $formula)

No description

Parameters

string $langcode

The language code to get the formula for.

int $plural_count

The number of plural forms.

array $formula

An array of formulae.

Return Value

PluralFormulaInterface

The PluralFormula object.

int getNumberOfPlurals(null|string $langcode = NULL)

Returns the number of plurals supported by a given language.

Parameters

null|string $langcode

(optional) The language code. If not provided, the current language will be used.

Return Value

int

Number of plural variants supported by the given language.

array getFormula(string $langcode)

Gets the plural formula for a langcode.

Parameters

string $langcode

The language code to get the formula for.

Return Value

array

An array of formulae.

PluralFormulaInterface reset()

Resets the static formulae cache.

Return Value

PluralFormulaInterface

The PluralFormula object.