function st

cis7 install.inc st($string, array $args = array(), array $options = array())
cle7 install.inc st($string, array $args = array(), array $options = array())
elmsmedia7 install.inc st($string, array $args = array(), array $options = array())
icor7 install.inc st($string, array $args = array(), array $options = array())
meedjum_blog7 install.inc st($string, array $args = array(), array $options = array())
mooc7 install.inc st($string, array $args = array(), array $options = array())

Translates a string when some systems are not available.

Used during the install process, when database, theme, and localization system is possibly not yet available.

Use t() if your code will never run during the Drupal installation phase. Use st() if your code will only run during installation and never any other time. Use get_t() if your code could run in either circumstance.

See also

t()

get_t()

Related topics

38 calls to st()
accessibility_install in sites/all/modules/ulmus/accessibility/accessibility.install
Implements hook_install().
DatabaseTasks::checkEngineVersion in includes/install.inc
Check the engine version.
DatabaseTasks::connect in includes/install.inc
Check if we can connect to the database.
DatabaseTasks::getFormOptions in includes/install.inc
Return driver specific configuration options.
DatabaseTasks::runTasks in includes/install.inc
Run database tasks and tests to see if Drupal can run on the database.

... See full list

7 string references to 'st'
get_t in includes/bootstrap.inc
Returns the name of the proper localization function.
textbook_editor_filter_default_formats in sites/all/modules/elmsln_contrib/textbook/features/textbook_editor/textbook_editor.features.filter.inc
Implements hook_filter_default_formats().
unicode_conversion_map in sites/all/modules/ulmus/typogrify/unicode-conversion.php
Provides Unicode-mapping.
x03.php in sites/all/modules/ulmus/transliteration/data/x03.php
x11.php in sites/all/modules/ulmus/transliteration/data/x11.php

... See full list

File

includes/install.inc, line 1111
API functions for installing modules and themes.

Code

function st($string, array $args = array(), array $options = array()) {
  static $locale_strings = NULL;
  global $install_state;

  if (empty($options['context'])) {
    $options['context'] = '';
  }

  if (!isset($locale_strings)) {
    $locale_strings = array();
    if (isset($install_state['parameters']['profile']) && isset($install_state['parameters']['locale'])) {
      // If the given locale was selected, there should be at least one .po file
      // with its name ending in {$install_state['parameters']['locale']}.po
      // This might or might not be the entire filename. It is also possible
      // that multiple files end with the same extension, even if unlikely.
      $po_files = file_scan_directory('./profiles/' . $install_state['parameters']['profile'] . '/translations', '/' . $install_state['parameters']['locale'] . '\.po$/', array('recurse' => FALSE));
      if (count($po_files)) {
        require_once DRUPAL_ROOT . '/includes/locale.inc';
        foreach ($po_files as $po_file) {
          _locale_import_read_po('mem-store', $po_file);
        }
        $locale_strings = _locale_import_one_string('mem-report');
      }
    }
  }

  // Transform arguments before inserting them
  foreach ($args as $key => $value) {
    switch ($key[0]) {
      // Escaped only
      case '@':
        $args[$key] = check_plain($value);
        break;
        // Escaped and placeholder
      case '%':
      default:
        $args[$key] = '<em>' . check_plain($value) . '</em>';
        break;
        // Pass-through
      case '!':
    }
  }
  return strtr((!empty($locale_strings[$options['context']][$string]) ? $locale_strings[$options['context']][$string] : $string), $args);
}