When grouping a view on taxonomy term, term is not translated

jrefano - July 24, 2009 - 21:52
Project:Internationalization
Version:6.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:active
Description

Title says it all... I have a view grouped on taxonomy term and I always get the default (English) no matter what. Anyone know what to do about this?

#1

jrefano - July 24, 2009 - 23:18

i sorta got it to work by messing with my views-view-unformatted.tpl.php file, and instead of just printing $title i'm using:

print tt('taxonomy:term:name',$title);

however, this creates a NEW string, which i can easily translate, but i'd like to use the existing translation for the term. if i look at my translation interface search results, the proper textgroup and name looks something like "term:116:name" ... but since this is supposed to be multi-purpose, i can't use a static tid like that. i suppose i could look up the tid from the title text and jam it in there, but is there a way to do this i'm not understanding?

#2

jrefano - July 24, 2009 - 23:58

so, i got it to work by using

<?php
print tt('taxonomy:term:'.$term[0]->tid.':name',$title);
?>

but that doesnt feel like the right way. any insight greatly appreciated.

#3

snicers - August 3, 2009 - 22:31

having the same issue, taxonomy terms on a node sorted ascending using arguments -> no translation showing up

#4

tomsm - September 3, 2009 - 22:05

I have the same issue.

#5

jrefano - September 7, 2009 - 20:05

you guys should try my theme layer fix (above). sure, it's a bit of a hack, but my site needed this functionality and i didn't have the time/expertise fix i18n views.

#6

seanpenn079 - September 21, 2009 - 12:07

I have this problem too! Am I forgetting a certain setting or is this really a bug?

#7

tomsm - September 24, 2009 - 20:33

Yes, you can call it a bug.
I have been waiting some time for a fix allowing translation of taxonomy terms in views.

#8

hukarusai - October 20, 2009 - 01:54

Hi.. I have same problem and this is my solution.
- Edit $title in views-view-grid.tpl.php (my style)
- And use Translate interface...

      <?php if (!empty($title)) : ?>
        <td colspan="2">

        <?php
          $star
= strripos($title,'">')+2;
         
$leng = strlen($title)-strripos($title,'">')-6;
         
$term_name = substr($title,$star,$leng);
         
$title = str_replace($term_name,"",$title).t($term_name);
       
?>


            <h3><?php print $title; ?></h3>
        </td>

#9

tomsm - October 20, 2009 - 06:53

Thanks for the tip. The disadvantage is that you have to translate every taxonomy term again using "Translate interface".

 
 

Drupal is a registered trademark of Dries Buytaert.