[support] Translating table view headers

Idan Arbel idan at arbel-designs.com
Tue Feb 12 10:29:43 UTC 2008


Hello,

 

I'm trying to translate the headers a table created from a table view.

 

I've added this code into my template.php file:

 

function enhunchbaque_views_view_table_shows($view, $nodes, $type) {

    $header = array();

    foreach ($view->field as $field) {

            $temp = $field['label'];

        $cell['data']=t("$temp");

        $cell['class']=$field['header'];

 

                        drupal_set_message("<pre>" . print_r($temp,true) .
"</pre>");

        $header[] = $cell;

    }

    $fields = _views_get_fields();    foreach ($nodes as $node) {

        $row = array();

        foreach ($view->field as $field) {

            $cell['data'] = views_theme_field('views_handle_field',
$field['queryname'], $fields, $field, $node, $view);

            $cell['class']='view-field-'.$field['queryname'];

            $row[] = $cell;

             

        }

        $rows[] = $row;

    }

      return theme('table', $header, $rows, array('class' => 'show-table'));

}

 

The code seems to run fine.

 

The thing that I changed is this part

 

            $temp = $field['label'];

        $cell['data']=t("$temp");

 

 

I'm trying to get the headers translated using translate strings, but they
don't appear when I search.

 

Am I doing something wrong?

 

Idan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20080212/f51983f3/attachment-0001.htm 


More information about the support mailing list