function StringTranslationTrait::formatPlural

Same name and namespace in other branches
  1. 11.x core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php \Drupal\Core\StringTranslation\StringTranslationTrait::formatPlural()
  2. 10 core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php \Drupal\Core\StringTranslation\StringTranslationTrait::formatPlural()
  3. 9 core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php \Drupal\Core\StringTranslation\StringTranslationTrait::formatPlural()
  4. 8.9.x core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php \Drupal\Core\StringTranslation\StringTranslationTrait::formatPlural()

Formats a string containing a count of items.

Return value

\Drupal\Core\StringTranslation\PluralTranslatableMarkup An object that, when cast to a string, returns the translated string.

See also

\Drupal\Core\StringTranslation\TranslationInterface::formatPlural()

37 calls to StringTranslationTrait::formatPlural()
AddFormBase::buildForm in core/modules/media_library/src/Form/AddFormBase.php
Form constructor.
AddFormBase::updateLibrary in core/modules/media_library/src/Form/AddFormBase.php
AJAX callback to send the new media item(s) to the media library.
BulkForm::viewsFormSubmit in core/modules/views/src/Plugin/views/field/BulkForm.php
Submit handler for the bulk form.
CodeBlock::validateConfigurationForm in core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/CodeBlock.php
Form validation handler.
ComposerPluginsValidator::validate in core/modules/package_manager/src/Validator/ComposerPluginsValidator.php
Validates the allowed Composer plugins, both in active and stage.

... See full list

File

core/lib/Drupal/Core/StringTranslation/StringTranslationTrait.php, line 83

Class

StringTranslationTrait
Wrapper methods for \Drupal\Core\StringTranslation\TranslationInterface.

Namespace

Drupal\Core\StringTranslation

Code

protected function formatPlural($count, $singular, $plural, array $args = [], array $options = []) {
  return new PluralTranslatableMarkup($count, $singular, $plural, $args, $options, $this->getStringTranslation());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.