Index: sites/default/settings.php =================================================================== RCS file: /cvs/drupal/drupal/sites/default/settings.php,v retrieving revision 1.54 diff -u -r1.54 settings.php --- sites/default/settings.php 28 Mar 2007 14:08:22 -0000 1.54 +++ sites/default/settings.php 9 Apr 2007 19:36:54 -0000 @@ -176,3 +176,16 @@ # 'anonymous' => 'Visitor', # ); +/** + * String overrides: + * + * To override specific strings on your site, add an entry to this list. + * This functionality allows you to change a small number of your site's + * default English language interface strings. + * + * Remove the leading hash signs to enable. + */ +# $conf['custom_strings'] = array( +# 'forum' => 'Discussion board', +# '@count min' => '@count minutes', +# ); Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.627 diff -u -r1.627 common.inc --- includes/common.inc 6 Apr 2007 13:27:20 -0000 1.627 +++ includes/common.inc 9 Apr 2007 19:36:54 -0000 @@ -697,7 +697,20 @@ */ function t($string, $args = 0) { global $language; - if (function_exists('locale') && $language->language != 'en') { + static $custom_strings; + + // First, check for an array of customized strings. If present, use the array + // *instead of* database lookups. This is a high performance way to provide a + // handful of string replacements. See settings.php for examples. + // Cache the $custom_strings variable to improve performance. + if (!isset($custom_strings)) { + $custom_strings = variable_get('custom_strings', array()); + } + // Custom strings are only available for English. + if ($language->language == 'en' && isset($custom_strings[$string])) { + $string = $custom_strings[$string]; + } + elseif (function_exists('locale') && $language->language != 'en') { $string = locale($string); } if (!$args) {