In Panel page, we can configure the pane title at the content page.
By default, we could not translate these pane titles in Translate Interface. To fix this problem, we can override the template variable before rendering the panel pane. This could be done by add the template_preprocess_panels_pane() function in the theme template.php
function <theme>_preprocess_panels_pane(&$vars) { $content = $vars['output']; $vars['title'] = !empty($content->title) ? t('@title', array('@title' => $content->title)) : ''; }
Reload the panel page in the translate content first, then you can find the pane title in the Translate Interface.
Done =)
Next: Drupal – Panel Pane Title Translation @ 2
Update @ 2012-01-23: For Drupal 7 users, there is a patch in Panel which makes the Panel title translatable in Translate interface. For more information, please refer to this discussion. Thanks Anon. =)
Hi and thanks for this useful tutorial. I want to ask you if there is a way to translate the panel title. Thanks in advance.
LikeLike
1. Copy the page.tpl.php to your theme folder
2. Make the changes as follow
3. Refresh the page and you should be able to find the title text in translate interface
LikeLike
Thanks for your answer but it didn’t work for me. I use sky theme (6.x) which already has a page.tpl.php file. There i replaced $title; with t($title); . In the panel i use i override user%user page. There i put as title the “Profile of %user:user-raw” token. Now in the translate interface when i search for the string “Profile of” i see the strings for every user and i have to translate them one by one. Can i fix this?
LikeLike
ic. Then you can try this
1. Copy the page.tpl.php to page-user.tpl.php.
2. Edit the page-user.tpl.php as follow
3. In you panel page setting, just keep %user:user-raw token.
4. You should able to find “Profile of ” in translate interface.
LikeLike
Thank you very much. Your workaround worked well.
LikeLike
Great =D
LikeLike
What about the panel title, not panel pane? And also I need to translate mini panel title?
LikeLike
you could try using the page.tpl.php and wrap the h1 title with t().
LikeLike
That is the best way. IMHO.
I’m looking how to translate taxonomy terms in views and panels titles. Have you ever been tried that? Thank You
LikeLike
For Panel title, you can refer to the approach in my previous comment using the page.tpl.php.
For Taxonomy terms translation, you can download and enable the i18n module, Then you will find the Multilingual options by editing a vocabulary.
hope this help =)
LikeLike
Is this for d7 ? I need to translate the pane titles that I override in the pane settings. Any ideas??
LikeLike
This is for Drupal 6. But it may be used in Drupal 7 too.
And you can try to use the following approach too.
Drupal – Panel Pane Title Translation @ 2
LikeLike
“t($content->title)”
It’s incorrect.
From API refs:
“Because t() is designed for handling code-based strings, in almost all cases, the actual string and not a variable must be passed through t().”
The correct way is:
t(‘@title’, array(‘@title’ => $vars[‘output’]->title))
LikeLike
thanks for your comment. i have made the changes. =)
LikeLike
You shouldn’t use the t() function for user-defined strings. Note that there is a patch available for Drupal 7 for testing:
http://drupal.org/node/1179034
so you can see if that works for you.
LikeLike
Thanks for your update. i have added the patch link in this post. =)
LikeLike