public TranslationInterface::translate($string, array $args = array(), array $options = array())
Translates a string to the current language or to a given language.
Never call this translate() method directly. In order for strings to be localized, make them available in one of the ways supported by the Localization API. When possible, use the \Drupal\Core\StringTranslation\StringTranslationTrait $this->t(). Otherwise create a new \Drupal\Core\StringTranslation\TranslatableMarkup object.
string $string: A string containing the English text to translate.
array $args: (optional) An associative array of replacements to make after translation. Based on the first character of the key, the value is escaped and/or themed. See \Drupal\Component\Render\FormattableMarkup::placeholderFormat() for details.
array $options: (optional) An associative array of additional options, with the following elements:
\Drupal\Core\StringTranslation\TranslatableMarkup An object that, when cast to a string, returns the translated string.
\Drupal\Component\Render\FormattableMarkup::placeholderFormat()
\Drupal\Core\StringTranslation\TranslatableMarkup::__construct()
public function translate($string, array $args = array(), array $options = array());
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!StringTranslation!TranslationInterface.php/function/TranslationInterface::translate/8.1.x