I use i18ntaxonomy and noticed that it doesn't translate terms when they are displaying in Views. I think it's bad and created a patch to translate taxonomy terms' names in views. It implements hook_views_data_alter() and changes standard handler to one, which extends it and adds i18nstrings() translate wrapper.
Please review it and, if needed, commit.
I didn't understand how to create new folders with CVS patches, so there are two separated files: patch for i18ntaxonomy.module and 'views' folder.

CommentFileSizeAuthor
#2 i18ntaxonomy.patch729 bytesyeputons
#2 i18ntaxonomy.zip1.04 KByeputons
#10 views.zip2.62 KByeputons
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

luco’s picture

hey man,

same here. how come no one saw this coming?

anyways, I can apply the patch on my website and test it. would you like me to? simply attach your files to this issue and I'll check back later.

cheers,
Luciano

yeputons’s picture

FileSize
1.04 KB
729 bytes

I'm really sorry, but the attachments system doesn't like me :(
UPD: don't use *.zip from this message. Use one from post #10 instead (in this post there is only translation of 'Term: Name' , neither for 'Term: Description', nor for 'All terms').

luco’s picture

thanks. I've applied the patch against i18ntaxonomy.module and placed the views folder under sites/all/modules/i18n/i18ntaxonomy - but nothing changed.

my terms in Portuguese still appear in English when you view a full node - but not when you access a view.

check out the difference by visiting my blog: http://luco.ws/en/blog and selecting a post.

yeputons’s picture

Did you clear Views' cache? Also you may need to resave your views (to update handler information).

luco’s picture

I use the Administration menu's "clear all caches" command quite often ;]

and I tried to open and resave my view as well. neither worked :/

btw where exactly should I drop those .inc files?

yeputons’s picture

i18n/i18ntaxonomy/views/i18ntaxonomy.views.inc
i18n/i18ntaxonomy/views/i18ntaxonomy_handler_field_taxonomy.inc
On my site 'Clear all caches' doesn't clear Views cache. Try it?

luco’s picture

well, the files are in place and I had already saved my view. I even removed the taxonomy field, saved, closed; then added that field back again, saved and closed.

I also cleared the Views' cache in admin/build/views/tools.

still no joy. any suggestions?

yeputons’s picture

What you see at admin/build/translate in the 'Taxonomy' column? You should not see 0/125, but 125/125.
P.S. my patch translates only 'Taxonomy: Term' field, neither 'Taxonomy: Term description', nor 'Taxonomy: Vocabulary name'

luco’s picture

well my website's default language is Portuguese.

for PT-BR (Brazillian Portuguese) there's 0/42, but in English there's 22/42.

in English, some strings are translated, while for others there's no need - like interfaces (which is a cognate) or gadgets (which is used in Brazil as well).

you can see that it only happens in a view; when you access the node itself, translations work.

anyways, man, you're being a great help. please don't give up on me :)

edit: I've noticed that if I use "Taxonomy: Terms" instead of "Taxonomy: All terms", it shows up in English. BUT that generates duplicates.

maybe there's some setting I'm missing for my vocabulary, or language negotiation ... ?

yeputons’s picture

FileSize
2.62 KB

No, it's normal. "Taxonomy: All terms" translation is not implemented yet. But test version is available (in attachments). Unzip it to i18ntaxonomy/views with replacement of all old files, clear Views' cache and enjoy :)

luco’s picture

it worked! :) thank you so much. they should get this change commited ASAP.

cheers

esclapes’s picture

subscribe

odisei’s picture

+1

YK85’s picture

+1 subscribing

Raphael Apard’s picture

Using module PHP Custom code, you can translate terms name.
I add a PHP custom code with php code :

$term_name = tt("taxonomy:term:$data->tid:name", $data->term_data_name, NULL, TRUE);
$term_name = truncate_utf8($term_name, 22, FALSE, '...');
print l($term_name, 'taxonomy/term/' . $data->tid);
Pollydor’s picture

subscribe

murmel’s picture

I didn't get the code on # 15 to work, maybe I put it in the wrong place.
This code is a little remake of the code above, and will work if you put it in a views theme file.

<?php

$term_name = tt("taxonomy:term:$row->term_data_tid:name", $row->term_data_name, NULL, TRUE);
$term_name = truncate_utf8($term_name, 22, FALSE, FALSE);
print $term_name;

?>
wuh’s picture

Patch in #2 and the zip file in #10 work for me on 6.x-1.x-dev, 2010-Sep-21

Please commit!

drifter’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

I can too confirm that the patch works nicely. Does this belong in i18ntaxonomy, or i18nviews?

jhodgdon’s picture

I made a patch for a related issue at #976872: Taxonomy terms are not translated in Views, although it was a patch against the Views module, so not really ready to be added to Internationalization.

See also #530354: When grouping a view on taxonomy term, term is not translated, which appears to be related.

mandreato’s picture

subscribe

benklocek’s picture

Subscribe

rmontero’s picture

Subscribe

jonaswouters’s picture

Subscribing.

Any update on this?

gandhiano’s picture

I confirm that this bug exists in i18n 6.x-1.7 and that patch in #2 + zip in #10 function properly.

Jose Reyero’s picture

Project: Internationalization » Internationalization Views
Version: 6.x-1.x-dev » 6.x-3.x-dev
Component: Taxonomy » Code

No views here, maybe for this other module.

Solariss’s picture

Version: 6.x-3.x-dev » 6.x-2.0
Component: Code » User interface
Assigned: Unassigned » Solariss
Category: feature » support
Status: Reviewed & tested by the community » Needs review

Yes #2 + #10 covers problem if you use taxonomy as regular view field.

But I use taxonomy as argument for a title of display "Nodes in category: %1" and unfortunately this patch doesnt cover this problem :-(

Does any one can help me?

jhodgdon’s picture

RE #27 - see comment #20 above.

SaxxIng’s picture

Version: 6.x-2.0 » 6.x-2.x-dev

I confirm using last 2.x-dev also "taxonomy: All terms" works well!

goofrider’s picture

@Solariss #27

I'm having the same problem, I'm using %1 as my Views title and breadcrumb (the argument is a termid with depth ), the title displayed would be in English only and not translated according to current language.

I;m using Views 6.x-2.12

YK85’s picture

Hello, I was wondering if there may have been further development? Thank you!

Marko B’s picture

Confirming latest dev works ok for taxonomy all_terms but in summary arguments section its not working.

Summit’s picture

Subscribing,
edit: I had to visit [website]admin/build/translate/refresh and now my terms are available for string translation and that is working with newest views 3.dev.
argument section is not working in 2.dev and 3.dev. Greetings, Martijn

Lukas von Blarer’s picture

#10: uhm... where do i put these files? is this still compatible? if yes, why has this no been committed yet?

Stolzenhain’s picture

subscribing

ytsejam’s picture

Patch works beautifully with me, really needs to be committed!

drifter’s picture

Status: Needs review » Reviewed & tested by the community

There have been enough confirmations I think.