Index: tw_pages.inc =================================================================== --- tw_pages.inc (revision 461) +++ tw_pages.inc (working copy) @@ -866,6 +866,10 @@ else if (is_bool($var)) { $output = $var ? 'TRUE' : 'FALSE'; } + // Special case for the t() function. + else if (substr($var, 0, 2) == 't(') { + $output = $var; + } else { $output = var_export($var, TRUE); } @@ -887,7 +891,7 @@ */ function _tw_t_wrap($string, $args = array()) { if (empty($args)) { - return 't(' . $string . ')'; + return "t('$string')"; } else { // Transform arguments before inserting them. @@ -908,6 +912,6 @@ // Pass-through. } } - return 't(' . strtr($string, $args) . ')'; + return "t('". strtr($string, $args) ."')"; } } Index: tw_tablebuild.inc =================================================================== --- tw_tablebuild.inc (revision 461) +++ tw_tablebuild.inc (working copy) @@ -40,17 +40,20 @@ else { $tblresult = db_query($sql); } + // Use slightly different helptext when generating for export vs. tw data hook. + // This is overridden by the schema definition, if it exists. + $help = $t('Table managed by the Table Wizard'); + if ($export) { + $help = $t('Table definition exported by the Table Wizard.'); + } - // Use slightly different helptext when generating for export vs. tw data hook - $help = $export ? - _tw_t_wrap('Views data hook implementation generated by the Table Wizard') : - t('Table managed by the Table Wizard'); - $tables = array(); while ($tblrow = db_fetch_object($tblresult)) { // Table Wizard stores the true DB table name - Drupal knows the name without // the table prefix (if there is one). We'll use the true name for display $tablename = $tblrow->tablename; + // Load the schema so we can get table comments. + $schema = drupal_get_schema($tablename); $dbconnection = $tblrow->dbconnection; if ($dbconnection == 'default') { $rawtablename = schema_unprefix_table($tablename); @@ -75,8 +78,8 @@ while ($colrow = db_fetch_object($colresult)) { $colname = $colrow->colname; $table[$colname] = array( - 'title' => $export ? _tw_t_wrap($colname) : $colname, - 'help' => $export ? _tw_t_wrap($colname) : $colname, + 'title' => $t($colname), + 'help' => $t($schema['fields'][$colname]['description']), // TODO: Truncate text at 80 characters. // TODO: Better yet, do some jQuery magic to expand to the full text 'field' => array( @@ -100,11 +103,11 @@ // Any table with a single primary key column can be a base table if (count($pk) == 1) { $table['table'] = array( - 'group' => $export ? _tw_t_wrap($disptablename) : $disptablename, + 'group' => $t($disptablename), 'base' => array( 'field' => $pk[0], 'title' => $t('Database table @tablename', array('@tablename' => $disptablename)), - 'help' => $help, + 'help' => (!empty($schema['description'])) ? $t($schema['description']) : $help, 'weight' => 10, 'database' => $dbconnection, ),