function TranslatableStringAdapter::trans

File

core/modules/package_manager/src/TranslatableStringAdapter.php, line 39

Class

TranslatableStringAdapter
An adapter for interoperable string translation.

Namespace

Drupal\package_manager

Code

public function trans(?TranslatorInterface $translator = NULL, ?string $locale = NULL) : string {
    // This method is NEVER used by Drupal to translate the underlying string;
    // it exists solely for Composer Stager's translation system to
    // transparently translate Drupal strings using its own architecture.
    return $translator->trans($this->getUntranslatedString(), $this, $this->getOption('context'), $locale ?? $this->getOption('langcode'));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.