Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.624 diff -u -F^f -r1.624 common.inc --- includes/common.inc 27 Mar 2007 05:13:53 -0000 1.624 +++ includes/common.inc 28 Mar 2007 20:57:33 -0000 @@ -697,7 +697,21 @@ function fix_gpc_magic() { */ function t($string, $args = 0) { global $language; - if (function_exists('locale') && $language->language != 'en') { + static $custom_texts; + + // First, check for an array of custom texts. + // If present, use the array *instead of* database lookups. + // This is a high performance way to provide a handful of string replacements. + // See end of settings.php. + // Cache the $custom_texts variable to improve performance. + if (!isset($custom_texts)) { + $custom_texts = variable_get('custom_texts', array()); + } + // Custom texts are only available for English + if ($language->language == 'en' && isset($custom_texts[$string])) { + $string = $custom_texts[$string]; + } + elseif (function_exists('locale') && $language->language != 'en') { $string = locale($string); } if (!$args) { Index: sites/default/settings.php =================================================================== RCS file: /cvs/drupal/drupal/sites/default/settings.php,v retrieving revision 1.54 diff -u -F^f -r1.54 settings.php --- sites/default/settings.php 28 Mar 2007 14:08:22 -0000 1.54 +++ sites/default/settings.php 28 Mar 2007 20:53:45 -0000 @@ -176,3 +176,17 @@ # 'anonymous' => 'Visitor', # ); +/** + * String overrides: + * + * To override specific strings on your site, add an entry in this list. + * You may need this functionality if you want to change your site's English + * interface strings. + * + * Remove the leading hash signs to enable. + */ +# $custom_texts = array( +# 'forum' => 'Discussion board', +# '@count min' => '@count minutes', +# ); +# $conf['custom_texts'] = $custom_texts;