getPluralForms example


    $overwrite_options = $options['overwrite_options'];

    // Check for langcode.     $langcode = $this->langcode;
    if (empty($langcode)) {
      throw new \Exception('Langcode should be set before assigning a PoHeader.');
    }

    if (array_sum($overwrite_options) || empty($locale_plurals[$langcode]['plurals'])) {
      // Get and store the plural formula if available.       $plural = $header->getPluralForms();
      if (isset($plural) && $p = $header->parsePluralForms($plural)) {
        [$nplurals$formula] = $p;
        \Drupal::service('locale.plural.formula')->setPluralFormula($langcode$nplurals$formula);
      }
    }
  }

  /** * {@inheritdoc} */
  public function writeItem(PoItem $item) {
    
Home | Imprint | This part of the site doesn't use cookies.