Index: i18nmenu_node.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/i18nmenu_node/i18nmenu_node.module,v
retrieving revision 1.14
diff -u -r1.14 i18nmenu_node.module
--- i18nmenu_node.module	12 Sep 2010 17:21:15 -0000	1.14
+++ i18nmenu_node.module	13 Sep 2010 18:07:02 -0000
@@ -223,7 +223,7 @@
   if (!isset($form['menu']['#item']) || empty($form['menu']['#item']['options']['langcode'])) {
     $router_item = menu_get_item();
     $default = !empty($form['menu']['#item']) ?
-      isset($form['menu']['#item']['options']['translations']) :
+      i18nmenu_node_enabled($form['menu']['#item']) :
       i18nmenu_node_translation_enabled($router_item['page_arguments'][3]['menu_name']);
   
     $form['menu']['i18nmenu_node_translation'] = array(
@@ -251,7 +251,7 @@
 
     // If the node already has a menu just add the node translation option.
     if (!empty($node->menu['mlid']) && $translation_support) {
-      $node_translation_form['#default_value'] = isset($node->menu['options']['translations']);
+      $node_translation_form['#default_value'] = i18nmenu_node_enabled($node->menu);
       $form['menu']['i18nmenu_node_translation'] = $node_translation_form;
       return;
     }
@@ -280,7 +280,7 @@
     // Prepare the tnode so the menu item will be available.
     _i18nmenu_node_prepare($tnode);
 
-    if ($translation_support && $tnode->menu && isset($tnode->menu['options']['translations'])) {
+    if ($translation_support && $tnode->menu && i18nmenu_node_enabled($tnode->menu)) {
       // If node translation is enabled we share one single menu item among
       // all the nodes belonging to the translation set.
       $form['menu']['link_title_translation'] = $form['menu']['link_title'];
@@ -368,6 +368,33 @@
 }
 
 /**
+ * Implementation of hook_context_plugins().
+ */
+function i18nmenu_node_context_plugins() {
+  $plugins = array();
+
+  $plugins['i18nmenu_node_context_condition'] = array(
+    'handler' => array(
+      'path' => drupal_get_path('module', 'i18nmenu_node') .'/plugins',
+      'file' => 'i18nmenu_node_context_condition.inc',
+      'class' => 'i18nmenu_node_context_condition',
+      'parent' => 'context_condition_menu',
+    ),
+  );
+
+  return $plugins;
+}
+
+/**
+ * Implementation of hook_context_registry().
+ */
+function i18nmenu_node_context_registry_alter(&$registry) {
+ if (isset($registry['conditions']['menu'])) {
+    $registry['conditions']['menu']['plugin'] = 'i18nmenu_node_context_condition';
+  }
+}
+
+/**
  * Implementation of hook_form_form_id_alter().
  *
  * Handle addition/deletions to the translation set performed from the "Select
@@ -481,6 +508,13 @@
 }
 
 /**
+ * Return TRUE if node item translation is enabled for the given menu item.
+ */
+function i18nmenu_node_enabled($item) {
+  return isset($item['options']['translations']);
+}
+
+/**
  * Return an array of node translation nids keyed by language.
  */
 function i18nmenu_node_get_translations($tnid, $field = 'nid') {
Index: plugins/i18nmenu_node_context_condition.inc
===================================================================
RCS file: plugins/i18nmenu_node_context_condition.inc
diff -N plugins/i18nmenu_node_context_condition.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ plugins/i18nmenu_node_context_condition.inc	1 Jan 1970 00:00:00 -0000
@@ -0,0 +1,30 @@
+<?php
+// $Id$
+
+/**
+ * Expose translated node menu items as a context condition.
+ */
+class i18nmenu_node_context_condition extends context_condition_menu {
+  
+  /**
+   * Override of execute().
+   */
+  function execute() {
+    // Execute the 'plain' menu condition. This will work for the source nodes.
+    parent::execute();
+
+    // If we do not have a matching context try with the node translations.
+    if (!context_isset('context', $context->name)) {
+      $trail = menu_get_active_trail();
+      foreach ($trail as $item) {
+        if (i18nmenu_node_enabled($item)) {
+          // $item['link_path'] holds the source node path, which can be checked
+          // against the condition map successfully.
+          foreach ($this->get_contexts($item['link_path']) as $context) {
+            $this->condition_met($context, $item['link_path']);
+          }
+        }
+      }
+    }
+  }
+}
