st
includes/install.inc, строка 627
- Версии
- 5 – 6
st($string, $args = array())
Жёстко запрограммированная функция, являющаяся эквивалентом функции t()
в ходе инсталляции, когда база данных, тема и система локализации возможно ещё не доступны.
Код
<?php
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);
}
?>
Войдите или зарегистрируйтесь, чтобы получить возможность отправлять комментарии