public function PluralTranslatableMarkup::__construct in Drupal 8
Same name and namespace in other branches
- 9 core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php \Drupal\Core\StringTranslation\PluralTranslatableMarkup::__construct()
- 10 core/lib/Drupal/Core/StringTranslation/PluralTranslatableMarkup.php \Drupal\Core\StringTranslation\PluralTranslatableMarkup::__construct()
Constructs a new PluralTranslatableMarkup object.
Parses values passed into this class through the format_plural() function in Drupal and handles an optional context for the string.
Parameters
int $count: The item count to display.
string $singular: The string for the singular case. Make sure it is clear this is singular, to ease translation (e.g. use "1 new comment" instead of "1 new"). Do not use @count in the singular string.
string $plural: The string for the plural case. Make sure it is clear this is plural, to ease translation. Use @count in place of the item count, as in "@count new comments".
array $args: (optional) An array with placeholder replacements, keyed by placeholder. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for additional information about placeholders. Note that you do not need to include @count in this array; this replacement is done automatically for the plural cases.
array $options: (optional) An associative array of additional options. See t() for allowed keys.
\Drupal\Core\StringTranslation\TranslationInterface $string_translation: (optional) The string translation service.
Overrides TranslatableMarkup::__construct
See also
\Drupal\Component\Render\FormattableMarkup::placeholderFormat()
File
- core/
lib/ Drupal/ Core/ StringTranslation/ PluralTranslatableMarkup.php, line 68
Class
- PluralTranslatableMarkup
- A class to hold plural translatable markup.
Namespace
Drupal\Core\StringTranslationCode
public function __construct($count, $singular, $plural, array $args = [], array $options = [], TranslationInterface $string_translation = NULL) {
$this->count = $count;
$translatable_string = implode(PoItem::DELIMITER, [
$singular,
$plural,
]);
parent::__construct($translatable_string, $args, $options, $string_translation);
}