As far as I see the view titles are not translatable. As a quick fix I just created a new
views-view.tpl.php file and changed the line 32 from:
<?php print $title; ?>
<?php print t($title); ?>
What do you think? Is this a right method?
Drupal Answers is a question and answer site for Drupal developers and administrators. It only takes a minute to sign up.Sign up to join this community
The proper way to use
t() with a non-literal is to pass in the string as a replacement like so:
<?php print t('@title', array('@title' => $title)); ?>
The function comments on
t() contain a very descriptive explanation of why this is necessary so I won't re-hash it here.
I find existing answers rather confusing.
Views (as we know) is extremely cool module. It supports localization plugins.
Go to page
admin/structure/views/settings/advanced to see for yourself:
Preferred way to translate Views is to use Internationalization Views module which depends on i18n_string (i18n package) module.
How to use? Just enable Internationalization Views and go to translate page for your view.
You also may be interested in i18n_string settings here:
Core localization plugin just do
t() for Views titles, headers, footers etc. It's not so flexible and secure, but as a developer you can choose this method in some cases.
How to use? Nothing special here. Your strings will appear in Drupal translate interface after the first request.
You can disable localisation at all or create your own plugin if you need.
Indeed that would not be the the right way to do it. You need to install "Entity Translation", "Internationalization" and "Internationalization Views" modules for doing this. Once you are through with the installation and configuration of these modules, then you can not only translate the title of the views but also the fields in your views as well. Though you will be required to specify the translated strings in the translation interface. Do let me know if you face issues in any of these modules.
There is another way to translate "Views" which makes sometimes sense. Have a look at the Viewfield Module. This allows you to embed a view on a node. So you could basically create a content type with some fields and this Viewfield.
Then create a node, choose a view (i recommend to create blocks) and save it. Then translate the node with the usual i18n tools and translate the title and all the other fields you created on this node.
I think the right, standard and easy way to translate view title is to install Internationalization views which use Entity type of translation which is newer type of translation in Drupal. I verified it worked well for this purpose. I hope it would be possible translate also view path in future.
I've been using entity translation and replaced the title field to0. In a view you need to change the title fields to "Entity translation: Title: translated"
May be a tricky way
What I'm doing is by going to Intarface translation (admin/config/regional/translate/translate)-> searching the view title ->Translating as I need Then I edit the view, I click for example on path option and then apply button to get the save's button one.
After saving , the translation will be shown.