Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. TranslatableStringAdapter.php

function TranslatableStringAdapter::trans

Overrides TranslatableInterface::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'));
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal