Drupal – Translate View Title

In Drupal Views module, you could not configure the view title translation in the view settings page. The post shows you how to translate view title with the i18n module. For more information about the i18n module, please refer to


So first, make sure you have installed and enabled the i18n module. And you also need to enable the PHP Filter @ Adminster -> Site building -> modules.


So in you view settings page, edit the Header under Basic Settings. Set the input format to PHP Code and input the following.

  $view->page_title = t($view->page_title);


Save the view and now you should be able to search the view title string @ Adminster -> Site building -> Translate interface.


Enter the translated string and check it out on your view page.


Done =)

Reference: Drupal Support – Translate views “Title”

21 thoughts on “Drupal – Translate View Title”

  1. (D7) Translating some text in – Rewrite results
    “Rewrite the output of this field”


    when adding fields like Content: Comment count there is a SUFFIX, PREFIX option.


    1. O, i know what you mean. i have just tried it in a Drupal 7 and it seems that there is no way to translated the SUFFIX and PREFIX content which are dynamic.

      I have tried looking into the $variables in theme_preprocess_page and it is found that the SUFFIX and PREFIX content is concatenated with the field content rather than stored separately inside the $variables array.

      And about the text shown in the Views UI, currently i have no idea but it seems that the translation concept is quite different in D7 compared with D6.

      I suggest you could read the following 2 articles and may get some ideas.


      1. Yeaa it’s a little tricky… do u know way to translate views PATCH ? I guess translating TITLE will be the same as in D6, like u mention above.


  2. Yea I tried:

    “In general views provides a pluggable translation mechanism.

    You can use the one called “core” or the one from i18n_views. You can configure it on admin/structure/views/settings.
    The core one uses the t() function, the second one uses i18n_string.

    In general both mechanism will only work on things like title or exposed filter label, but not on path.
    For the path you could use i18n_path.”


  3. Hi I have done exactly the same thing but I get a message saying that the $view variable is not found. I have put

      $view->page_title = t($view->page_title);

    in the header with PHP Code input format.

    The error it gives me is:
    Notice: Undefined variable: view in eval() (line 2 of /home/steve/domains/drupal-7.8.test/public_html/modules/php/php.module(74) : eval()’d code).
    Notice: Trying to get property of non-object in eval() (line 2 of /home/steve/domains/drupal-7.8.test/public_html/modules/php/php.module(74) : eval()’d code).

    I tried to find out in which variable that information would be but I found nothing.

    I am using Drupal 7 with the last version of views.


    1. This post is for Drupal 6 only and currently there is no a simple way to make the title translatable in Drupal 7. Let me try to figure out another approach and update you later.


      1. I find that in D7, you can directly search the view title in translate interface without wrapping it with t(). can you search the title string?


  4. thanks. your tutorial was for d6, implementing the same for d7 was a bit tricky, but your tutorial helped me


      1. Alain, you dont have to include the php tag. just select plain text and write the english version of the title. then go to the translation page as described by ykyuen and then write the translated version of title(the last part follows the same steps of ykyuen)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.