Index: pathauto.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/pathauto/pathauto.module,v
retrieving revision 1.118.2.31
diff -u -r1.118.2.31 pathauto.module
--- pathauto.module	7 Oct 2010 17:43:15 -0000	1.118.2.31
+++ pathauto.module	9 Dec 2010 15:05:07 -0000
@@ -100,12 +100,24 @@
       $tokens['taxonomy']['catpath-raw'] = t('As [cat-raw], but including its supercategories separated by /.');
       $tokens['taxonomy']['catalias'] = t('The URL alias of the taxonomy term.');
       $tokens['taxonomy']['catalias-raw'] = t('The URL alias of the taxonomy term.');
+      if (module_exists('i18ntaxonomy')) {
+        $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('Unescaped [i18n-cat], but including its supercategories separated by /. WARNING - raw user input.');
+        $tokens['taxonomy']['i18n-vocab'] = t('Vocabulary name translated using i18n.');
+        $tokens['taxonomy']['i18n-vocab-raw'] = t('Unescaped vocabulary name translated using i18n. WARNING - raw user input.');
+      }
     }
     if ($type == 'node' || $type == 'all') {
       $tokens['node']['termpath'] = t('As [term], but including its supercategories separated by /.');
       $tokens['node']['termpath-raw'] = t('As [term-raw], but including its supercategories separated by /.');
       $tokens['node']['termalias'] = t('The URL alias of the taxonomy term.');
       $tokens['node']['termalias-raw'] = t('The URL alias of the taxonomy term.');
+      if (module_exists('i18ntaxonomy')) {
+        $tokens['taxonomy']['i18n-termpath'] = t('As [i18n-term], but including its supercategories separated by /.');
+        $tokens['taxonomy']['i18n-termpath-raw'] = t('Unescaped [i18n-term], but including its supercategories separated by /. WARNING - raw user input.');
+      }
     }
   }
   if (module_exists('book')) {
@@ -141,6 +153,9 @@
         // This query is copied from @taxonomy_node_get_terms()
         $term = db_fetch_object(db_query_range('SELECT t.* FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.vid = %d ORDER BY v.weight, t.weight, t.name', $object->vid, 0, 1));
         if ($term) {
+          // We only want to translate terms when for nodes that has a language selected as we
+          // wont really will be able to tell which language will be used for the token.
+          $term->language = $object->language;
           $values = array_merge($values, pathauto_token_values('taxonomy', $term, $options, 'term'));
         }
         else {
@@ -164,12 +179,31 @@
       if (isset($object->tid)) {
         $parents = taxonomy_get_parents_all($object->tid);
         $catpath = $catpath_raw = array();
+        $i18ncatpath = $i18ncatpath_raw = array();
         foreach ($parents as $parent) {
           array_unshift($catpath, check_plain($parent->name));
           array_unshift($catpath_raw, $parent->name);
+          if (module_exists('i18ntaxonomy')) {
+            $i18n_term_name = i18nstrings("taxonomy:term:$parent->tid:name", $parent->name, $object->language);
+            array_unshift($i18ncatpath, check_plain($i18n_term_name));
+            array_unshift($i18ncatpath_raw, $i18n_term_name);
+          }
         }
         $values[$label . 'path'] = !empty($options['pathauto']) ? $catpath : implode('/', $catpath);
         $values[$label . 'path-raw'] = !empty($options['pathauto']) ? $catpath_raw : implode('/', $catpath_raw);
+        if (module_exists('i18ntaxonomy')) {
+          // i18ntaxonomy set this token values
+          if (strcmp($label, 'term')) {
+            $values['i18n-' . $label . '-raw'] = i18nstrings("taxonomy:term:$object->tid:name", $object->name, $object->language);
+            $values['i18n-' . $label] = check_plain($values['i18n-' . $label . '-raw']);
+          }
+          $values['i18n-' . $label . 'path'] = !empty($options['pathauto']) ? $i18ncatpath : implode('/', $i18ncatpath);
+          $values['i18n-' . $label . 'path-raw'] = !empty($options['pathauto']) ? $i18ncatpath_raw : implode('/', $i18ncatpath_raw);
+          
+          $vocab = taxonomy_vocabulary_load($object->vid);
+          $values['i18n-vocab-raw'] = i18nstrings("taxonomy:vocabulary:$vocab->vid:name", $vocab->name, $object->language);
+          $values['i18n-vocab'] = check_plain($values['i18n-vocab-raw']);
+        }
 
         // Token [catalias-raw] and [catalias].
         $values[$label . 'alias-raw'] = drupal_get_path_alias(taxonomy_term_path($object));
Index: pathauto_taxonomy.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/pathauto/Attic/pathauto_taxonomy.inc,v
retrieving revision 1.39.2.6
diff -u -r1.39.2.6 pathauto_taxonomy.inc
--- pathauto_taxonomy.inc	8 Dec 2010 00:51:28 -0000	1.39.2.6
+++ pathauto_taxonomy.inc	9 Dec 2010 15:05:07 -0000
@@ -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));
+            }
           }
         }
       }
@@ -99,7 +117,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);
 
   $forum_vid = variable_get('forum_nav_vocabulary', '');
@@ -111,9 +138,22 @@
     }
   }
   else {
-    $source = taxonomy_term_path($category);
-    if (pathauto_create_alias('taxonomy', $op, $placeholders, $source, $category->tid, $category->vid)) {
-      $count++;
+    if(i18ntaxonomy_vocabulary($category->vid) == I18N_TAXONOMY_LOCALIZE && count($languages)) {
+      foreach(array_keys($languages) as $language_code) {
+        if (!empty($language_code)) {
+          $category->language = $language_code;
+          $placeholders = pathauto_get_placeholders('taxonomy', $category);
+          $source = taxonomy_term_path($category);
+          if (pathauto_create_alias('taxonomy', $op, $placeholders, $source, $category->tid, $category->vid, $category->language)) {
+            $count++;
+          }
+        }
+      }
+    } else {
+      $source = taxonomy_term_path($category);
+      if (pathauto_create_alias('taxonomy', $op, $placeholders, $source, $category->tid, $category->vid, (property_exists($category, 'language')? $category->language: ''))) {
+        $count++;
+      }
     }
   }
   return $count;
