Index: modules/taxonomy/taxonomy.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.admin.inc,v
retrieving revision 1.53
diff -u -p -r1.53 taxonomy.admin.inc
--- modules/taxonomy/taxonomy.admin.inc	4 Jun 2009 03:33:29 -0000	1.53
+++ modules/taxonomy/taxonomy.admin.inc	5 Jun 2009 00:30:15 -0000
@@ -107,6 +107,7 @@ function taxonomy_form_vocabulary(&$form
   }
   $edit += array(
     'name' => '',
+    'machine_name' => '',
     'description' => '',
     'help' => '',
     'nodes' => array(),
@@ -129,6 +130,14 @@ function taxonomy_form_vocabulary(&$form
     '#description' => t('The name for this vocabulary, e.g., <em>"Tags"</em>.'),
     '#required' => TRUE,
   );
+  $form['machine_name'] = array(
+    '#type' => 'textfield',
+    '#title' => t('Machine readable name'),
+    '#default_value' => $edit['machine_name'],
+    '#maxlength' => 255,
+    '#description' => t('The machine readable name for this vocabulary, for internal user only.'),
+    '#required' => TRUE,
+  );
   $form['help'] = array(
     '#type' => 'textfield',
     '#title' => t('Help text'),
@@ -672,6 +681,9 @@ function taxonomy_form_term(&$form_state
     '#default_value' => $edit['description'],
     '#description' => t('A description of the term. To be displayed on taxonomy/term pages and RSS feeds.'));
 
+
+  field_attach_form('taxonomy_term', (object) $edit, $form, $form_state);
+
   $form['advanced'] = array(
     '#type' => 'fieldset',
     '#title' => t('Advanced options'),
Index: modules/taxonomy/taxonomy.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.install,v
retrieving revision 1.18
diff -u -p -r1.18 taxonomy.install
--- modules/taxonomy/taxonomy.install	1 Jun 2009 22:07:10 -0000	1.18
+++ modules/taxonomy/taxonomy.install	5 Jun 2009 00:30:15 -0000
@@ -226,6 +226,13 @@ function taxonomy_schema() {
         'default' => '',
         'description' => 'Name of the vocabulary.',
       ),
+      'machine_name' => array(
+        'type' => 'varchar',
+        'length' => 255,
+        'not null' => TRUE,
+        'default' => '',
+        'description' => 'The vocabulary machine name.',
+      ),
       'description' => array(
         'type' => 'text',
         'not null' => FALSE,
@@ -345,3 +352,27 @@ function taxonomy_update_7001() {
 
   return $ret;
 }
+
+/**
+ * Add vocabulary machine_name column.
+ */
+function taxonomy_update_7002() {
+  $ret = array();
+  $field = array(
+    'type' => 'varchar',
+    'length' => 255,
+    'not null' => TRUE,
+    'default' => '',
+    'description' => 'The vocabulary machine name.',
+  );
+
+  db_add_field($ret, 'taxonomy_vocabulary', 'machine_name', $field);
+
+  foreach (taxonomy_get_vocabularies() as $vid => $vocabulary) {
+    db_update('taxonomy_vocabulary')
+      ->fields(array('machine_name' => 'vocabulary_' . $vid))
+      ->condition('vid', $vid)
+      ->execute();
+  }
+  return $ret;
+}
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.476
diff -u -p -r1.476 taxonomy.module
--- modules/taxonomy/taxonomy.module	3 Jun 2009 19:34:53 -0000	1.476
+++ modules/taxonomy/taxonomy.module	5 Jun 2009 00:30:15 -0000
@@ -19,6 +19,35 @@ function taxonomy_perm() {
 }
 
 /**
+ * Implement hook_fieldable().
+ */
+function taxonomy_fieldable_info() {
+  $return = array(
+    'taxonomy_term' => array(
+      'name' => t('Taxonomy term'),
+      'id key' => 'tid',
+      'bundle key' => 'machine_name',
+    ),
+  );
+  return $return;
+}
+
+/**
+ * Implement hook_field_build_modes();
+ *
+ * @TODO: build mode for display as a field (when attached to nodes etc.).
+ */
+function taxonomy_field_build_modes($obj_type) {
+  $modes = array();
+  if ($obj_type == 'term') {
+    $modes = array(
+      'full' => t('Taxonomy term page'),
+    );
+  }
+  return $modes;
+}
+
+/**
  * Implement hook_theme().
  */
 function taxonomy_theme() {
@@ -353,12 +382,16 @@ function taxonomy_term_save($term) {
     $term->name = trim($term->name);
   }
 
+  field_attach_presave('taxonomy_term', $term);
+
   if (!empty($term->tid) && $term->name) {
     $status = drupal_write_record('taxonomy_term_data', $term, 'tid');
+    field_attach_update('taxonomy_term', $term);
     module_invoke_all('taxonomy_term_insert', $term);
   }
   else {
     $status = drupal_write_record('taxonomy_term_data', $term);
+    field_attach_insert('taxonomy_term', $term);
     module_invoke_all('taxonomy_term_update', $term);
   }
 
@@ -1358,9 +1391,14 @@ function taxonomy_term_load_multiple($ti
       }
     }
     $queried_terms = $query->execute()->fetchAllAssoc('tid');
-    // Invoke hook_taxonomy_term_load() on the terms loaded from the database
-    // and add them to the static cache.
+
     if (!empty($queried_terms)) {
+
+      // Attach fields.
+      field_attach_load('taxonomy_term', $queried_terms);
+
+      // Invoke hook_taxonomy_term_load() and add the term objects to the
+      // static cache.
       foreach (module_implements('taxonomy_term_load') as $module) {
         $function = $module . '_taxonomy_term_load';
         $function($queried_terms);
Index: modules/taxonomy/taxonomy.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v
retrieving revision 1.28
diff -u -p -r1.28 taxonomy.pages.inc
--- modules/taxonomy/taxonomy.pages.inc	24 May 2009 17:39:35 -0000	1.28
+++ modules/taxonomy/taxonomy.pages.inc	5 Jun 2009 00:30:15 -0000
@@ -50,9 +50,11 @@ function taxonomy_term_page($terms, $dep
           drupal_add_css(drupal_get_path('module', 'taxonomy') . '/taxonomy.css');
 
           $build = array();
-          // Only display the description if we have a single term, to avoid clutter and confusion.
+          // Only display fields if we have a single term, to avoid clutter and
+          // confusion.
           if (count($tids) == 1) {
             $term = taxonomy_term_load($tids[0]);
+            $build += field_attach_view('taxonomy_term', $term);
             if (!empty($term->description)) {
               $build['term_description'] = array(
                 '#markup' => filter_xss_admin($term->description),
