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.


$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.

555 calls to t()
aggregator_admin_remove_feed in modules/aggregator.module
aggregator_block in modules/aggregator.module
Implementation of hook_block().
aggregator_form_category in modules/aggregator.module
Generate a form to add/edit/delete aggregator categories.
aggregator_form_category_submit in modules/aggregator.module
Process aggregator_form_category form submissions. @todo Add delete confirmation dialog.
aggregator_form_category_validate in modules/aggregator.module
Validate aggregator_form_feed form submissions.

... See full list

12 string references to 't'
archive_calendar in modules/archive.module
Generates a monthly calendar, for display in the archive block.
taxonomy_autocomplete in modules/taxonomy.module
Helper function for autocompletion
taxonomy_get_children in modules/taxonomy.module
Find all children of a term ID.
taxonomy_get_parents in modules/taxonomy.module
Find all parents of a given term ID.
taxonomy_get_term_by_name in modules/taxonomy.module
Try to map a string to an existing term, as for glossary use.

... See full list


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


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);