Index: context.core.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/context/Attic/context.core.inc,v retrieving revision 1.1.2.3.2.20.2.17 diff -u -p -r1.1.2.3.2.20.2.17 context.core.inc --- context.core.inc 26 Apr 2010 15:05:25 -0000 1.1.2.3.2.20.2.17 +++ context.core.inc 19 May 2010 17:59:41 -0000 @@ -52,6 +52,13 @@ function context_context_registry() { 'plugin' => 'context_condition_bookroot', ); } + if (module_exists('i18n')) { + $registry['conditions']['translations'] = array( + 'title' => t('Translations'), + 'description' => t('Set this context when viewing a child of a translatable node'), + 'plugin' => 'context_condition_translations', + ); + } if (module_exists('locale')) { $registry['conditions']['language'] = array( 'title' => t('Language'), @@ -236,6 +243,11 @@ function context_node_condition(&$node, $plugin->execute($node, $op); } } + if (module_exists('i18n')) { + if ($plugin = context_get_plugin('condition', 'translations')) { + $plugin->execute($node, $op); + } + } if (module_exists('book')) { if ($plugin = context_get_plugin('condition', 'book')) { $plugin->execute($node, $op); Index: context.plugins.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/context/Attic/context.plugins.inc,v retrieving revision 1.1.2.4 diff -u -p -r1.1.2.4 context.plugins.inc --- context.plugins.inc 9 Feb 2010 17:05:22 -0000 1.1.2.4 +++ context.plugins.inc 19 May 2010 17:59:41 -0000 @@ -67,6 +67,16 @@ function _context_context_plugins() { ), ); } + if (module_exists('i18n')) { + $plugins['context_condition_translations'] = array( + 'handler' => array( + 'path' => drupal_get_path('module', 'context') .'/plugins', + 'file' => 'context_condition_translations.inc', + 'class' => 'context_condition_translations', + 'parent' => 'context_condition', + ), + ); + } if (module_exists('locale')) { $plugins['context_condition_language'] = array( 'handler' => array( Index: plugins/context_condition_translations.inc =================================================================== RCS file: plugins/context_condition_translations.inc diff -N plugins/context_condition_translations.inc --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ plugins/context_condition_translations.inc 19 May 2010 17:59:41 -0000 @@ -0,0 +1,43 @@ +nid] = truncate_utf8($node->title, 50); + } + + return $values; + } + + /** + * Set the primary links menu; + */ + function execute(&$node, $op) { + foreach (context_enabled_contexts() as $context) { + if ($nodes = $this->fetch_from_context($context, 'values')) { + + // Check through the list of selected nodes and find out if the node loaded + // on this page is a translated child of one of the context conditions + foreach ($nodes as $key => $nid) { + if ($node->tnid == $nid) { + $this->condition_met($context, $nid); + } + } + } + } + } +}