You are here

protected function PluralTranslatableMarkup::getPluralIndex in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php \Drupal\Core\StringTranslation\PluralTranslatableMarkup::getPluralIndex()

Gets the plural index through the gettext formula.

Return value

int

1 call to PluralTranslatableMarkup::getPluralIndex()
PluralTranslatableMarkup::render in core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php
Renders the object as a string.

File

core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php, line 159
Contains \Drupal\Core\StringTranslation\PluralTranslatableMarkup.

Class

PluralTranslatableMarkup
A class to hold plural translatable markup.

Namespace

Drupal\Core\StringTranslation

Code

protected function getPluralIndex() {
  if (!isset(static::$localeEnabled)) {
    static::$localeEnabled = function_exists('locale_get_plural');
  }
  if (function_exists('locale_get_plural')) {
    return locale_get_plural($this->count, $this
      ->getOption('langcode'));
  }
  return -1;
}