Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Back in this thread - http://drupal.org/node/128085 - people have posted the following code, which provides a list of category terms.
<?php
$vid = 1; // <---- put correct vocabulary ID here
$terms = taxonomy_get_tree($vid);
$items = array();
foreach ($terms as $term) {
$count = taxonomy_term_count_nodes($term->tid);
// Note: the number of nodes selected per term is controlled by 'feed_default_items' from the RSS publishing settings page.
$result = taxonomy_select_nodes(array($term->tid), 'or', 0, FALSE, 'n.sticky DESC, n.created DESC');
$children = array();
while ($node = db_fetch_object($result)) {
$children[] = node_view(node_load($node->nid), TRUE, FALSE, FALSE);
}
$items[] = array(
'data' => l($term->name,'taxonomy/term/'.$term->tid)." (".$count.") - ".$term->description,
);
}
echo theme('item_list', $items);
?>
Now that snippet works nice and dandy with one problem. The output is coming up only in English.
My category terms ARE translated on the Localization / Manage Strings.
So could be the problem ?
Comment | File | Size | Author |
---|---|---|---|
#2 | 01 category terms.jpg | 23.84 KB | doomed |
#2 | 02 localization.jpg | 19.87 KB | doomed |
#2 | 03 node english.jpg | 11.52 KB | doomed |
#2 | 04 node portuguese.jpg | 17.13 KB | doomed |
#2 | 05 problem.jpg | 18.49 KB | doomed |
Comments
Comment #1
doomed CreditAttribution: doomed commented* So what could be the problem ?
Comment #2
doomed CreditAttribution: doomed commentedI'll repeat my self, but this time with pictures.
Check attachments:
01 - These are my terms, they are all in English only.
02 - This is the translation of one of the terms, done in the Locale module.
03 - A node, viewed in English.
04 - Same node as above, but viewed in Portuguese. As you can see, the category term is translated (normal behaviour).
05 - The aforementioned snippet when put on a block comes up like this. But the problem is that none of the terms are translated.
So if the category terms come up translated on regular nodes, why wouldnt it work the same way on that code snippet ?
Comment #3
Jose Reyero CreditAttribution: Jose Reyero commentedNot implemented for 5.x, try 6.x