using drupal 6
How to get the translated term name when i have the term tid as input?

-> SOLVED) ISSUE1
I tried using the tt($name, $string, $langcode = NULL, $update = FALSE)

In execute php of devel module:

<?php
$node = node_load(206);  //this node is in chinese (i also tried with an english node)
$term = reset( taxonomy_node_get_terms_by_vocabulary($node, 1));
print_r($term);
$name=tt("taxonomy:term:$term->id:name", $term->name, 'zh-hant');  //zh-hant is chinese langcode
echo $name;
?>

This, however, returns the term name in english (default language), not in chinese:

stdClass Object
(
    [tid] => 4
    [vid] => 1
    [name] => sealing
    [description] => 
    [weight] => 5
    [language] => en
    [trid] => 0
)
sealing

How to solve this? -->

<?php tt("taxonomy:term:{$tid}:name", $name, 'zh-hant',FALSE) ?>

use {} around variables. To get the term name in the current site language remove the language code and FALSE parameters.

-> (SOLVED) ISSUE2
Also to get the term object, i don't want to use a node. But only the term tid
In drupal 7 there is: taxonomy_term_load($tid)

Is there a way to do this in drupal 6? -> ofcourse: taxonomy_get_term($tid)

Comments

yangke’s picture

i also noticed that when i go to 'mydomain/taxonomy/term/7' ; i get the terms in all languages.

Maybe something is wrong with my taxonomy translation setup?