Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.476
diff -u -F^f -r1.476 common.inc
--- includes/common.inc	31 Aug 2005 18:37:30 -0000	1.476
+++ includes/common.inc	8 Sep 2005 20:28:34 -0000
@@ -854,25 +855,30 @@ function format_rss_item($title, $link, 
  *   The string for the plural case. Please make sure it is clear this is plural,
  *   to ease translation. Use %count in place of the item count, as in "%count
  *   new comments".
+ * @param $args
+ *   An associative array of replacements to make after translation. Incidences
+ *   of any key in this array are replaced with the corresponding value.
  * @return
  *   A translated string.
  */
-function format_plural($count, $singular, $plural) {
-  if ($count == 1) return t($singular, array("%count" => $count));
+function format_plural($count, $singular, $plural, $args = array()) {
+  $args['%count'] = $count;
+  if ($count == 1) return t($singular, $args);
 
   // get the plural index through the gettext formula
   $index = (function_exists('locale_get_plural')) ? locale_get_plural($count) : -1;
   if ($index < 0) { // backward compatibility
-    return t($plural, array("%count" => $count));
+    return t($plural, $args);
   }
   else {
     switch ($index) {
       case "0":
-        return t($singular, array("%count" => $count));
+        return t($singular, $args);
       case "1":
-        return t($plural, array("%count" => $count));
+        return t($plural, $args);
       default:
-        return t(strtr($plural, array("%count" => '%count['. $index .']')), array('%count['. $index .']' => $count));
+        $args['%count['. $index .']'] = $count;
+        return t(strtr($plural, array("%count" => '%count['. $index .']')), $args);
     }
   }
 }
Index: modules/forum.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/forum.module,v
retrieving revision 1.268
diff -u -F^f -r1.268 forum.module
--- modules/forum.module	7 Sep 2005 20:56:00 -0000	1.268
+++ modules/forum.module	8 Sep 2005 20:28:35 -0000
@@ -34,6 +34,14 @@ function forum_node_info() {
 }
 
 /**
+ * Implementation of hook_info().
+ */
+function forum_info($key) {
+  $info['depends'] = array('comment', 'node', 'taxonomy');
+  return $info[$key];
+}
+
+/**
  * Implementation of hook_access().
  */
 function forum_access($op, $node) {
Index: modules/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system.module,v
retrieving revision 1.229
diff -u -F^f -r1.229 system.module
--- modules/system.module	28 Aug 2005 18:17:47 -0000	1.229
+++ modules/system.module	8 Sep 2005 20:28:35 -0000
@@ -550,11 +550,41 @@ function system_module_listing() {
   return $output;
 }
 
+/**
+ * Resolve dependencies between modules.
+ */
+function system_module_dependencies(&$edit) {
+  do {
+    $new_module = FALSE;
+    foreach ($edit['status'] as $module => $status) {
+      if ($status) {
+        drupal_load('module', $module);
+        $enabled = array();
+        foreach ((array) module_invoke($module, 'info', 'depends') as $required) {
+          if (!$edit['status'][$required]) {
+            $edit['status'][$required] = 1;
+            $enabled[] = $required;
+          }
+        }
+        if (!empty($enabled)) {
+          $new_module = TRUE;
+          drupal_set_message(format_plural(count($enabled),
+            '%enabled module has been enabled for you because %module needs it to work properly. Please read the documentation of %enabled module about its proper installation (for eg. database tables, permissions and settings).',
+            '%enabled modules has been enabled for you because %module needs them to work properly. Please read the appropriate documentation of %enabled modules for proper installation (for eg. database tables, permissions and settings).', array ('%module' => theme('placeholder', $module), '%enabled' => theme ('placeholder', implode(', ', $enabled)))));
+        }
+      }
+    }
+  } while ($new_module);
+}
+
 function system_listing_save($edit = array()) {
   $op = $_POST['op'];
   $edit = $_POST['edit'];
 
   if ($op == t('Save configuration')) {
+    if ($edit['type'] == 'module') {
+      system_module_dependencies($edit);
+    }
     db_query("UPDATE {system} SET status = 0 WHERE type = '%s'", $edit['type']);
     foreach ($edit['status'] as $name => $status) {
       // Make certain that the default theme is enabled to avoid user error
