You are here

public function SplitCommandBase::t in Configuration Split 8

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

src/Command/SplitCommandBase.php, line 44

Class

SplitCommandBase
Class SplitCommandBase for shared functionality.

Namespace

Drupal\config_split\Command

Code

public function t($string, array $args = []) {
  $c = 'commands.' . strtr($this
    ->getName(), [
    ':' => '.',
  ]) . '.messages.';
  $translations = [
    'Configuration successfully exported.' => $c . 'success',
  ];
  if (array_key_exists($string, $translations)) {
    $string = $translations[$string];
  }

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