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

▾ 25 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.
install_already_done_error in ./install.php
Indicate that Drupal has already been installed.
install_check_requirements in ./install.php
Check installation requirements and report any errors.
install_configure_form in ./install.php
Installation task; configure settings for the new site.
install_database_errors in ./install.php
Check a database connection and return any errors.
install_finished in ./install.php
Installation task; perform final steps and display a 'finished' page.
install_load_profile in ./install.php
Installation task; load information about the chosen profile.
install_no_profile_error in ./install.php
Indicate that there are no profiles available.
install_profile_modules in ./install.php
Installation task; install required modules via a batch process.
install_select_locale in ./install.php
Installation task; select which locale to use for the current profile.
install_select_locale_form in ./install.php
Form API array definition for language selection.
install_select_profile in ./install.php
Installation task; select which profile to install.
install_select_profile_form in ./install.php
Form API array definition for the profile selection form.
install_settings_form in ./install.php
Installation task; define a form to configure and rewrite settings.php.
install_tasks in ./install.php
Return a list of all tasks the installer currently knows about.
install_verify_requirements in ./install.php
Installation task; verify the requirements for installing Drupal.
theme_install_page in includes/theme.maintenance.inc
Generate a themed installation page.
_install_configure_form in ./install.php
Form API array definition for site configuration.
_install_module_batch in ./install.php
Batch callback for batch installation of modules.

Code

includes/install.inc, line 939

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