PluralFormula::setPluralFormula

public PluralFormula::setPluralFormula($langcode, $plural_count, array $formula)

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

self The PluralFormula object.

Overrides PluralFormulaInterface::setPluralFormula

File

core/modules/locale/src/PluralFormula.php, line 55

Class

PluralFormula
Manages the storage of plural formula per language in state.

Namespace

Drupal\locale

Code

public function setPluralFormula($langcode, $plural_count, array $formula) {
  // Ensure that the formulae are loaded.
  $this->loadFormulae();

  $this->formulae[$langcode] = [
    'plurals' => $plural_count,
    'formula' => $formula,
  ];
  $this->state->set('locale.translation.formulae', $this->formulae);
  return $this;
}
doc_Drupal
2016-10-29 09:34:15
Comments
Leave a Comment

Please login to continue.