st

Versions
5 – 7
st($string, $args = array())

Functional equivalent of t(), used when some systems are not available.

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

See also

t()

▾ 8 functions call st()

default_install in profiles/default/default.install
Implement hook_install().
drupal_rewrite_settings in includes/install.inc
Replace values in settings.php with values in the submitted array.
drupal_verify_profile in includes/install.inc
Verify an install profile for installation.
example_form in developer/example.profile
Form API array definition for the example form.
example_profile_tasks in developer/example.profile
Perform any final installation tasks for this profile.
example_profile_task_list in developer/example.profile
Return a list of tasks that this profile supports.
hook_install_tasks in modules/system/system.api.php
Return an array of tasks to be performed by an installation profile.
theme_install_page in includes/theme.maintenance.inc
Generate a themed installation page.

Code

includes/install.inc, line 938

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

  if (!isset($locale_strings)) {
    $locale_strings = array();
    if (isset($install_state['parameters']['profile']) && isset($install_state['parameters']['locale'])) {
      $filename = 'profiles/' . $install_state['parameters']['profile'] . '/translations/' . $install_state['parameters']['locale'] . '.po';
      if (file_exists(DRUPAL_ROOT . '/' . $filename)) {
        require_once DRUPAL_ROOT . '/includes/locale.inc';
        $file = (object) array('uri' => $filename);
        _locale_import_read_po('mem-store', $file);
        $locale_strings = _locale_import_one_string('mem-report');
      }
    }
  }

  require_once DRUPAL_ROOT . '/includes/theme.inc';
  // 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[$string]) ? $locale_strings[$string] : $string), $args);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.