Drupal 8 8.0.2
|translate ($string, array $args=array(), array $options=array())|
|translateString (TranslatableMarkup $translated_string)|
|formatPlural ($count, $singular, $plural, array $args=array(), array $options=array())|
Interface for the translation.manager translation service.
Formats a string containing a count of items.
This function ensures that the string is pluralized correctly. Since TranslationInterface::translate() is called by this function, make sure not to pass already-localized strings to it. See PluralTranslatableMarkup::createFromTranslatedString() for that.
Example with additional replacements:
|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 in the singular string.|
|string||$plural||The string for the plural case. Make sure it is clear this is plural, to ease translation. Use in place of the item count, as in "@count new comments".|
|array||$args||An associative array of replacements to make after translation. Instances of any key in this array are replaced with the corresponding value. Based on the first character of the key, the value is escaped and/or themed. See ::format(). Note that you do not need to include in this array; this replacement is done automatically for the plural cases.|
|array||$options||An associative array of additional options. See t() for allowed keys.|
Referenced by UnmetDependenciesException\getTranslatedMessage().