I really can't believe that I am stuck at this point,,,, this should have been very simple..

I created a view with a list of all employees in the company - easy,,, now I gave a title for this page which is "Our Team" which will be displayed at the top of the views page with the employees list under...

now we go to the French section and guess what the title of this page is "Our Team" and it looks like there is not way of changing to the French version...

everything else is fine.. I read about creating a block with that information but when you use a block you can't use the RSS or the multipage features..

-------------***********-------------- more details

OK,, localizer is installer and its running perfectly...

now,, when I create a new view and I select "Provide Page View" as my view option,,,

now in that page there is a field called "Title:"
now this should be the title of the views once the page is displayed with the results..

what I don't see is how we can translate this title into different language

I thought "Localizer strings translation" will be able to translate it it but it doesn't work..

is there a way to get this field translated?

Thanks

Comments

Damjan Dvorsek’s picture

I dont know how this is done with localizer module I'm using i18n modul. The non-elegant workaround that I'm useing is to create same views with different titles for different languages and than showing tham inserted in a node (that can have a translated partner node) or in the case of block views I place them in multilingual blocks (under Block menu)
I also found this
http://agaricdesign.com/note/views-titles-and-text-and-i18n-preliminary-...
but haven't tried it yet.

More elegant way of translating view's title and lables would be great.

zmove’s picture

subscribing

There is another "non elegant" solution, it's to write your title in the title fieldset instead of the title textfield in your view.

In the fieldset you can choose the input format, so you can put php in it and make :

print t("my translatable title");

then you can translate your title by going in the translation string form.

Pawel Gawlowski’s picture

Hi, my solution is to write a custom theme function for views in your phptemplete file.
For example:
function phptemplate_views_view_table($view, $nodes, $type)

where you copy content of original function and add one line:
drupal_set_title(t($view->title));

You can also translate table columns in same manner.

best regards,
Pawel Gawlowski
e-solutions.pl
drupal.pl

Janice Harper’s picture

Another non-elegant solution is to not show the title for the views block/page at all, but instead use the header section of the views block/page.

print t('Your translateable title');

For this to work you also must enable PHP code as an input format for the header.

Arhips’s picture

Another non-elegant solution is to not show the title for the views block/page at all, but instead use the header section of the views block/page.

<h2>
<?php print t('Your translateable title'); ?>
</h2>

For this to work you also must enable PHP-code as an input format for the header.

---
Arhips the Super-CEO
www.comeks.com

leeomara’s picture

It amounts to duplicating your view so you have one per language, with localized titles, headers, footers and using the insert_view input filter pull the view content into a page.

Outlined here: http://www.computerminds.co.uk/multilingual-views-drupal-when-using-i18n...

llribas’s picture

  1. in the "Argument Handling Code":
    $view->page_title = t($view->page_title);
  2. you put a title in the "Title" field for your view (this is going to be the title in english)
  3. visit at least one time the view url (view page), just to let the system catch the new string (the title)
  4. go to "Admin -> Localization -> Manage strings" and search and translate the titles strings

Lluis Ribas

pyotr777’s picture

At least for my Drupal 6.15 and Views 6.x-2.8.

My method is a little different:

1. In the view Header (in the view Basic settings) I put:

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

(With < php tags )

2. Check "PHP code" under "Input format".
3. Save the view and display it in target language.
4. Go to admin/build/translate/search (Administer » Site building » Translate interface)
5. Search for the title - now it's there! Translate the string as usual.

alauzon’s picture

I did that on my Drupal 7 and I get this error message:
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.

Alain Lauzon

nadavoid’s picture

I believe the solution that you're looking for is built into the i18n package. http://drupal.org/project/i18n

1. Install Views Translation module.
2. Re-save the field in views that you want to translate. (Title field, etc.)
3. Go to the Translation interface (admin/build/translate/search), leave the search box empty, select "views", click Search, and you should now see the string from views that you need to translate.

Note: searching for the text you want to translate will work too. But searching for the "coded" string (such as "gallery:default:title") doesn't.

blueblade’s picture

Hi nadavoid,

I looked at the page but saw nothing is named 'Views Translation Module', can you please let me know which module you are talking about exactly? sorry for asking such stupid question and thanks for your help.

BB

frozensage’s picture

1. Placed title in the view as you would normally.
2. Then went to /admin/build/translate/search, type in the title I just entered, select view, and click search.
3. I got a list of places where the title appeared and needs translation.
4. Translate and save then refresh the view and it should have worked.

blueblade’s picture

frozensage,

I have just tried doing that but got this message 'No strings found for your search.' Are you using Drupal 6?

BB

Anonymous’s picture

Hi there, took me a bit as well. I am not sure if you eventually figured it out, but you do need to remove titles manually entered via the Block Edit page.

Lemme rephrase this a bit.
When you make a Block w/ Views with a title that needs to be translated, give it a title from within Views UI.
Then when you go to enable the block, just make sure the title field is empty. You can then do a search via the translation interface and translate it and it should work. ( of course u need to have the Views Translation Module enabled)

espurnes’s picture

Hi,
in drupal 6.19 or 6.20 it's easy as follow the steps frozensage has said:

1.- write a title in the view
2.- go to /admin/build/translate/search, type the title and press enter
3.- select the proper string from the list and translate it

citronica’s picture

Perfect! This also works in D7, expect the path is /admin/config/regional/translate/translate

Note that the string search is case sensitive.

GreenLanterrn’s picture

Thanks,

Works like a charm, even in D7

Anonymous’s picture

Sorry can't remember, but I think its packaged with the i18n module.

acura’s picture

Just go to translate interface, then search for the term u want to translate,add the 2nd language then save.
I noticed that you need to research for it (wht u you have just translated ) to work.

jdench’s picture

This worked OK for some views, not others. First I couldn't find the string for one view title. I thought it might be because the title was not on default view. Anyway after some fiddling around (not sure what was solution), I found string in translation interface and translated. But then, alas, no difference on the actual page. Eventually I figured out that the Page title was overriding the Default title. When I made the Page the same as the Default the translated string finally appeared as expected on the French page.

ain’s picture

Feasible solution, worked for me just fine. Should be somewhat bearable for the end user as well. Thanks.

pedro_enrique’s picture

Yo recomiendo esta solución, para mi funcionó perfectamente. Solo asegúrense de actualizar todo una vez que instalen Views Translation, desde los campos del titulo en la vista, la propia vista y sobre todo refresquen los textos en el traductor de interfaz antes de buscar lo que deseen traducir. Recuerden limitar la búsqueda por vistas.

2dareis2do’s picture

Excellent - just need to work out how to translate the path now.

Many thx

TanvirAhmad’s picture

Sorry, but I cant see this path anywhere...
admin/build/translate/search

am I missing something?

t@n

karolus’s picture

This is a great addition--with it I was able to translate some of the final remaining items on a multilingual site.

liezie_D’s picture

Solution from @nadavoid worked for me too..

drifter’s picture

There's a new i18n views module that got split off from i18n, you need that too nowadays:

http://drupal.org/project/i18nviews

drifter’s picture

And just to note all the steps:

  1. download the i18n and i18nviews modules and enable i18nviews + dependencies
  2. if you have a pre-existing view, go in and edit the title, just re-saving the view doesn't seem to work
  3. the title should be in the SITE DEFAULT LANGUAGE
  4. go to /admin/build/translate/search and search for the string, you should find it and be able to translate it
Dragan Eror’s picture

Also, should refresh strings at admin/build/translate/refresh (Views check box).
After it you can search for stings.

DarkteK’s picture

I changed everything and nothing worked, thx so much for this tip, it worked

luco’s picture

subscribing ;)

_________________________

"There is no off position on the genius switch."
- David Letterman

70111m’s picture

subscribe

russellb’s picture

Don't forget to clear the cache if you are seeing views titles not translating.

Kristen Pol’s picture

This is an old issue but people keep coming back to this thread, so here's a summary:

You can translate the title of your multilingual view by using the Internationalization views module.

Documentation:

Kristen

-Kristen
Profile: https://www.linkedin.com/in/kristenpol
Drupal 7 Multilingual Sites: http://kristen.org/book

sano’s picture

This is the correct link to the i18n views module

drupalfan81’s picture

I still can't get this to work. I installed the i18nviews module, but it's nowhere to be found in the module list. How do I enable this module?

luco’s picture

go to the Modules page. it's in Multilingual - Internationalization › Views translation.

once enabled, go to Configuration › Regional and language › Translate interface › Translate. the Limit search to dropdown should have a new option called "Views", so you can filter Views strings.

cheers

_________________________

"There is no off position on the genius switch."
- David Letterman

apprayo’s picture

Go to: admin/config/regional/translate/i18n_string, check 'Menu', and click 'Refresh strings'.
Then the newly created menu items will be included in the search results when you want to translate them.

Hope this helps.

==============

Edit: my assumption is that the view title also goes to the menu item.

MauMau’s picture

I have a view on a multilingual site showing taxonomy terms.

I use http://drupal.org/project/i18nviews and have changed the taxonomy term name field
from: taxonomy term name
to: taxonomy term name (translated)

It works rather well.

Yet I have another view that is causing me problems.

It's showing nodes tagged with a certain taxonomy term.

Title: %1 (<-- the taxonomy term name, obviously never translated)
Format: Unformatted list | Settings 

In english it gives my headlines like

apple
orange
banana

In german it gives my headlines like

apple
orange
banana

Even if the terms have been translated.

I can see how I could make a new template/module that used
http://drupalcontrib.org/api/drupal/contributions!i18n!i18n_taxonomy!i18...
to get the right headline for the view.

But isn't there a smarter way?

tomas.teicher’s picture

Hi
I have the same problem,
have you found any solution how to do this using UI?

andriic’s picture

this work for me

function MYMODULE_views_pre_render(&$view) {
    if ($view->name == 'VIEWS_NAME' && $view->current_display == 'VIEWS_DISPLAY') {
            $view->build_info['title'] = i18n_taxonomy_localize_terms(taxonomy_term_load(arg(2)))->name;
    }
}
stefvanlooveren’s picture

I always fix this with a small module:

function MYMODULE_views_pre_render(&$view) {
    if ($view->name == 'VIEW_NAME' && $view->current_display == 'DISPLAY_NAME') {
            $view->build_info['title'] = t('MY TITLE');
    }
}

Then I can go to 'translate interface' and translate the title.

djg_tram’s picture

For those who don't want to solve this at a module level, it can be handled easily with a template in the theme. Locate the file views-view.tpl.php inside the Views module, copy it into your theme folder and modify the beginning:

<div class="<?php print $classes; ?>">
  <?php print render($title_prefix); ?>
  <?php if ($title): ?>
    <?php print t($title); ?>
  <?php endif; ?>
  ...

The important part is to add the t() to the

print $title;

line. Refresh the cache and it will pick up the translation.

W.M.’s picture

Thank you very much for sharing this idea.

studio ml’s picture

In template.php:

<?php
function THEME_views_pre_render(&$view)  {
  $view->set_title(t($view->get_title()));
}
?>

Then translate the title in the translate interface.

sano’s picture

worked nicely. Thanks.

rajandro’s picture

Use the string translation admin interface of the view title for other language!

http://example.com/admin/config/regional/translate/translate

fabul’s picture

I've spent some time to find the solution to translate a view title. Finally, it's very easy.

You don't need any custom.

My context is : a french site to translate in english. The default language is French.

i18n is installed and enabled.

The view string appears in regional translation (strings). I've just discovered that unless the default language is french, the french title appears in englih string. My conclusion is that views have their own default langage which is english.

So first I've edited the views and modified their title, translating them into english.
In a second step, the english title appeared in the regional translation interface and I could translate it into french.

no custom was needed.

I hope this will help.

sylvain lavielle’s picture

Yeah, right ! I had to get the cache cleared for this taking effect but it worked. thanx

misikir’s picture

/*
* Implementation of hook_views_pre_render(&$view)
*/
function YOURTHEME_views_pre_render(&$view) {
global $language;

if(isset($view->args[0])) {

i18n_string_translate_langcode( $language->language );
$localized_term = i18n_taxonomy_localize_terms( taxonomy_term_load( $view->args[0]));
$view->set_title($localized_term->name);
}

}