You are here

public function TranslatableTrait::t in Backup and Migrate 5.0.x

Translate the given string if there is a translator service available.

Parameters

$string:

$replacements:

$context:

Return value

mixed

9 calls to TranslatableTrait::t()
ConfigurableTrait::configErrors in src/Core/Config/ConfigurableTrait.php
Get any validation errors in the config.
DBExcludeFilter::configSchema in src/Core/Filter/DBExcludeFilter.php
Get a definition for user-configurable settings.
DirectoryDestination::configSchema in src/Core/Destination/DirectoryDestination.php
Get a definition for user-configurable settings.
DirectoryDestination::getAllFileNames in src/Core/Destination/DirectoryDestination.php
Get the entire file list from this destination.
DrupalEncrypt::configSchema in src/Drupal/Filter/DrupalEncrypt.php
Get a default (blank) schema.

... See full list

File

src/Core/Translation/TranslatableTrait.php, line 37

Class

TranslatableTrait
This trait can be used to implement the TranslatableInterface.

Namespace

Drupal\backup_migrate\Core\Translation

Code

public function t($string, $replacements = [], $context = []) {

  // If there is no translation service available use a passthrough to send
  // back the original (en-us) string.
  if (empty($this->translator)) {
    $this->translator = new PassthroughTranslator();
  }
  return $this->translator
    ->translate($string, $replacements, $context);
}