diff --git a/auto_nodetitle.admin.inc b/auto_nodetitle.admin.inc
new file mode 100644
index 0000000..2643ed6
--- /dev/null
+++ b/auto_nodetitle.admin.inc
@@ -0,0 +1,65 @@
+<?php
+
+/**
+ * @file
+ *   Contains administration forms.
+ */
+
+/**
+ * Administration form for each bundle.
+ */
+function auto_nodetitle_settings_form($form, $form_state, $entity_type, $bundle_arg) {
+  $entity = entity_get_info($entity_type);
+  $bundle_name = isset($bundle_arg->{$entity['bundle keys']['bundle']}) ? $bundle_arg->{$entity['bundle keys']['bundle']} : $bundle_arg;
+  $key = $entity_type . '_' . $bundle_name;
+  $default_value = auto_nodetitle_get_setting($key);
+  $form['auto_nodetitle'] = array(
+    '#type' => 'fieldset',
+    '#title' => t('Automatic title generation'),
+    '#weight' => 0,
+    /*'#attached' => array( //Not needed anymore at the moment.
+      'js' => array(
+        'auto-nodetitle' => drupal_get_path('module', 'auto_nodetitle') . '/auto_nodetitle.js',
+      ),
+    ),*/
+  );
+  $form['auto_nodetitle']['ant_'.$key] = array(
+    '#type' => 'radios',
+    '#default_value' => $default_value,
+    '#options' => array(
+      t('Disabled'),
+      t('Automatically generate the title and hide the title field'),
+      t('Automatically generate the title if the title field is left empty'),
+    )
+  );
+  $form['auto_nodetitle']['ant_pattern_'.$key] = array(
+    '#type' => 'textarea',
+    '#title' => t('Pattern for the title'),
+    '#description' => t('Leave blank for using the per default generated title. Otherwise this string will be used as title. Use the syntax [token] if you want to insert a replacement pattern.'),
+    '#default_value' => variable_get('ant_pattern_' . $key, ''),
+  );
+  // Don't allow editing of the pattern if PHP is used, but the users lacks
+  // permission for PHP.
+  if (variable_get('ant_php_' . $key, '') && !user_access('use PHP for title patterns')) {
+    $form['auto_nodetitle']['ant_pattern_'.$key]['#disabled'] = TRUE;
+    $form['auto_nodetitle']['ant_pattern_'.$key]['#description'] = t('You are not allow the configure the pattern for the title, as you lack the %permission permission.', array('%permission' => t('Use PHP for title patterns')));
+  }
+  $entity_tokens = module_invoke_all('auto_nodetitle_entity_tokens');
+  // Display the list of available placeholders if token module is installed.
+  if (module_exists('token')) {
+    $form['auto_nodetitle']['token_help'] = array(
+      '#theme' => 'token_tree',
+      '#token_types' => isset($entity_tokens[$entity_type])?array($entity_tokens[$entity_type]):array($entity_type),
+    );
+  }
+
+
+  $form['auto_nodetitle']['ant_php_'.$key] = array(
+    '#access' => user_access('use PHP for title patterns'),
+    '#type' => 'checkbox',
+    '#title' => t('Evaluate PHP in pattern.'),
+    '#description' => t('Put PHP code above that returns your string, but make sure you surround code in <code>&lt;?php</code> and <code>?&gt;</code>. Note that <code>$entity</code> and <code>$language</code> are available and can be used by your code.'),
+    '#default_value' => variable_get('ant_php_' . $key, ''),
+  );
+  return system_settings_form($form);
+}
\ No newline at end of file
diff --git a/auto_nodetitle.install b/auto_nodetitle.install
index 8d24a31..cce2593 100755
--- a/auto_nodetitle.install
+++ b/auto_nodetitle.install
@@ -30,4 +30,27 @@ function auto_nodetitle_update_1() {
   $ret = array();
   $ret[] = update_sql("UPDATE {system} SET weight = 5 WHERE name = 'auto_nodetitle'");
   return $ret;
+}
+
+/**
+ * Migrate the settings from nodes to entities.
+ */
+function auto_nodetitle_update_2() {
+  $types = node_type_get_types();
+  foreach ($types as $key => $value) {
+    if (variable_get('ant_'.$key)) {
+      variable_set('ant_node_'.$key, variable_get('ant_'.$key));
+    }
+    if (variable_get('ant_pattern_'.$key)) {
+      variable_set('ant_pattern_node_'.$key, variable_get('ant_pattern_'.$key));
+    }
+    if (variable_get('ant_php_'.$key)) {
+      variable_set('ant_php_node_'.$key, variable_get('ant_php_'.$key));
+    }
+    variable_del('ant_'.$key);
+    variable_del('ant_php_'.$key);
+    variable_del('ant_pattern_'.$key);
+  }
+
+  drupal_set_message('Please check all autotitle patterns which use PHP evaluation! Any patterns making use of the <code>$node</code> variable need to be updated to use the <code>$entity</code> variable instead.', 'warning');
 }
\ No newline at end of file
diff --git a/auto_nodetitle.module b/auto_nodetitle.module
index 30e6e4f..0bac57a 100644
--- a/auto_nodetitle.module
+++ b/auto_nodetitle.module
@@ -23,72 +23,200 @@ function auto_nodetitle_permission() {
 }
 
 /**
- * Implements hook_form_FORM_ID_alter() for the node form.
+ * Implements hook_menu().
  */
-function auto_nodetitle_form_node_form_alter(&$form, &$form_state, $form_id) {
-  if (auto_nodetitle_get_setting($form['#node']->type) == AUTO_NODETITLE_ENABLED) {
-    // We will autogenerate the title later, just hide the title field in the
-    // meanwhile.
-    $form['title']['#value'] = 'ant';
-    $form['title']['#type'] = 'value';
-    $form['title']['#required'] = FALSE;
-  }
-  elseif (auto_nodetitle_get_setting($form['#node']->type) == AUTO_NODETITLE_OPTIONAL) {
-    $form['title']['#required'] = FALSE;
+function auto_nodetitle_menu() {
+  // This logic is taken from the field_ui module.
+  // Create tabs for all possible bundles.
+  foreach (entity_get_info() as $entity_type => $entity_info) {
+    if (!empty($entity_info['fieldable'])) {
+      foreach ($entity_info['bundles'] as $bundle_name => $bundle_info) {
+        if (isset($bundle_info['admin'])) {
+          // Extract path information from the bundle.
+          $path = $bundle_info['admin']['path'];
+          // Different bundles can appear on the same path (e.g. %node_type and
+          // %comment_node_type). To allow field_ui_menu_load() to extract the
+          // actual bundle object from the translated menu router path
+          // arguments, we need to identify the argument position of the bundle
+          // name string ('bundle argument') and pass that position to the menu
+          // loader. The position needs to be casted into a string; otherwise it
+          // would be replaced with the bundle name string.
+          if (isset($bundle_info['admin']['bundle argument'])) {
+            $bundle_arg = $bundle_info['admin']['bundle argument'];
+          }
+          else {
+            $bundle_arg = $bundle_name;
+          }
+          // Extract access information, providing defaults.
+          $access = array_intersect_key($bundle_info['admin'], drupal_map_assoc(array('access callback', 'access arguments')));
+          $access += array(
+            'access callback' => 'user_access',
+            'access arguments' => array('administer site configuration'),
+          );
+
+          $items["$path/auto_title"] = array(
+            'title' => 'Auto title',
+            'page callback' => 'drupal_get_form',
+            'page arguments' => array('auto_nodetitle_settings_form', $entity_type, $bundle_arg),
+            'type' => MENU_LOCAL_TASK,
+            'weight' => 10,
+            'file' => 'auto_nodetitle.admin.inc',
+          ) + $access;
+        }
+      }
+    }
   }
+  return $items;
 }
 
 /**
- * Implements hook_node_submit().
+ * Implementation of hook_auto_nodetitle_entity_tokens.
  *
- * Generate the node title as soon as the form has been submitted. That way
- * the node preview is shown right too.
+ * Because now we work with more entities, there is a problem with using tokens.
+ * We have to know for each entity which are the tokens that he can use. And
+ * there is currently no automatic match between the entities and tokens...
  */
-function auto_nodetitle_node_submit($node, $form, &$form_state) {
-  $setting = auto_nodetitle_get_setting($node->type);
-  if ($setting == AUTO_NODETITLE_ENABLED || ($setting == AUTO_NODETITLE_OPTIONAL && empty($form_state['values']['title']))) {
-    auto_nodetitle_set_title($node);
+function auto_nodetitle_auto_nodetitle_entity_tokens() {
+  return array(
+    'node' => 'node',
+    'taxonomy_term' => 'term',
+  );
+}
+
+/**
+ * Implements hook_form_alter() for the node form.
+ */
+function auto_nodetitle_form_alter(&$form, &$form_state, $form_id) {
+  if (isset($form['#entity_type']) && isset($form['#bundle'])) {
+    $info = entity_get_info($form['#entity_type']);
+    $key = $form['#entity_type'] . '_' . $form['#bundle'];
+    $title = $info['entity keys']['label'];
+    // Integration with the title module.
+    $replacement = FALSE;
+    if (module_exists('title') && (title_field_replacement_enabled($form['#entity_type'], $form['#bundle'], $title))) {
+      $title = $info['field replacement'][$title]['instance']['field_name'];
+      $replacement = TRUE;
+    }
+    if (auto_nodetitle_get_setting($key) == AUTO_NODETITLE_ENABLED) {
+      // We will autogenerate the title later, just hide the title field in the
+      // meanwhile.
+      if ($replacement) {
+        $form[$title][$form[$title]['#language']][0]['value']['#value'] = 'ant';
+        $form[$title][$form[$title]['#language']][0]['value']['#type'] = 'value';
+        $form[$title][$form[$title]['#language']][0]['value']['#required'] = FALSE;
+      } else {
+        $form[$title]['#value'] = 'ant';
+        $form[$title]['#type'] = 'value';
+        $form[$title]['#required'] = FALSE;
+      }
+    }
+    elseif (auto_nodetitle_get_setting($key) == AUTO_NODETITLE_OPTIONAL) {
+      if ($replacement) {
+        $form[$title][$form[$title]['#language']][0]['value']['#required'] = FALSE;
+      }
+      else {
+        $form[$title]['#required'] = FALSE;
+      }
+    }
   }
 }
 
 /**
- * Implements hook_node_presave().
+ * Implements hook_entity_presave().
+ *
  */
-function auto_nodetitle_node_presave($node) {
-  // If not yet done, generate the title now.
-  if (auto_nodetitle_is_needed($node)) {
-    auto_nodetitle_set_title($node);
+function auto_nodetitle_entity_presave($entity, $type) {
+  if (auto_nodetitle_is_needed($entity, $type)) {
+    $ant_settings = _auto_nodetitle_get_settings($entity, $type);
+    $setting = auto_nodetitle_get_setting($ant_settings['key']);
+    if ($setting == AUTO_NODETITLE_ENABLED || ($setting == AUTO_NODETITLE_OPTIONAL && empty($entity->{$ant_settings['title']}))) {
+      auto_nodetitle_set_title($entity, $type);
+    }
   }
 }
 
 /**
+ * Implements hook_field_attach_presave().
+ *
+ * Required for compatibility with entity_translation module, which does not
+ * invoke hook_entity_presave() when saving new translations.
+ */
+function auto_nodetitle_field_attach_presave($entity_type, $entity) {
+  auto_nodetitle_entity_presave($entity, $entity_type);
+}
+
+/**
  * Returns whether the auto nodetitle has to be set.
  */
-function auto_nodetitle_is_needed($node) {
-  return empty($node->auto_nodetitle_applied) && ($setting = auto_nodetitle_get_setting($node->type)) && !($setting == AUTO_NODETITLE_OPTIONAL && !empty($node->title));
+function auto_nodetitle_is_needed($entity, $entity_type) {
+  $ant_settings = _auto_nodetitle_get_settings($entity, $entity_type);
+  return empty($entity->auto_nodetitle_applied) && ($setting = auto_nodetitle_get_setting($ant_settings['key'])) && !($setting == AUTO_NODETITLE_OPTIONAL && !empty($entity->{$ant_settings['title']}));
 }
 
 /**
- * Sets the automatically generated nodetitle for the node
+ * Sets the automatically generated nodetitle for the entity.
  */
-function auto_nodetitle_set_title(&$node) {
-  $types = node_type_get_types();
-  $pattern = variable_get('ant_pattern_' . $node->type, '');
+function auto_nodetitle_set_title(&$entity, $type) {
+  $ant_settings = _auto_nodetitle_get_settings($entity, $type);
+
+  // Generate title in different languages?
+  $multilingual = FALSE;
+
+  // Support for title module
+  $entity_info = entity_get_info($type);
+  list(, , $bundle) = entity_extract_ids($type, $entity);
+  $title_field_name = FALSE;
+  $title_languages = array();
+  if (module_exists('title') && (title_field_replacement_enabled($type, $bundle, $ant_settings['title']))) {
+    $title_field_name = $entity_info['field replacement'][$ant_settings['title']]['instance']['field_name'];
+    $title_languages = field_available_languages($type, $title_field_name);
+    $multilingual = count($title_languages) > 1;
+  }
+
+  // Generate titles
+  $titles = array();
+  $pattern = variable_get('ant_pattern_' . $ant_settings['key'], '');
   if (trim($pattern)) {
-    $node->changed = REQUEST_TIME;
-    $node->title = _auto_nodetitle_patternprocessor($pattern, $node);
+    $entity->changed = REQUEST_TIME;
+    if ($multilingual) {
+      foreach ($title_languages as $language) {
+        $titles[$language] = _auto_nodetitle_patternprocessor($pattern, $entity, $type, $language);
+      }
+    }
+    else {
+      $titles[LANGUAGE_NONE] = _auto_nodetitle_patternprocessor($pattern, $entity, $type);
+    }
   }
-  elseif ($node->nid) {
-    $node->title = t('@type @node-id', array('@type' => $types[$node->type]->name, '@node-id' => $node->nid));
+  elseif ($type == 'node' && $entity->nid) {
+    $titles[LANGUAGE_NONE] = t('@bundle @node-id', array('@bundle' => $bundle, '@node-id' => $entity->nid));
   }
   else {
-    $node->title = t('@type', array('@type' => $types[$node->type]->name));
+    $titles[LANGUAGE_NONE] = t('@bundle', array('@bundle' => $bundle));
   }
+
   // Ensure the generated title isn't too long.
-  $node->title = substr($node->title, 0, 255);
+  foreach ($titles as $k => $v) {
+    $title[$k] = substr($v, 0, 255);
+  }
+
+  // Save titles on entity (field)
+  if (module_exists('title') && (title_field_replacement_enabled($type, $bundle, $ant_settings['title']))) {
+    foreach ($titles as $lang => $title) {
+      $entity->{$title_field_name}[$lang][0]['format'] = NULL;
+      $entity->{$title_field_name}[$lang][0]['safe_value'] = check_plain($title);
+      $entity->{$title_field_name}[$lang][0]['value'] = $title;
+    }
+  }
+
+  // Save title on entity (non-field)
+  // This needs be done even if field_title above is updated, because the title
+  // module automatically syncs changes from the "non field title" to the
+  // "title field". Without this line we end up getting "ant" as the title.
+  $entity->{$ant_settings['title']} = $titles[LANGUAGE_NONE];
+
   // With that flag we ensure we don't apply the title two times to the same
   // node. See auto_nodetitle_is_needed().
-  $node->auto_nodetitle_applied = TRUE;
+  $entity->auto_nodetitle_applied = TRUE;
 }
 
 /**
@@ -110,9 +238,9 @@ function auto_nodetitle_node_operations() {
 function auto_nodetitle_operations_update($nodes) {
   foreach ($nodes as $nid) {
     $node = node_load($nid);
-    if ($node && auto_nodetitle_is_needed($node)) {
+    if ($node && auto_nodetitle_is_needed($node, 'node')) {
       $previous_title = $node->title;
-      auto_nodetitle_set_title($node);
+      auto_nodetitle_set_title($node, 'node');
       // Only save if the title has actually changed.
       if ($node->title != $previous_title) {
         node_save($node);
@@ -126,12 +254,19 @@ function auto_nodetitle_operations_update($nodes) {
   *
   * @return a title string
   */
-function _auto_nodetitle_patternprocessor($pattern, $node) {
+function _auto_nodetitle_patternprocessor($pattern, $entity, $entity_type, $language = LANGUAGE_NONE) {
+  $entity_tokens = module_invoke_all('auto_nodetitle_entity_tokens');
+  $token_type = isset($entity_tokens[$entity_type])?$entity_tokens[$entity_type]:$entity_type;
   // Replace tokens.
-  $output = token_replace($pattern, array('node' => $node), array('sanitize' => FALSE, 'clear' => TRUE));
+  if (module_exists('token')) {
+    $languages = language_list();
+    $language_obj = $language == LANGUAGE_NONE ? NULL : $languages[$language];
+    $output = token_replace($pattern, array($token_type => $entity), array('sanitize' => FALSE, 'clear' => TRUE, 'language' => $language_obj));
+  }
   // Evalute PHP.
-  if (variable_get('ant_php_' . $node->type, 0)) {
-    $output = auto_nodetitle_eval($output, $node);
+  $ant_settings = _auto_nodetitle_get_settings($entity, $entity_type);
+  if (variable_get('ant_php_' . $ant_settings['key'], 0)) {
+    $output = auto_nodetitle_eval($output, $entity, $language);
   }
   // Strip tags.
   $output = preg_replace('/[\t\n\r\0\x0B]/', '', strip_tags($output));
@@ -139,64 +274,6 @@ function _auto_nodetitle_patternprocessor($pattern, $node) {
 }
 
 /**
- * Implements hook_form_FORM_ID_alter() for the node type form.
- */
-function auto_nodetitle_form_node_type_form_alter(&$form, &$form_state) {
-  $default_value = auto_nodetitle_get_setting($form['#node_type']->type);
-  $form['auto_nodetitle'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('Automatic title generation'),
-    '#weight' => 0,
-    '#collapsible' => TRUE,
-    '#collapsed' => !$default_value,
-    '#group' => 'additional_settings',
-    '#attached' => array(
-      'js' => array(
-        'auto-nodetitle' => drupal_get_path('module', 'auto_nodetitle') . '/auto_nodetitle.js',
-      ),
-    ),
-  );
-  $form['auto_nodetitle']['ant'] = array(
-    '#type' => 'radios',
-    '#default_value' => $default_value,
-    '#options' => array(
-      t('Disabled'),
-      t('Automatically generate the title and hide the title field'),
-      t('Automatically generate the title if the title field is left empty'),
-    )
-  );
-  $form['auto_nodetitle']['ant_pattern'] = array(
-    '#type' => 'textarea',
-    '#title' => t('Pattern for the title'),
-    '#description' => t('Leave blank for using the per default generated title. Otherwise this string will be used as title. Use the syntax [token] if you want to insert a replacement pattern.'),
-    '#default_value' => variable_get('ant_pattern_' . $form['#node_type']->type, ''),
-  );
-  // Don't allow editing of the pattern if PHP is used, but the users lacks
-  // permission for PHP.
-  if (variable_get('ant_php_' . $form['#node_type']->type, '') && !user_access('use PHP for title patterns')) {
-    $form['auto_nodetitle']['ant_pattern']['#disabled'] = TRUE;
-    $form['auto_nodetitle']['ant_pattern']['#description'] = t('You are not allow the configure the pattern for the title, as you lack the %permission permission.', array('%permission' => t('Use PHP for title patterns')));
-  }
-
-  // Display the list of available placeholders if token module is installed.
-  if (module_exists('token')) {
-    $form['auto_nodetitle']['token_help'] = array(
-      '#theme' => 'token_tree',
-      '#token_types' => array('node'),
-    );
-  }
-
-
-  $form['auto_nodetitle']['ant_php'] = array(
-    '#access' => user_access('use PHP for title patterns'),
-    '#type' => 'checkbox',
-    '#title' => t('Evaluate PHP in pattern.'),
-    '#description' => t('Put PHP code above that returns your string, but make sure you surround code in &lt;?php and ?&gt;. Note that $node is available and can be used by your code.'),
-    '#default_value' => variable_get('ant_php_' . $form['#node_type']->type, ''),
-  );
-}
-
-/**
  * Gets the auto node title setting associated with the given content type.
  */
 function auto_nodetitle_get_setting($type) {
@@ -206,7 +283,7 @@ function auto_nodetitle_get_setting($type) {
 /**
  * Evaluates php code and passes $node to it.
  */
-function auto_nodetitle_eval($code, $node) {
+function auto_nodetitle_eval($code, $entity, $language = LANGUAGE_NONE) {
   ob_start();
   print eval('?>' . $code);
   $output = ob_get_contents();
@@ -216,6 +293,8 @@ function auto_nodetitle_eval($code, $node) {
 
 /**
  * Implements hook_node_type().
+ *
+ * The hook does not exist anymore in d7... this should be updated.
  */
 function auto_nodetitle_node_type($op, $info) {
   switch ($op) {
@@ -236,3 +315,13 @@ function auto_nodetitle_node_type($op, $info) {
       break;
   }
 }
+
+function _auto_nodetitle_get_settings($entity, $entity_type) {
+  $entity_info = entity_get_info($entity_type);
+  if ($entity_info['entity keys']['bundle']) {
+    $result['key'] = $entity_type . '_' . $entity->{$entity_info['entity keys']['bundle']};
+    $result['title'] =  isset($entity_info['entity keys']['label']) ? $entity_info['entity keys']['label']: 'none';
+    return $result;
+  }
+  return FALSE;
+}
\ No newline at end of file
