Hello,

I'm trying to display a tag list via the Tagadelic module, but my terms are not localized. In #339945: Compatibility with i18n localized terms the Tagadelic maintainer says it should be done in i18n. I wonder what you think of this issue. (The patch in the linked issue does not work any more.)

Many thanks.

Comments

jose reyero’s picture

The main issue with Tagadelic is that it caches the terms, we'd need to fix that term caching, make it per language.

srobert72’s picture

subscribing

fhelmschrott’s picture

subscribing

thekayra’s picture

tt('taxonomy:term:'. $yourtid .':name', $title_term->name) does the trick actually. I used the following code to get the term (title term in the code) and its children.

<?php
	//yourtid = the tid of the term
	$yourtid = 89;
	
	//Title term in h2
	$title_term = taxonomy_get_term($yourtid);
	$title_translation = tt('taxonomy:term:'. $yourtid .':name', $title_term->name);
	
	print '<h2 class="pane-title"><a href="/taxonomy/term/' . $yourtid . '">' . $title_translation . '</a></h2>';
	
	//Children of title term
	$children = taxonomy_get_children($yourtid);

	foreach ( $children as $child ) {
		$translation = tt('taxonomy:term:'. $child->tid .':name', $child->name);
		$items[] = l($translation, 'taxonomy/term/'. $child->tid);
	}

	print ( implode( ", ", $items) );

?>
drupalina’s picture

Hi thekayra,

Where exactly did you put this code??? inside the Tagadelic module or Taxonomy Translation module?
(I really need the Tagadelic to work with i18n (especially because there are 1000s of tags which are strings))

Many thanks!

thekayra’s picture

Hi drupalina,

Sorry for the misunderstanding. I am not using the tagadelic module at the moment. I just wanted to share with you my snippet hoping that somebody will have an idea about "what to change in tagadelic module".

You should check if tagadelic module is using something similar to tt('taxonomy:term:'. $yourtid .':name', $title_term->name) in the file tagadelic.module. The answer is "most probably not".

Then you will have to replace the regular t('blahblah') functions with tt('a little more complicated blah blah') so that terms get their translations automatically and not by strings. You can then create a patch with what you changed and submit it for a review here. If the patch is good then maintaners would include it in the upcoming version or dev.

I hope you get what I am trying to say =).

rsorokine’s picture

If this can be of any help, find the following function in tagadelic.module:

/**
 * theme function that renders the HTML for the tags
 * @ingroup themable
 */
function theme_tagadelic_weighted($terms) {
  $output = '';
  foreach ($terms as $term) {
    $output .= l($term->name, taxonomy_term_path($term), array('attributes' => array('class' => "tagadelic level$term->weight", 'rel' => 'tag'))) ." \n";
  }
  return $output;
}

then copy it to your template.php (while renaming the function to reflect your theme name).
Change $term->name by:
tt('taxonomy:term:'. $term->tid .':name', $term->name)

That's it. No need to patch anything.

norsker’s picture

Component: Code » Blocks

Is there a D7 way of doing the override in template.php? I can't make it work on my D7 installation.

jose reyero’s picture

Status: Active » Closed (won't fix)

No patch so far. No new features for 6.x