summaryrefslogtreecommitdiff
path: root/includes/install.inc
diff options
context:
space:
mode:
authorSteven Wittens <steven@10.no-reply.drupal.org>2006-08-18 12:17:00 +0000
committerSteven Wittens <steven@10.no-reply.drupal.org>2006-08-18 12:17:00 +0000
commit81938a3cdc7b9bd13d58e355c59d9835e830fea4 (patch)
tree4d6156a6edb7898d74d5b1836b80d08750aa39c2 /includes/install.inc
parent885a29c4cd13776165c40080a00180cddd420a46 (diff)
downloadbrdo-81938a3cdc7b9bd13d58e355c59d9835e830fea4.tar.gz
brdo-81938a3cdc7b9bd13d58e355c59d9835e830fea4.tar.bz2
#76802: Introduce placeholder magic into t()
See: http://drupal.org/node/64279#t-placeholders
Diffstat (limited to 'includes/install.inc')
-rw-r--r--includes/install.inc24
1 files changed, 23 insertions, 1 deletions
diff --git a/includes/install.inc b/includes/install.inc
index 77dd88d54..1de8261ee 100644
--- a/includes/install.inc
+++ b/includes/install.inc
@@ -550,5 +550,27 @@ function install_goto($path) {
*/
function st($string, $args = array()) {
require_once './includes/theme.inc';
- return strtr($string, array_map('theme_placeholder', $args));
+ $GLOBALS['theme'] = 'theme';
+ // Transform arguments before inserting them
+ array_walk($args, '_st');
+ return strtr($string, $args);
+}
+
+/**
+ * Helper function: apply the appropriate transformation to st() and t() placeholders.
+ */
+function _st(&$value, $key) {
+ switch ($key[0]) {
+ // Escaped only
+ case '@':
+ $value = check_plain($value);
+ return;
+ // Escaped and placeholder
+ case '%':
+ default:
+ $value = '<em>'. check_plain($value) .'</em>';
+ return;
+ // Pass-through
+ case '!':
+ }
}