TranslationManager::doTranslate

protected TranslationManager::doTranslate($string, array $options = array()) Translates a string to the current language or to a given language. Parameters string $string: A string containing the English text to translate. array $options: An associative array of additional options, with the following elements: 'langcode': The language code to translate to a language other than what is used to display the page. 'context': The context the source string belongs to. Return value string The tr

TranslationManager::formatPlural

public TranslationManager::formatPlural($count, $singular, $plural, array $args = array(), array $options = array()) 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. For example: $output = $string_translation->formatPlural($node->comment_c

TranslationManager::getStringTranslation

public TranslationManager::getStringTranslation($langcode, $string, $context) Retrieves English string to given language. Parameters string $langcode: Language code to translate to. string $string: The source string. string $context: The string context. Return value string|false Translated string if there is a translation, FALSE if not. Overrides TranslatorInterface::getStringTranslation File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 92 Class TranslationManager

TranslationManager::reset

public TranslationManager::reset() Resets translation cache. Since most translation systems implement some form of caching, this provides a way to delete that cache. Overrides TranslatorInterface::reset File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 169 Class TranslationManager Defines a chained translation implementation combining multiple translators. Namespace Drupal\Core\StringTranslation Code public function reset() { if ($this->sortedTranslators ===

TranslationManager::setDefaultLangcode

public TranslationManager::setDefaultLangcode($langcode) Sets the default langcode. Parameters string $langcode: A language code. File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 162 Class TranslationManager Defines a chained translation implementation combining multiple translators. Namespace Drupal\Core\StringTranslation Code public function setDefaultLangcode($langcode) { $this->defaultLangcode = $langcode; }

TranslationManager::sortTranslators

protected TranslationManager::sortTranslators() Sorts translators according to priority. Return value \Drupal\Core\StringTranslation\Translator\TranslatorInterface[] A sorted array of translator objects. File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 79 Class TranslationManager Defines a chained translation implementation combining multiple translators. Namespace Drupal\Core\StringTranslation Code protected function sortTranslators() { $sorted = array();

TranslationManager::translate

public TranslationManager::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. Parame

TranslationManager::__construct

public TranslationManager::__construct(LanguageDefault $default_language) Constructs a TranslationManager object. Parameters \Drupal\Core\Language\LanguageDefault $default_language: The default language. File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 52 Class TranslationManager Defines a chained translation implementation combining multiple translators. Namespace Drupal\Core\StringTranslation Code public function __construct(LanguageDefault $default_language)

TranslationsStream

Defines a Drupal translations (translations://) stream wrapper class. Provides support for storing translation files. Hierarchy class \Drupal\Core\StreamWrapper\LocalStream implements StreamWrapperInterfaceclass \Drupal\locale\StreamWrapper\TranslationsStream File core/modules/locale/src/StreamWrapper/TranslationsStream.php, line 13 Namespace Drupal\locale\StreamWrapper Members Name Modifiers Type Description LocalStream::$context public property Stream context resource

TranslationsStream::getDescription

public TranslationsStream::getDescription() Returns the description of the stream wrapper for use in the UI. Return value string The stream wrapper description. Overrides StreamWrapperInterface::getDescription File core/modules/locale/src/StreamWrapper/TranslationsStream.php, line 32 Class TranslationsStream Defines a Drupal translations (translations://) stream wrapper class. Namespace Drupal\locale\StreamWrapper Code public function getDescription() { return t('Translation files')