You are here

public function PullCommand::t in Entity Share 8

Same name and namespace in other branches
  1. 8.2 modules/entity_share_client/src/Command/PullCommand.php \Drupal\entity_share_client\Command\PullCommand::t()

The translation function akin to drupal's t().

Parameters

string $string: The string to translate.

array $args: The replacements.

Return value

string The translated string.

File

modules/entity_share_client/src/Command/PullCommand.php, line 89

Class

PullCommand
Class PullCommand.

Namespace

Drupal\entity_share_client\Command

Code

public function t($string, array $args = []) {
  $c = 'commands.' . strtr($this
    ->getName(), [
    ':' => '.',
  ]) . '.messages.';
  $translations = [
    'Channel successfully pulled. Execution time @time ms.' => $c . 'success',
    'There is no remote website configured with the id: @remote_id.' => $c . 'no_remote',
    'There is no channel configured or accessible with the id: @channel_id.' => $c . 'no_channel',
    'Beginning to import content from URL: @url' => $c . 'beginning_url_import',
    '@number entities have been imported.' => $c . 'number_imported',
    'Looking for new content in channel @channel' => $c . 'update_channel_lookup',
    'Looking for updated content at URL: @url' => $c . 'update_page_lookup',
    'Channel successfully pulled. Number of updated entities: @count, execution time: @time ms' => $c . 'update_success',
  ];
  if (array_key_exists($string, $translations)) {
    $string = $translations[$string];
  }

  // Translate with consoles translations.
  return strtr($this
    ->trans($string), $args);
}