--- /contrib/DRUPAL-6/taxonomy_menu/trunk/taxonomy_menu.module	Sun May 31 14:56:03 2009
+++ /contrib/DRUPAL-6/taxonomy_menu/trunk/taxonomy_menu.new.module	Mon Jun 15 17:08:09 2009
@@ -269,6 +269,7 @@
           $term->weight = $args['weight'];
           $term->vid = $args['vid'];
           $term->tid = $args['tid'];
+          $term->language = $args['language'];
           $item = array(
             'term' => $term,
             'menu_name' => $menu_name,
@@ -284,6 +285,7 @@
           $term->weight = $args['weight'];
           $term->vid = $args['vid'];
           $term->tid = $args['tid'];
+          $term->language = $args['language'];
           $item = array(
             'term' => $term,
             'menu_name' => $menu_name,
@@ -451,6 +453,7 @@
  *     'ptid' => the term's parent's term id
  *     'menu_name' => the menu that the link item will be inserted into
  *     'mlid' => if this is filled in then the mlid will be updated
+ *     'language' => LANGUAGE
  */
 function _taxonomy_menu_save($item) {
   $insert = TRUE;
@@ -469,6 +472,7 @@
     'module' => 'taxonomy_menu',
     'expanded' => variable_get('taxonomy_menu_expanded_'. $item['vid'], TRUE),
     'link_path' => $path,
+    'language' => $item['language'],
   );
 
   //if passed a mlid then add it
@@ -477,9 +481,14 @@
     $insert = FALSE;
   }
 
-//FIXME: i18nmenu need to be cleaned up to allow translation from other menu module
+  //FIXME: i18nmenu need to be cleaned up to allow translation from other menu module
   if (module_exists('i18nmenu')) {
+    //Check if vocab is set to Per Language Terms
+    // if ( ????? ) {
+    //$link['options']['langcode'] = $item['language'];
+    $link['options']['langcode'] = $item['options']['langcode'];
     $link['options']['alter'] = TRUE;
+    //} (for vocab check)
   }
 
   //set the has_children property
@@ -663,7 +672,7 @@
   // turn the term into the correct $item array form
   $item = array(
     'tid' => $term->tid,
-    'name' => t($term->name),
+    'name' => $term->name,
     'description' => t($term->description),
     'weight' => $term->weight,
     'vid' => $term->vid,
@@ -866,18 +875,18 @@
  * Translate menu links on the fly by using term translations.
  *
  */
-function taxonomy_menu_translated_menu_link_alter(&$item, $map) {
-  if (module_exists('i18ntaxonomy')) {
+//function taxonomy_menu_translated_menu_link_alter(&$item, $map) {
+//  if (module_exists('i18ntaxonomy')) {
     //in case of localized terms, use term translation for menu title
-    if ($item['module'] == 'taxonomy_menu') {
+//    if ($item['module'] == 'taxonomy_menu') {
       //TODO: check vocabulary translation mode before tryring to translate: but is this really usefull ? 
       //  if (i18ntaxonomy_vocabulary($vid) == I18N_TAXONOMY_LOCALIZE) {
-      $term = taxonomy_get_term(_taxonomy_menu_get_tid($item['mlid']));
-      if ($item['title'] != $term->name) {
+//      $term = taxonomy_get_term(_taxonomy_menu_get_tid($item['mlid']));
+//      if ($item['title'] != $term->name) {
         //DEBUG: should never appends ?
-        drupal_set_message('Menu and taxonomy name mismatch : ' . $item['title'] . '!=' . $term->name, 'error');
-      }
-      $item['title'] = tt('taxonomy:term:'. $term->tid .':name', $term->name);
-    }
-  }
-}
+//        drupal_set_message('Menu and taxonomy name mismatch : ' . $item['title'] . '!=' . $term->name, 'error');
+//      }
+//      $item['title'] = tt('taxonomy:term:'. $term->tid .':name', $term->name);
+//    }
+//  }
+//}
