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 07:00:21 -0000 @@ -697,7 +697,20 @@ function fix_gpc_magic() { */ function t($string, $args = 0) { global $language; - if (function_exists('locale') && $language->language != 'en') { + static $custom_translations; + + // First, check for an array of custom translations. + // 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_translations variable to improve performance. + if (!isset($custom_translations)) { + $custom_translations = variable_get('custom_translations', array()); + } + if (isset($custom_translations[$language->language][$string])) { + $string = $custom_translations[$language->language][$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.53 diff -u -F^f -r1.53 settings.php --- sites/default/settings.php 26 Mar 2007 06:43:12 -0000 1.53 +++ sites/default/settings.php 28 Mar 2007 06:44:31 -0000 @@ -169,11 +169,23 @@ * the default settings.php. Any configuration setting from the 'variable' * table can be given a new value. * + * !! Please remember that you must save this file by using UTF-8 encoding. !! + * * Remove the leading hash signs to enable. */ # $conf = array( # 'site_name' => 'My Drupal site', # 'theme_default' => 'minnelli', # 'anonymous' => 'Visitor', +# 'custom_translation' => array( +# 'en' => array( +# 'forum' => 'Discussion board', +# 'Who\'s Online' => 'Who\'s wasting time', +# ), +# 'tr' => array( +# 'forum' => 'Fikir meydanı', +# 'Who\'s Online' => 'Kim vakit harcıyor', +# ), +# ), # );