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::$translators

An unsorted array of arrays of active translators. An associative array. The keys are integers that indicate priority. Values are arrays of TranslatorInterface objects. Type: \Drupal\Core\StringTranslation\Translator\TranslatorInterface[][] See also \Drupal\Core\StringTranslation\TranslationManager::addTranslator() \Drupal\Core\StringTranslation\TranslationManager::sortTranslators() File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 24 Class TranslationManager Define

TranslationManager::addTranslator

public TranslationManager::addTranslator(TranslatorInterface $translator, $priority = 0) Appends a translation system to the translation chain. Parameters \Drupal\Core\StringTranslation\Translator\TranslatorInterface $translator: The translation interface to be appended to the translation chain. int $priority: The priority of the logger being added. Return value $this File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 66 Class TranslationManager Defines a chained tr

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::$defaultLangcode

The default langcode used in translations. A language code. Type: string File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 44 Class TranslationManager Defines a chained translation implementation combining multiple translators. Namespace Drupal\Core\StringTranslation Code protected $defaultLangcode;

TranslationManager::$sortedTranslators

An array of translators, sorted by priority. If this is NULL a rebuild will be triggered. Type: null|\Drupal\Core\StringTranslation\Translator\TranslatorInterface[] See also \Drupal\Core\StringTranslation\TranslationManager::addTranslator() \Drupal\Core\StringTranslation\TranslationManager::sortTranslators() File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 36 Class TranslationManager Defines a chained translation implementation combining multiple translators. Nam

TranslationManager

Defines a chained translation implementation combining multiple translators. Hierarchy class \Drupal\Core\StringTranslation\TranslationManager implements TranslationInterface, TranslatorInterface File core/lib/Drupal/Core/StringTranslation/TranslationManager.php, line 11 Namespace Drupal\Core\StringTranslation Members Name Modifiers Type Description TranslationManager::$defaultLangcode protected property The default langcode used in translations. TranslationManager::$s

TranslationInterface::translate

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. Para

Translation::__construct

public Translation::__construct(array $values) Constructs a new class instance. Parses values passed into this class through the t() function in Drupal and handles an optional context for the string. Parameters array $values: Possible array keys: value (required): the string that is to be translated. arguments (optional): an array with placeholder replacements, keyed by placeholder. context (optional): a string that describes the context of "value"; File core/lib/Drupal/Core/Annotation/Tr