--- taxonomy_menu.database.inc	Mon Jun 08 16:46:01 2009
+++ taxonomy_menu.database.inc	Mon Jun 08 16:34:31 2009
@@ -130,3 +130,13 @@
 function _taxonomy_menu_term_count($tid) {
   return db_result(db_query('SELECT COUNT(n.nid) AS c FROM {term_node} t INNER JOIN {node} n ON t.vid = n.vid WHERE n.status = 1 AND t.tid = %d', $tid));
 }
+
+/**
+ * Get vid, tid for a given mlid
+ *
+ * @param $mlid
+ * @return array of vid, tid
+ */
+function _taxonomy_menu_get_item($mlid) {
+  return db_fetch_array(db_query('SELECT tid, vid FROM {taxonomy_menu} WHERE mlid = %d', $mlid));
+}
--- taxonomy_menu.module	Mon Jun 08 16:46:37 2009
+++ taxonomy_menu.module	Mon Jun 08 16:34:02 2009
@@ -456,6 +456,11 @@
     $insert = FALSE;
   }
 
+//FIXME: i18nmenu need to be cleaned up to allow translation from other menu module
+  if (module_exists('i18nmenu')) {
+    $link['options']['alter'] = TRUE;
+  }
+
   //set the has_children property
   //if tid=0 then adding a vocab item and had children
   //if the term has any children then set it to true
@@ -608,6 +613,7 @@
       'vid' => $args['vid'],
       'ptid' => 0,
       'menu_name' => $args['menu_name'],
+      'language' => $vocab->language,
     );
 
     return $item;
@@ -641,6 +647,7 @@
     'vid' => $term->vid,
     'ptid' => $ptid,
     'menu_name' => $args['menu_name'],
+    'language' => $term->language,
   );
 
   if ($args['mlid']) {
@@ -829,4 +836,53 @@
   );
 
   return $options;
+}
+
+
+/**
+ * Implementation of hook_translated_menu_link_alter().
+ *
+ * Translate menu links on the fly by using term translations.
+ *
+ */
+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') {
+      // TODO: check vocabulary translation mode before tryring to translate: but is this really usefull ?
+      //  if (i18ntaxonomy_vocabulary($vid) == I18N_TAXONOMY_LOCALIZE) {
+      $t = _taxonomy_menu_get_item($item['mlid']);
+      if ($t['tid'] > 0) {  // this is a term
+        $term = taxonomy_get_term($t['tid']);
+
+        $display_num = '';
+        $num = _taxonomy_menu_term_count($t['tid']);
+
+        //if hide menu is selected and the term count is 0 and the term has no children then do not create the menu item
+        if ($num == 0 &&
+          variable_get('taxonomy_menu_hide_empty_terms_'. $t['vid'], FALSE) &&
+          _taxonomy_menu_children_has_nodes($t['tid'], $t['vid'])) {
+          $display_num = '';
+        }
+        // if display number is selected and $num > 0 then change the title
+        else if (variable_get('taxonomy_menu_display_num_'. $t['vid'], FALSE)) {
+          // if number > 0 and display decendants, then count all of the children
+          if (variable_get('taxonomy_menu_display_descendants_'. $t['vid'], FALSE)) {
+            $num = taxonomy_term_count_nodes($t['tid']);
+          }
+          $display_num = " ($num)";
+        }
+
+        if ($item['title'] != ($term->name . $display_num)) {
+          // Should not happen
+          drupal_set_message(t('Menu and taxonomy name mismatch : @title != @name', array('@title' => $item['title'], '@name' => $term->name . $display_num)), 'error');
+        }
+        $item['title'] = tt('taxonomy:term:'. $term->tid .':name', $term->name) . $display_num;
+      }
+      else {  // is a vocabulary
+        $vocab = taxonomy_vocabulary_load($t['vid']);
+        $item['title'] = tt('taxonomy:vocabulary:'. $vocab->vid .':name', $vocab->name);
+      }
+    }
+  }
+}
