I found that the tab titles are not run through t() and therefore can't be translated. I'm attaching a patch that fixes this.

Comments

samlerner’s picture

StatusFileSize
new471 bytes

Attaching patch for D5.

wim leers’s picture

Title: Adding internationalization to tab titles » Route tab titles through t()
Category: support » bug
Status: Needs review » Fixed
dawehner’s picture

what happens if the title of the content is dynamic? for example if a pane title is a node title

wim leers’s picture

Then no translation will be found and all will be fine.

And yes, this is somewhat tricky, but Drupal's language/translation system doesn't properly support dynamic strings. Or at least it doesn't distinguish very clearly between them.

Or am I missing something? That's very well possible, I no experience with multilingual Drupal.

dawehner’s picture

Status: Fixed » Needs work

i know a site where some developers runned everything througth t() and this broke the site full, because the locale cache kills the performance.

and here is the code in the locale function:

<?php
    // Either we have no such source string, or no translation
    else {
      $result = db_query("SELECT lid, source FROM {locales_source} WHERE source = '%s'", $string);
      // We have no such translation
      if ($obj = db_fetch_object($result)) {
        if ($locale) {
          db_query("INSERT INTO {locales_target} (lid, locale, translation) VALUES (%d, '%s', '')", $obj->lid, $locale);
        }
      }
?>

So if not translation can be found, its insert into the locales_target Database, and this is horrible :(
I set it to code needs work

dawehner’s picture

additional, i don't understand why this should be done by tabs panel style, this could be also done by panels

wim leers’s picture

(I had typed this message and then closed the browser window. Stupid. That's what you get for working this late.)

#5: I had no idea it worked that way. It looks … weird to me that it works that way (that's a euphemism for "plain stupid" by the way). I'm pretty sure that I've done this incorrectly in just about every module of mine then.
But … how else can you do dynamic string translation in Drupal?

#6: Agreed. Patch reverted: http://drupal.org/cvs?commit=220972, http://drupal.org/cvs?commit=220974.

dawehner’s picture

thats what i18n does

there is a function tt() which works like t() but it uses a identifier like taxonomy:term:$tid

wim leers’s picture

But the tt() function isn't in core. So … that'd be ugly. Are there clear docs on this anywhere?

wim leers’s picture

Version: 5.x-1.5 » 6.x-1.x-dev
nedjo’s picture

See http://drupal.org/node/304002 for some documentation.

smoothify’s picture

Status: Needs work » Closed (duplicate)

This should be done through panels rather than panels_tabs.

There is an issue on this subject here:

#568740: Translating Pane Titles

juanjo_vlc’s picture

#12 I disagree, because at this moment the "workaround" for panes is done just before rendering the pane, so the title is loaded with original title, and not the translated one.

The patch propossed on #1 should do the job, but it needs a notice 'use with care' or 'use at your own risk' because t() adds entries to the locales_source table and caches the results. This patch is good if you use some tabbed panes with user assigned titles.

dawehner’s picture

Status: Closed (duplicate) » Needs review
StatusFileSize
new566 bytes

Are we really sure that translating pane titles and panel_tabs-titles are the same?

From my perspective it's not. Here is a patch to translate panels_tabs titles.

paul555’s picture

For me the first patch was a good workaround as i only use static strings as tabs titles.

broncomania’s picture

Subscribe 15 works perfect.