--- translation.test	Sun Sep 12 16:01:53 2010
+++ translation_node/translation_node.test	Thu Sep 23 12:27:52 2010
@@ -1,19 +1,19 @@
 <?php
 // $Id: translation.test,v 1.29 2010/08/05 23:53:39 webchick Exp $
 
-class TranslationTestCase extends DrupalWebTestCase {
+class TranslationNodeTestCase extends DrupalWebTestCase {
   protected $book;
 
   public static function getInfo() {
     return array(
-      'name' => 'Translation functionality',
+      'name' => 'Node translation functionality',
       'description' => 'Create a basic page with translation, modify the page outdating translation, and update translation.',
       'group' => 'Translation'
     );
   }
 
   function setUp() {
-    parent::setUp('locale', 'translation');
+    parent::setUp('locale', 'translation', 'translation_node');
   }
 
   /**
--- translation.module	Sun Sep 12 15:36:28 2010
+++ translation_node/translation_node.module	Thu Sep 23 12:38:05 2010
@@ -3,7 +3,7 @@
 
 /**
  * @file
- *   Manages content translations.
+ *   Manages node translations.
  *
  *   Translations are managed in sets of posts, which represent the same
  *   information in different languages. Only content types for which the
@@ -23,12 +23,12 @@
 /**
  * Identifies a content type which has translation support enabled.
  */
-define('TRANSLATION_ENABLED', 2);
+define('TRANSLATION_NODE_ENABLED', 2);
 
 /**
  * Implements hook_help().
  */
-function translation_help($path, $arg) {
+function translation_node_help($path, $arg) {
   switch ($path) {
     case 'admin/help#translation':
       $output = '';
@@ -53,52 +53,23 @@
 }
 
 /**
- * Implements hook_menu().
- */
-function translation_menu() {
-  $items = array();
-  $items['node/%node/translate'] = array(
-    'title' => 'Translate',
-    'page callback' => 'translation_node_overview',
-    'page arguments' => array(1),
-    'access callback' => '_translation_tab_access',
-    'access arguments' => array(1),
-    'type' => MENU_LOCAL_TASK,
-    'weight' => 2,
-    'theme callback' => '_node_custom_theme',
-    'file' => 'translation.pages.inc',
-  );
-  return $items;
-}
-
-/**
  * Menu access callback.
  *
  * Only display translation tab for node types, which have translation enabled
  * and where the current node is not language neutral (which should span
  * all languages).
  */
-function _translation_tab_access($node) {
-  if ($node->language != LANGUAGE_NONE && translation_supported_type($node->type) && node_access('view', $node)) {
+function _translation_node_tab_access($node) {
+  if ($node->language != LANGUAGE_NONE && translation_node_supported_type($node->type) && node_access('view', $node)) {
     return user_access('translate content');
   }
   return FALSE;
 }
 
 /**
- * Implements hook_admin_paths().
- */
-function translation_admin_paths() {
-  $paths = array(
-    'node/*/translate' => TRUE,
-  );
-  return $paths;
-}
-
-/**
  * Implements hook_permission().
  */
-function translation_permission() {
+function translation_node_permission() {
   return array(
     'translate content' => array(
       'title' => t('Translate content'),
@@ -109,11 +80,10 @@
 /**
  * Implements hook_form_FORM_ID_alter().
  */
-function translation_form_node_type_form_alter(&$form, &$form_state) {
+function translation_node_form_node_type_form_alter(&$form, &$form_state) {
   // Add translation option to content type form.
-  $form['workflow']['language_content_type']['#options'][TRANSLATION_ENABLED] = t('Enabled, with translation');
-  // Description based on text from locale.module.
-  $form['workflow']['language_content_type']['#description'] = t('Enable multilingual support for this content type. If enabled, a language selection field will be added to the editing form, allowing you to select from one of the <a href="!languages">enabled languages</a>. You can also turn on translation for this content type, which lets you have content translated to any of the enabled languages. If disabled, new posts are saved with the default language. Existing content will not be affected by changing this option.', array('!languages' => url('admin/config/regional/language')));
+  $form['workflow']['language_content_type']['#options'][TRANSLATION_NODE_ENABLED] = t('Enabled, with node translation');
+  $form['workflow']['language_content_type']['#description'] .= ' ' . t('If <em>node translation</em> is enabled every translation will be a different node.');
 }
 
 /**
@@ -123,8 +93,8 @@
  * - Alters language fields on node forms when a translation
  *   is about to be created.
  */
-function translation_form_node_form_alter(&$form, &$form_state) {
-  if (translation_supported_type($form['#node']->type)) {
+function translation_node_form_alter(&$form, &$form_state, $form_id) {
+  if (!empty($form['#node_edit_form']) && translation_node_supported_type($form['#node']->type)) {
     $node = $form['#node'];
     if (!empty($node->translation_source)) {
       // We are creating a translation. Add values and lock language field.
@@ -180,10 +150,11 @@
  * Display translation links with native language names, if this node
  * is part of a translation set.
  */
-function translation_node_view($node, $view_mode) {
-  if (isset($node->tnid) && drupal_multilingual() && $translations = translation_node_get_translations($node->tnid)) {
+function translation_node_node_view($node, $view_mode) {
+  if (isset($node->tnid) && drupal_multilingual() &&
+      translation_node_supported_type($node->type) && $translations = translation_node_get_translations($node->tnid)) {
     $path = 'node/' . $node->nid;
-    $links = language_negotiation_get_switch_links(LANGUAGE_TYPE_INTERFACE, $path);
+    $links = language_negotiation_get_switch_links(LANGUAGE_TYPE_CONTENT, $path);
     if (is_object($links)) {
       $links = $links->links;
       // Do not show link to the same node.
@@ -196,9 +167,9 @@
 /**
  * Implements hook_node_prepare().
  */
-function translation_node_prepare($node) {
+function translation_node_node_prepare($node) {
   // Only act if we are dealing with a content type supporting translations.
-  if (translation_supported_type($node->type) &&
+  if (translation_node_supported_type($node->type) &&
     // And it's a new node.
     empty($node->nid) &&
     // And the user has permission to translate content.
@@ -246,9 +217,9 @@
 /**
  * Implements hook_node_insert().
  */
-function translation_node_insert($node) {
+function translation_node_node_insert($node) {
   // Only act if we are dealing with a content type supporting translations.
-  if (translation_supported_type($node->type)) {
+  if (translation_node_supported_type($node->type)) {
     if (!empty($node->translation_source)) {
       if ($node->translation_source->tnid) {
         // Add node to existing translation set.
@@ -279,9 +250,9 @@
 /**
  * Implements hook_node_update().
  */
-function translation_node_update($node) {
+function translation_node_node_update($node) {
   // Only act if we are dealing with a content type supporting translations.
-  if (translation_supported_type($node->type)) {
+  if (translation_node_supported_type($node->type)) {
     if (isset($node->translation) && $node->translation && !empty($node->language) && $node->tnid) {
       // Update translation information.
       db_update('node')
@@ -308,9 +279,9 @@
  *
  * Ensure that duplicate translations can not be created for the same source.
  */
-function translation_node_validate($node, $form) {
+function translation_node_node_validate($node, $form) {
   // Only act on translatable nodes with a tnid or translation_source.
-  if (translation_supported_type($node->type) && (!empty($node->tnid) || !empty($form['#node']->translation_source->nid))) {
+  if (translation_node_supported_type($node->type) && (!empty($node->tnid) || !empty($form['#node']->translation_source->nid))) {
     $tnid = !empty($node->tnid) ? $node->tnid : $form['#node']->translation_source->nid;
     $translations = translation_node_get_translations($tnid);
     if (isset($translations[$node->language]) && $translations[$node->language]->nid != $node->nid ) {
@@ -322,10 +293,10 @@
 /**
  * Implements hook_node_delete().
  */
-function translation_node_delete($node) {
+function translation_node_node_delete($node) {
   // Only act if we are dealing with a content type supporting translations.
-  if (translation_supported_type($node->type)) {
-    translation_remove_from_set($node);
+  if (translation_node_supported_type($node->type)) {
+    translation_node_remove_from_set($node);
   }
 }
 
@@ -333,7 +304,7 @@
  * Remove a node from its translation set (if any)
  * and update the set accordingly.
  */
-function translation_remove_from_set($node) {
+function translation_node_remove_from_set($node) {
   if (isset($node->tnid)) {
     $query = db_update('node')
       ->fields(array(
@@ -403,8 +374,8 @@
  * @return
  *   Boolean value.
  */
-function translation_supported_type($type) {
-  return variable_get('language_content_type_' . $type, 0) == TRANSLATION_ENABLED;
+function translation_node_supported_type($type) {
+  return variable_get('language_content_type_' . $type, 0) == TRANSLATION_NODE_ENABLED;
 }
 
 /**
@@ -417,7 +388,7 @@
  *   An array of paths of translations of the node accessible
  *   to the current user keyed with language codes.
  */
-function translation_path_get_translations($path) {
+function translation_node_path_get_translations($path) {
   $paths = array();
   // Check for a node related path, and for its translations.
   if ((preg_match("!^node/([0-9]+)(/.+|)$!", $path, $matches)) && ($node = node_load((int)$matches[1])) && !empty($node->tnid)) {
@@ -433,8 +404,8 @@
  *
  * Replaces links with pointers to translated versions of the content.
  */
-function translation_language_switch_links_alter(array &$links, $type, $path) {
-  if ($type == LANGUAGE_TYPE_INTERFACE && $paths = translation_path_get_translations($path)) {
+function translation_node_language_switch_links_alter(array &$links, $type, $path) {
+  if ($type == LANGUAGE_TYPE_CONTENT && $paths = translation_path_get_translations($path)) {
     foreach ($links as $langcode => $link) {
       if (isset($paths[$langcode])) {
         // Translation in a different node.
