Project:Panels Tabs
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:needs review

Issue Summary

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

#1

Attaching patch for D5.

AttachmentSize
panels_tabs_i18n.patch 471 bytes

#2

Title:Adding internationalization to tab titles» Route tab titles through t()
Category:support request» bug report
Status:needs review» fixed

Thanks! Committed to D5 and D6:

http://drupal.org/cvs?commit=219944
http://drupal.org/cvs?commit=219946

#3

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

#4

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.

#5

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

#6

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

#7

(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.

#8

thats what i18n does

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

#9

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

#10

Version:5.x-1.5» 6.x-1.x-dev

#11

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

#12

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

#13

#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.

#14

Status:closed (duplicate)» needs review

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.

AttachmentSize
translate-display-title.patch 566 bytes

#15

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

#16

Subscribe 15 works perfect.

nobody click here