Route tab titles through t()
SamLerner - June 2, 2009 - 18:11
| Project: | Tabs panel style |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | needs work |
Description
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.

#1
Attaching patch for D5.
#2
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
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
#11
See http://drupal.org/node/304002 for some documentation.