8.5.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.3.x bootstrap.inc t($string, array $args = [], array $options = [])
8.4.x bootstrap.inc t($string, array $args = [], array $options = [])
8.6.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.

3 string references to 't'
archive_calendar in modules/archive.module
Generates a monthly calendar, for display in the archive block.
_locale_admin_export_screen in includes/locale.inc
User interface for the translation export screen
_locale_admin_import_screen in includes/locale.inc
User interface for the translation import screen

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