Translate exposed filter labels of views in drupal

Posted by: 
Dominique De Cooman

Translate exposed filter labels
Again go and get the theme_views_display_filters function out of the views.module file. Put it in your template.php file. Make sure that around every label a t function is wrapped. And that's it, go to admin/setting/locale, look up the string and translate it into the other language. (Dont forget to surf one time to the page you want to translate)

function phptemplate_views_display_filters($view) {
  $amount = count($view->exposed_filter);
  $count = 0;
  while ($count < $amount) {
    $view->exposed_filter[$count]['label'] = t($view->exposed_filter[$count]['label']);//here a t function is wrapped around the labels
    $count++;
  }
  return drupal_get_form("views_filters", $view);
}

Comments

Translate exposed filter labels of views in drupal

Thanks a lot this was really helpful!!!!!!!

Add new comment