Index: advanced_help.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advanced_help/advanced_help.module,v
retrieving revision 1.31
diff -u -r1.31 advanced_help.module
--- advanced_help.module	17 Oct 2008 20:05:24 -0000	1.31
+++ advanced_help.module	17 Oct 2008 22:00:28 -0000
@@ -211,7 +211,7 @@
         else {
          $name = t($module_name);
         }
-        $items[] = advanced_help_l($name, "admin/advanced_help/$module");
+        $items[] = advanced_help_l(advanced_help_t($name), "admin/advanced_help/$module");
       }
     }
 
@@ -242,7 +242,7 @@
   $items = array();
   foreach ($topic_ids as $info) {
     list($module, $topic) = $info;
-    $item = advanced_help_l($topics[$module][$topic]['title'], "help/$module/$topic");
+    $item = advanced_help_l(advanced_help_t($topics[$module][$topic]['title']), "help/$module/$topic");
     if (!empty($topics[$module][$topic]['children']) && ($max_depth == -1 || $depth < $max_depth)) {
       $item .= theme('item_list', advanced_help_get_tree($topics, $topics[$module][$topic]['children'], $max_depth, $depth + 1));
     }
@@ -382,10 +382,10 @@
       break;
     }
 
-    $breadcrumb[] = advanced_help_l($parent['title'], "help/$pmodule/$ptopic");
+    $breadcrumb[] = advanced_help_l(advanced_help_t($parent['title']), "help/$pmodule/$ptopic");
   }
 
-  $breadcrumb[] = advanced_help_l(advanced_help_get_module_name($pmodule), "admin/advanced_help/$pmodule");
+  $breadcrumb[] = advanced_help_l(advanced_help_t(advanced_help_get_module_name($pmodule)), "admin/advanced_help/$pmodule");
   $breadcrumb[] = advanced_help_l(t('Help'), "admin/advanced_help");
 
   $output = advanced_help_view_topic($module, $topic, $popup);
@@ -578,13 +578,13 @@
         $navigation = '<div class="help-navigation clear-block">';
 
         if ($prev) {
-          $navigation .= advanced_help_l('<< ' . $topics[$prev[0]][$prev[1]]['title'], "help/$prev[0]/$prev[1]", array('attributes' => array('class' => 'help-left')));
+          $navigation .= advanced_help_l(advanced_help_t('<< @title', array('@title' => $topics[$prev[0]][$prev[1]]['title'])), "help/$prev[0]/$prev[1]", array('attributes' => array('class' => 'help-left')));
         }
         if ($up) {
           $navigation .= advanced_help_l(t('Up'), $up, array('attributes' => array('class' => $prev ? 'help-up' : 'help-up-noleft')));
         }
         if ($next) {
-          $navigation .= advanced_help_l($topics[$next[0]][$next[1]]['title'] . ' >>', "help/$next[0]/$next[1]", array('attributes' => array('class' => 'help-right')));
+          $navigation .= advanced_help_l(advanced_help_t('@title >>', array('@title' => $topics[$next[0]][$next[1]]['title'])), "help/$next[0]/$next[1]", array('attributes' => array('class' => 'help-right')));
         }
 
         $navigation .= '</div>';
@@ -866,6 +866,58 @@
   return l($text, $dest, $options);
 }
 
+function advanced_help_t($string, $args = array(), $langcode = NULL) {
+  global $language;
+  static $custom_strings;
+
+  $langcode = isset($langcode) ? $langcode : $language->language;
+
+  // 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[$langcode])) {
+    $custom_strings[$langcode] = variable_get('locale_custom_strings_'. $langcode, array());
+  }
+  // Custom strings work for English too, even if locale module is disabled.
+  if (isset($custom_strings[$langcode][$string])) {
+    $string = $custom_strings[$langcode][$string];
+  }
+  // Translate with locale module if enabled.
+  elseif (function_exists('locale') && $langcode != 'en') {
+    $string = advanced_help_locale($string, $langcode);
+  }
+  if (empty($args)) {
+    return $string;
+  }
+  else {
+    // Transform arguments before inserting them.
+    foreach ($args as $key => $value) {
+      switch ($key[0]) {
+        case '@':
+          // Escaped only.
+          $args[$key] = check_plain($value);
+          break;
+
+        case '%':
+        default:
+          // Escaped and placeholder.
+          $args[$key] = theme('placeholder', $value);
+          break;
+
+        case '!':
+          // Pass-through.
+      }
+    }
+    return strtr($string, $args);
+  }
+}
+
+function advanced_help_locale($string = NULL, $langcode = NULL, $reset = FALSE) {
+  // TODO: We need to read the strings from the .ini files here.
+  
+}
+
 /**
  * Format a URL but preserve popup identity.
  */
