8.3.x bootstrap.inc t($string, array $args = [], array $options = [])
8.0.x bootstrap.inc t($string, array $args = array(), array $options = array())
8.1.x bootstrap.inc t($string, array $args = array(), array $options = array())
8.2.x bootstrap.inc t($string, array $args = array(), array $options = array())
8.4.x bootstrap.inc t($string, array $args = [], array $options = [])
4.6.x common.inc t($string, $args = 0)
4.7.x common.inc t($string, $args = 0)
5.x common.inc t($string, $args = 0)
6.x common.inc t($string, $args = array(), $langcode = NULL)
7.x bootstrap.inc t($string, array $args = array(), array $options = array())

Translate strings to the current locale.

When using t(), try to put entire sentences and strings in one t() call. This makes it easier for translators. HTML markup within translation strings is acceptable, if necessary. The suggested syntax for a link embedded within a translation string is:

  $msg = t('You must log in below or <a href="%url">create a new
            account</a> before viewing the next page.', array('%url'
            => url('user/register')));

We suggest the same syntax for links to other sites. This makes it easy to change link URLs if needed (which happens often) without requiring updates to translations.

Parameters

$string: A string containing the English string to translate.

$args: An associative array of replacements to make after translation. Incidences of any key in this array are replaced with the corresponding value.

Return value

The translated string.

444 calls to t()
aggregator_admin_edit_category in modules/aggregator.module
Menu callback; displays the category edit form, or saves changes and redirects to the overview page.
aggregator_admin_edit_feed in modules/aggregator.module
Menu callback; displays the feed edit form.
aggregator_block in modules/aggregator.module
Implementation of hook_block().
aggregator_edit in modules/aggregator.module
aggregator_form_category in modules/aggregator.module

... See full list

1 string reference to 't'
archive_calendar in modules/archive.module
Generates a monthly calendar, for display in the archive block.

File

includes/common.inc, line 535
Common functions that many Drupal modules will need to reference.

Code

function t($string, $args = 0) {
  global $locale;
  if (function_exists('locale') && $locale != 'en') {
    $string = locale($string);
  }

  if (!$args) {
    return $string;
  }
  else {
    return strtr($string, $args);
  }
}