function dt

8.0.x dt($string, $args = array())
6.x dt($string, $args = array())
7.x dt($string, $args = array())
3.x dt($string, $args = array())
4.x dt($string, $args = array())
5.x dt($string, $args = array())
master dt($string, $args = array())

Rudimentary replacement for Drupal API t() function.


string: String to process, possibly with replacement item.

array: An associative array of replacement items.

Return value

The processed string.

See also


Related topics

340 calls to dt()
BaseBoot::bootstrap_and_dispatch in lib/Drush/Boot/BaseBoot.php
Main entrypoint to bootstrap the selected CMS and execute the selected command.
BaseBoot::report_command_error in lib/Drush/Boot/BaseBoot.php
Called by Drush if a command is not found, or if the command was found, but did not meet requirements.
cache_drush_help in commands/core/
Implementation of hook_drush_help().
config_drush_help in commands/core/
Implementation of hook_drush_help().
core_drush_help in commands/core/
Implementation of hook_drush_help().

... See full list

1 string reference to 'dt'
_drush_command_translate in includes/
Helper function for drush_command_translate().


includes/, line 147


function dt($string, $args = array()) {
  $output = NULL;
  if (function_exists('t') && drush_drupal_major_version() == 7) {
    $output = t($string, $args);
  // The language system requires a working container which has the string
  // translation service.
  else if (drush_drupal_major_version() >= 8 && \Drupal::hasService('string_translation')) {
    // Drupal 8 removes !var replacements, creating a user-level error when
    // these are used, so we'll pre-replace these before calling translate().
    $legacy_args = find_legacy_dt_args($args);
    $string = strtr($string, $legacy_args);
    // Remove the legacy replacements.
    foreach (array_keys($legacy_args) as $legacy_arg_key) {
    $output = \Drupal::translation()->translate($string, $args);
  else if (function_exists('t') && drush_drupal_major_version() <= 7 && function_exists('theme')) {
    $output = t($string, $args);

  // If Drupal's t() function unavailable.
  if (!isset($output)) {
    if (!empty($args)) {
      $output = strtr($string, $args);
    else {
      $output = $string;
  return $output;