--- og.module	Fri Jan 16 05:21:36 1970
+++ og.module	Fri Jan 16 05:21:36 1970
@@ -675,6 +675,10 @@
   }
 
   if (!empty($node) && og_is_group_type($node->type)) {
+    // Translated group nodes refer to their translation source as group node.
+    if (og_group_is_translation($node)) {
+      $node = node_load($node->tnid);
+    }
     $stored_group_node = $node;
   }
   return !empty($stored_group_node) ? $stored_group_node : NULL;
@@ -1154,13 +1158,22 @@
 
 // Returns all the group affiliations for a given node.
 function og_get_node_groups($node) {
+  $nid = $node->nid;
+  if(og_group_is_translation($node)) {
+    $nid = $node->tnid;
+  }
+
   $groups = array();
   if (!og_is_group_type($node->type)) {
-    $result = og_get_node_groups_result($node->nid);
+    $result = og_get_node_groups_result($nid);
     while ($row = db_fetch_object($result)) {
       $groups[$row->group_nid] = $row->title;
     }
   }
+
+  // Translate group titles.
+  $groups = og_group_array_translation($groups);
+
   return $groups;
 }
 
@@ -1331,7 +1344,8 @@
       db_query($sql, $node->nid);
       break;
     case 'insert':
-      if (og_is_group_type($node->type)) {
+      // Translated group nodes won't be treated as groups because we only use the translation source as group.
+      if (og_is_group_type($node->type) && !og_group_is_translation($node)) {
         og_insert_group($node);
         // Make sure the node owner is a full powered member.
         og_save_subscription($node->nid, $node->uid, array('is_active' => 1, 'is_admin' => 1));
@@ -1364,7 +1378,8 @@
       }
       break;
     case 'update':
-      if (og_is_group_type($node->type)) {
+      // Translated group nodes won't be treated as groups because we only use the translation source as group.
+      if (og_is_group_type($node->type) && !og_group_is_translation($node)) {
         og_update_group($node);
         if ($node->uid > 0) {
           // Make sure the node owner is a full powered member.
@@ -1432,7 +1447,7 @@
   // Add audience selection to node forms
   if (isset($form['#node']) && $form_id == $form['#node']->type .'_node_form') {
     $node = $form['#node'];
-    if (og_is_group_type($node->type)) {
+    if (!og_group_is_translation($node) && og_is_group_type($node->type)) {
       $form = array_merge($form, og_group_form($node, $form_state));
 
       // Don't trample on custom label.
@@ -1559,6 +1574,21 @@
     '#size' => 3,
     '#description' => t('If the usage is standard group post, specify the number of groups the nodes of this type may be posted into. Leave blank for no limit.'),
   );
+
+  if (module_exists('translation')) {
+    if (isset($form['identity']['type']['#default_value'])) {
+      $group_translation = variable_get('og_group_translation_'. $form['identity']['type']['#default_value'], FALSE);
+    }
+    else {
+      $group_translation = variable_get('og_group_translation_'. $form['identity']['type']['#value'], FALSE);
+    }
+    $form['og']['og_group_translation'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('One group for all translations'),
+      '#default_value' => $group_translation,
+      '#description' => t('Each translation will not create a new group and will only be used as a translation for its source group node. If not selected and translations are enabled on a group, each translation will be a new group.'),
+    );
+  }
 }
 
 // Add option to migrate messages before deleting a group.
@@ -1731,6 +1761,18 @@
     // Do nothing.
   }
   else {
+    // Turn off content translation.
+    if (module_exists('translation')) {
+      if (module_exists('i18n')) {
+        $i18n_mode = i18n_selection_mode();
+        i18n_selection_mode('off');
+      }
+      if (module_exists('active_translation')) {
+        $at_mode = active_translation_mode();
+        active_translation_mode('off');
+      }
+    }
+
     $placeholders = db_placeholders($groups_names_both);
     $sql = 'SELECT n.nid FROM {node} n WHERE n.nid IN ('. $placeholders. ')';
     $result = db_query(db_rewrite_sql($sql), array_keys($groups_names_both));
@@ -1746,6 +1788,16 @@
       // Don't return groups that the user has already joined (default).
       $current_groups['accessible'] = array_diff_assoc($current_groups['accessible'], $user->og_groups);
     }
+
+    // Turn content translation back on.
+    if (module_exists('translation')) {
+      if (module_exists('i18n')) {
+        i18n_selection_mode($i18n_mode);
+      }
+      if (module_exists('active_translation')) {
+        active_translation_mode($at_mode);
+      }
+    }
   }
 
   return $current_groups;
@@ -1853,6 +1905,9 @@
     $form['og_nodeapi']['#weight'] = content_extra_field_weight($form['#node']->type, 'og_nodeapi');
   }
 
+  // Alter audience option titles to be correct translation.
+  $options = og_group_array_translation($options);
+
   // Emit the audience form element.
   if ($simple) {
     // 'simple' mode. read only.
@@ -2055,6 +2110,7 @@
     case 'delete':
       variable_del('og_content_type_usage_'. $info->type);
       variable_del('og_max_groups_'. $info->type);
+      variable_del('og_group_translation_'. $info->type);
       break;
     case 'update':
       if (isset($info->old_type)) {
@@ -2283,8 +2339,11 @@
     // Modify these links by reference. If you want control of the whole block, see og_block_details().
     drupal_alter('og_links', $links, $node);
 
+    $trans = array($node->nid => $node->title);
+    $trans = og_group_array_translation($trans);
+
     $block['content'] = theme('item_list', $links);
-    $block['subject'] = l($node->title, "node/$node->nid");
+    $block['subject'] = l($trans[$node->nid], "node/$node->nid");
     return $block;
   }
 }
@@ -2462,4 +2521,59 @@
  */
 function og_broadcast_access($node) {
   return og_is_group_admin($node) && module_exists('og_notifications');
-}
\ No newline at end of file
+}
+
+/**
+ * Translate array of node titles.
+ *
+ * @param $options array($node->nid => $node->title)
+ */
+function og_group_array_translation($options) {
+  global $language;
+
+  $new_options = $options;
+
+  // Audience support
+  if (isset($options['My groups'])) {
+    foreach ($options['My groups'] as $gid => $title) {
+      $translations = translation_node_get_translations($gid);
+      if (count($translations) && isset($translations[$language->language])) {
+        $new_options['My groups'][$gid] = $translations[$language->language]->title;
+      }
+    }
+  }
+  if (isset($options['Other groups'])) {
+    foreach ($options['Other groups'] as $gid => $title) {
+      $translations = translation_node_get_translations($gid);
+      if (count($translations) && isset($translations[$language->language])) {
+        $new_options['Other groups'][$gid] = $translations[$language->language]->title;
+      }
+    }
+  }
+
+  foreach ($options as $gid => $title) {
+    if (is_numeric($gid) && !is_array($title)) {
+      $translations = translation_node_get_translations($gid);
+      if (count($translations) && isset($translations[$language->language])) {
+        $new_options[$gid] = $translations[$language->language]->title;
+      }
+    }
+  }
+
+  return $new_options;
+}
+
+function og_group_is_translation($node) {
+  // Check if group translation are enabled
+  if (!variable_get('og_group_translation_'. $node->type, FALSE)) {
+    return FALSE;
+  }
+
+  // Check if it is a new translation being created.
+  if (!empty($node->translation_source) && isset($node->translation_source->nid)) {
+    return TRUE;
+  }
+
+  // Existing node check
+  return $node->tnid != 0 && $node->tnid !== $node->nid ? TRUE : FALSE;
+}
--- og.install	Fri Jan 16 05:21:36 1970
+++ og.install	Fri Jan 16 05:21:36 1970
@@ -462,6 +462,7 @@
 
   foreach (node_get_types() as $type_name => $type) {
     $variables[] = 'og_max_groups_' . $type_name;
+    $variables[] = 'og_group_translation_' . $type_name;
   }
 
   foreach ($variables as $variable) {
--- modules/og_views/og_views.module	Fri Jan 16 05:21:36 1970
+++ modules/og_views/og_views.module	Fri Jan 16 05:21:36 1970
@@ -195,13 +195,16 @@
  */
 function og_views_view_group($node, $teaser, $page) {
   if ($name = variable_get('og_home_page_view', 'og_ghp_ron')) {
+    // When a group node is translated we use the translation source nid
+    $nid = og_group_is_translation($node) ? $node->tnid : $node->nid;
+
     // There is a view defiened to act as the group's home page.
     $view = views_get_view($name);
     if (!$view) {
       drupal_set_message(t('The View %name was not found. Check your variables table or settings.php.', array('%name' => $name)), 'error');
     }
     else {
-      $built = $view->preview('default', array($node->nid));
+      $built = $view->preview('default', array($nid));
     }
 
     // Views will set either total_rows or num_rows depending on whether
@@ -214,7 +217,18 @@
       // Otherwise show it to everybody.
       og_home_empty($node);
     }
-    
+
+    // Mimic views argument title to use the translated node title,
+    // and not the translation source title.
+    // This could cause problems if the view is altered to have more than one argument.
+    if (og_group_is_translation($node)) {
+      $view_title = $view->argument['group_nid']->options['title'];
+      if (!empty($view_title) && strpos($view_title, '%1') !== FALSE) {
+        $view_substitutions['%1'] = $node->title;
+        $view->build_info['title'] = str_replace(array_keys($view_substitutions), $view_substitutions, $view_title);
+      }
+    }
+
     drupal_set_title(filter_xss_admin($view->build_info['title']));
     drupal_add_feed(url("node/$node->nid/feed"), drupal_get_title());
   }
--- modules/og_access/og_access.module	Fri Jan 16 05:21:36 1970
+++ modules/og_access/og_access.module	Fri Jan 16 05:21:36 1970
@@ -252,7 +252,7 @@
     // This way, our js gets added even if form is cached.
     $form['#pre_render'][] = 'og_access_add_js';
     $node = $form['#node'];
-    if (og_is_group_type($node->type)) {
+    if (og_is_group_type($node->type) && !og_group_is_translation($node)) {
       og_access_alter_group_form($form, $node);
     }
     else {
