Index: active_translation.batch.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/active_translation/active_translation.batch.inc,v
retrieving revision 1.6.2.2
diff -u -p -r1.6.2.2 active_translation.batch.inc
--- active_translation.batch.inc	12 Jul 2009 17:54:03 -0000	1.6.2.2
+++ active_translation.batch.inc	13 Nov 2010 20:38:34 -0000
@@ -38,7 +38,7 @@ function _active_translation_batch_opera
     $fields = $values = array();
     // We need to put the node id into the column for each language.
     foreach ($context['sandbox']['languages'] as $lang_code) {
-      $fields[] = db_escape_table($lang_code);
+      $fields[] = active_translation_field_name($lang_code);
       $values[] = 'nid';
     }
     // We can't use db_placeholders() because we're using field names rather
@@ -81,4 +81,3 @@ function _active_translation_batch_finis
   }
   cache_clear_all();
 }
-
Index: active_translation.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/active_translation/active_translation.install,v
retrieving revision 1.7
diff -u -p -r1.7 active_translation.install
--- active_translation.install	19 Jun 2008 18:31:02 -0000	1.7
+++ active_translation.install	13 Nov 2010 20:38:34 -0000
@@ -50,7 +50,6 @@ function active_translation_requirements
   return $requirements;
 }
 
-
 /**
  * Implementation of hook_schema().
  */
@@ -72,7 +71,7 @@ function active_translation_schema() {
   // And dynamically assemble the table with a column per languages. Call
   // language_list() with $reset = TRUE in case the languages have changed.
   foreach (language_list('language', TRUE) as $lang_code => $language) {
-    $field = db_escape_table($lang_code);
+    $field = 'lang_' . db_escape_table($lang_code);
     $schema['active_translation']['fields'][$field] = array(
       'description' => t('The node id of the that should be used when %language is the active language.', array('%language' => t($language->name))),
       'type' => 'int',
@@ -83,4 +82,23 @@ function active_translation_schema() {
   }
 
   return $schema;
+}
+
+/**
+ * Change the field names on the {active_translation} table.
+ */
+function active_translation_update_6000() {
+  $ret = array();
+
+  $spec = array(
+    'description' => t('The node id of the that should be used when %language is the active language.', array('%language' => t($language->name))),
+    'type' => 'int',
+    'unsigned' => TRUE,
+    'not null' => TRUE,
+  );
+  foreach (language_list('language', TRUE) as $lang_code => $language) {
+    db_change_field($ret, 'active_translation', db_escape_table($lang_code), 'lang_' . db_escape_table($lang_code), $spec);
+  }
+
+  return $ret;
 }
\ No newline at end of file
Index: active_translation.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/active_translation/active_translation.module,v
retrieving revision 1.10.2.2
diff -u -p -r1.10.2.2 active_translation.module
--- active_translation.module	30 Aug 2010 12:06:02 -0000	1.10.2.2
+++ active_translation.module	13 Nov 2010 20:38:34 -0000
@@ -69,7 +69,7 @@ function active_translation_nodeapi_view
       $trans = $node->active_translation;
 
       $original = node_load($node->tnid);
-      $best_tran = node_load($trans[db_escape_table($language->language)]);
+      $best_tran = node_load($trans[active_translation_field_name($language->language)]);
 
       $message = '';
       if ($best_tran->nid == $node->nid) {
@@ -155,6 +155,19 @@ function active_translation_nodeapi_dele
 }
 
 /**
+ * Determine the name of the field in the {active_translation} table
+ * for a language.
+ *
+ * @param $lang_code
+ *   String with a language code.
+ * @return
+ *   String with a properly escaped field name.
+ */
+function active_translation_field_name($lang_code) {
+  return 'lang_' . db_escape_table($lang_code);
+}
+
+/**
  * Return an array of language field names that can be used as substutions for
  * one another.
  *
@@ -184,7 +197,7 @@ function _active_translation_language_su
       foreach ($regions as $lang_code) {
         for ($i = 0; $i < $count; $i++) {
           if ($regions[$i] != $lang_code) {
-            $subs[db_escape_table($lang_code)][] = db_escape_table($regions[$i]);
+            $subs[active_translation_field_name($lang_code)][] = active_translation_field_name($regions[$i]);
           }
         }
       }
@@ -207,7 +220,7 @@ function active_translation_recompute($n
     // If there are no tranlsations use this for all languages.
     $translation = array('atid' => $node->nid);
     foreach ($languages as $lang_code) {
-      $translation[db_escape_table($lang_code)] = $node->nid;
+      $translation[active_translation_field_name($lang_code)] = $node->nid;
     }
   }
   else {
@@ -216,7 +229,7 @@ function active_translation_recompute($n
     // Locate all the existing, published translations...
     $result = db_query("SELECT nid, language FROM {node} WHERE tnid <> nid AND tnid = %d AND status = 1", $node->tnid);
     while ($row = db_fetch_object($result)) {
-      $translation[db_escape_table($row->language)] = $row->nid;
+      $translation[active_translation_field_name($row->language)] = $row->nid;
     }
 
     // ...then use the original to fill in any gaps. This will also take care
@@ -224,7 +237,7 @@ function active_translation_recompute($n
     // used.
     $subs = _active_translation_language_substitutions();
     foreach ($languages as $lang_code) {
-      $field = db_escape_table($lang_code);
+      $field = active_translation_field_name($lang_code);
       if (empty($translation[$field])) {
         // To be safe fill in the original...
         $translation[$field] = $node->tnid;
@@ -258,7 +271,7 @@ function active_translation_translation_
     $languages = language_list('enabled');
     $links = array();
     foreach ($languages[1] as $language) {
-      $field = db_escape_table($language->language);
+      $field = active_translation_field_name($language->language);
       if (isset($node->active_translation[$field])) {
         $links[$language->language] = array(
           'href'       => 'node/'. $node->active_translation[$field] . $matches[2],
@@ -326,7 +339,7 @@ function active_translation_db_rewrite_s
         i18n_selection_mode('off');
       }
 
-      $field = db_escape_table($language->language);
+      $field = active_translation_field_name($language->language);
       $result['join'] = "INNER JOIN {active_translation} ON $primary_table.nid = {active_translation}.$field";
       return $result;
   }
