--- pathauto.inc	2010-03-02 23:48:17.000000000 -0500
+++ pathauto.inc	2010-03-11 00:01:16.000000000 -0500
@@ -47,12 +47,13 @@
  *   An array with the keys "pid" and "old_alias" containing
  *   the "pid" and old "alias", respectively, of the old alias.
  */
-function _pathauto_existing_alias_data($src) {
+function _pathauto_existing_alias_data($src, $language = '') {
   $output = array(
     'pid' => '',
     'old_alias' => ''
-  );
-  $result = db_query("SELECT pid, dst FROM {url_alias} WHERE src='%s'", $src);
+  );                                                         
+  
+  $result = db_query("SELECT pid, dst FROM {url_alias} WHERE src='%s' AND language='%s'", $src, $language); 
   if ($data = db_fetch_object($result)) {
     // The item is already aliased, check what to do...
     switch (variable_get('pathauto_update_action', 2)) {
@@ -276,7 +277,7 @@
     $term_path = taxonomy_term_path(taxonomy_get_term($entity_id));
     if ($term_path != $src) {
       // Quietly alias 'taxonomy/term/[tid]' with proper path for term.
-      $update_data = _pathauto_existing_alias_data($src);
+      $update_data = _pathauto_existing_alias_data($src, $language);
       _pathauto_set_alias($src, $term_path, $module, $entity_id, $update_data['pid'], FALSE, $update_data['old_alias'], $language);
       // Set $src as proper path.
       $src = $term_path;
@@ -291,7 +292,7 @@
       // Do nothing
       return '';
     }
-    $update_data = _pathauto_existing_alias_data($src);
+    $update_data = _pathauto_existing_alias_data($src, $language);
     $pid = $update_data['pid'];
     $old_alias = $update_data['old_alias'];
   }
@@ -344,11 +345,11 @@
 
     // For forums and taxonomies, the src doesn't always form the base of the rss feed (ie. image galleries)
     if ($module == 'taxonomy' || $module == 'forum') {
-      $update_data = _pathauto_existing_alias_data("taxonomy/term/$entity_id/$feedappend");
+      $update_data = _pathauto_existing_alias_data("taxonomy/term/$entity_id/$feedappend", $language);
       _pathauto_set_alias("taxonomy/term/$entity_id/$feedappend", "$alias/feed", $module, $entity_id, $update_data['pid'], $verbose, $update_data['old_alias'], $language);
     }
     else {
-      $update_data = _pathauto_existing_alias_data("$src/$feedappend");
+      $update_data = _pathauto_existing_alias_data("$src/$feedappend", $language);
       _pathauto_set_alias("$src/$feedappend", "$alias/feed", $module, $entity_id, $update_data['pid'], $verbose, $update_data['old_alias'], $language);
     }
   }
--- pathauto.module	2010-02-19 18:11:29.000000000 -0500
+++ pathauto.module	2010-03-11 00:09:37.000000000 -0500
@@ -123,9 +123,13 @@
             array_shift($parents);
             $catpath = '';
             $catpath_raw = '';
+            $catpath_i18n = '';
+            $catpath_i18n_raw = '';
             foreach ($parents as $parent) {
               $catpath = pathauto_cleanstring(check_plain($parent->name)) .'/'. $catpath;
               $catpath_raw = pathauto_cleanstring($parent->name) .'/'. $catpath_raw;
+              $catpath_i18n = pathauto_cleanstring(check_plain(preg_replace('/\//', '', tt("taxonomy:term:$parent->tid:name", $parent->name, $category->language)))) .'/'. $catpath_i18n;
+              $catpath_i18n_raw = pathauto_cleanstring(preg_replace('/\//', '', tt("taxonomy:term:$parent->tid:name", $parent->name, $category->language))) .'/'. $catpath_i18n_raw;
             }
             $values[$label .'path'] = $catpath . pathauto_cleanstring(check_plain($category->name));
             $values[$label .'path-raw'] = $catpath_raw . pathauto_cleanstring($category->name);
@@ -135,6 +139,10 @@
             if (!strncasecmp($values[$label .'alias'], 'taxonomy', 8)) {
               $values[$label .'alias'] = check_plain($category->name);
             }
+            $values['i18n-cat'] = check_plain(tt("taxonomy:term:$category->tid:name", $category->name, $category->language));
+            $values['i18n-cat-raw'] = tt("taxonomy:term:$category->tid:name", $category->name, $category->language);
+            $values['i18n-catpath'] = $catpath_i18n .'/'. check_plain(tt("taxonomy:term:$category->tid:name", $category->name, $category->language));
+            $values['i18n-catpath-raw'] = $catpath_i18n_raw .'/'. tt("taxonomy:term:$category->tid:name", $category->name, $category->language);
           }
           else { // Provide some defaults if they aren't set.
             $values[$label .'path'] = '';
@@ -157,6 +165,10 @@
       $tokens['taxonomy']['catpath'] = t('As [cat], but including its supercategories separated by /.');
       $tokens['taxonomy']['catpath-raw'] = t('As [cat-raw], but including its supercategories separated by /. WARNING - raw user input.');
       $tokens['taxonomy']['catalias'] = t('URL alias for the term.');
+      $tokens['taxonomy']['i18n-cat'] = t('Category name translated using i18n.');
+      $tokens['taxonomy']['i18n-cat-raw'] = t('Unescaped category name translated using i18n. WARNING - raw user input.');
+      $tokens['taxonomy']['i18n-catpath'] = t('As [i18n-cat], but including its supercategories separated by /.');
+      $tokens['taxonomy']['i18n-catpath-raw'] = t('As [i18n-cat], but including its supercategories separated by /. WARNING - raw user input.');
     }
     if ($type == 'node' || $type == 'all') {
       $tokens['node']['termpath'] = t('As [term], but including its supercategories separated by /.');
--- pathauto_taxonomy.inc.orig	2008-08-28 12:16:31.000000000 -0400
+++ pathauto_taxonomy.inc	2010-03-11 00:12:40.000000000 -0500
@@ -36,11 +36,29 @@
       if (sizeof($vocabularies) > 0) {
         $settings['patternitems'] = array();
         $forum_vid = variable_get('forum_nav_vocabulary', '');
+        if (module_exists('locale')) {
+          $languages = array('' => t('Language neutral')) + locale_language_list('name');
+        }
+        else {
+          $languages = array();
+        }
         foreach ($vocabularies as $vocab) {
           if ($vocab->vid != $forum_vid) {
             $vocabname = $vocab->name;
-            $fieldlabel = t('Pattern for all %vocab-name paths', array('%vocab-name' => $vocabname));
-            $settings['patternitems'][$vocab->vid] = $fieldlabel;
+            if (function_exists('i18ntaxonomy_vocabulary') && (i18ntaxonomy_vocabulary($vocab->vid) == I18N_TAXONOMY_TRANSLATE || i18ntaxonomy_vocabulary($vocab->vid) == I18N_TAXONOMY_LOCALIZE) && count($languages)) {
+              $settings['patternitems'][$vocab->vid] = t('Default pattern for all %vocab-name paths (applies to all %vocab-name node types with blank patterns below)', array('%vocab-name' => $vocabname));
+              foreach ($languages as $lang_code => $lang_name) {
+                if (!empty($lang_code)) {
+                  $settings['patternitems'][$vocab->vid .'_'. $lang_code] = t('Pattern for all %vocab-name paths in @language', array('%vocab-name' => $vocabname, '@language' => $lang_name));
+                }
+                else {
+                  $settings['patternitems'][$vocab->vid .'_'. $lang_code] = t('Pattern for all language neutral %vocab-name paths', array('%vocab-name' => $vocabname));
+                }
+              }
+            }
+            else {
+              $settings['patternitems'][$vocab->vid] = t('Pattern for all %vocab-name paths', array('%vocab-name' => $vocabname));
+            }
           }
         }
       }
@@ -80,7 +98,7 @@
   // Exclude the forums and join all the args into one array so they can be passed to db_query
   $forum_vid[] = variable_get('forum_nav_vocabulary', '');
   $query_args = array_merge($forum_vid, $pattern_vids);
-  $query = "SELECT tid, vid, name, src, dst FROM {term_data} LEFT JOIN {url_alias} ON CONCAT('taxonomy/term/', CAST(tid AS CHAR)) = src WHERE src IS NULL AND vid <> %d ". $vid_where;
+  $query = "SELECT td.*, src, dst FROM {term_data} td LEFT JOIN {url_alias} ON CONCAT('taxonomy/term/', CAST(tid AS CHAR)) = src WHERE src IS NULL AND vid <> %d ". $vid_where;
   $result = db_query_range($query, $query_args, 0, variable_get('pathauto_max_bulk_update', 50));
 
   $count = 0;
@@ -102,6 +120,16 @@
  */
 function _taxonomy_pathauto_alias($category, $op) {
   $count = 0;
+  static $languages;
+  
+  if(!$languages) {
+    if (module_exists('locale')) {
+      $languages = array('' => t('Language neutral')) + locale_language_list('name');
+    }
+    else {
+      $languages = array();
+    }    
+  }  
 
   $placeholders = pathauto_get_placeholders('taxonomy', $category);
 
@@ -113,10 +141,21 @@
       $count++;
     }
   }
-  else {
-    $src = taxonomy_term_path($category);
-    if (pathauto_create_alias('taxonomy', $op, $placeholders, $src, $category->tid, $category->vid)) {
-      $count++;
+  else {
+    if(i18ntaxonomy_vocabulary($category->vid) == I18N_TAXONOMY_LOCALIZE && count($languages)) {
+      foreach(array_keys($languages) as $language_code) {
+        $category->language = $language_code;
+        $placeholders = pathauto_get_placeholders('taxonomy', $category);
+        $src = taxonomy_term_path($category->tid);
+        if (pathauto_create_alias('taxonomy', $op, $placeholders, $src, $category->tid, $category->vid, $category->language)) {
+          $count++;
+        }
+      }
+    } else {
+      $src = taxonomy_term_path($category->tid);
+      if (pathauto_create_alias('taxonomy', $op, $placeholders, $src, $category->tid, $category->vid, $category->language)) {
+        $count++;
+      }
     }
   }
   return $count;
