function st
7.x install.inc | st($string, array $args = array(), array |
6.x install.inc | st($string, $args = array()) |
Hardcoded function for doing the equivalent of t() during the install process, when database, theme, and localization system is possibly not yet available.
25 calls to st()
- default_profile_tasks in drupal-6.x/
profiles/ default/ default.profile - Perform any final installation tasks for this profile.
- drupal_rewrite_settings in drupal-6.x/
includes/ install.inc - Read settings.php into a buffer line by line, changing values specified in $settings array, then over-writing the old settings.php file.
- drupal_test_mysql in drupal-6.x/
includes/ install.mysql.inc - Check if we can connect to MySQL.
- drupal_test_mysqli in drupal-6.x/
includes/ install.mysqli.inc - Check if we can connect to MySQL.
- drupal_test_pgsql in drupal-6.x/
includes/ install.pgsql.inc - Check if we can connect to PostgreSQL.
1 string reference to 'st'
- get_t in drupal-6.x/
includes/ bootstrap.inc - Return the name of the localisation function. Use in code that needs to run both during installation and normal operation.
File
- drupal-6.x/
includes/ install.inc, line 627
Code
function st($string, $args = array()) {
static $locale_strings = NULL;
global $profile, $install_locale;
if (!isset($locale_strings)) {
$locale_strings = array();
$filename = './profiles/' . $profile . '/translations/' . $install_locale . '.po';
if (file_exists($filename)) {
require_once './includes/locale.inc';
$file = (object) array('filepath' => $filename);
_locale_import_read_po('mem-store', $file);
$locale_strings = _locale_import_one_string('mem-report');
}
}
require_once './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);
}