logo       

Taxonomy t() proposed to Drupal developers: msg#00515

php.drupal.devel

Subject: Taxonomy t() proposed to Drupal developers


I added a few t() for locales
and t(term->description) to "title".

Although this is my newbie attempt, it works on the official Drupal 4.3.2.
Terms are translated, descriptions appear on mouse hover and are also
translated.

=> Minor quirk though: it outputs two | between terms as in:
node-term-A || node-term-B || etc.

ONCE THIS QUIRK IS FIXED, COULD SOMEONE TRY IT ON CVS?
(I have not created a CVS site yet)

/*
// PATCH AROUND LINE @37-55
function taxonomy_link($type, $node = NULL) {
if ($type == "system") {
if (user_access("administer taxonomy")) {
menu("admin/taxonomy", t("taxonomy"), "taxonomy_admin", 3);
menu("admin/taxonomy/add/vocabulary", t("create new vocabulary"),
"taxonomy_admin");
menu("admin/taxonomy/help", t("help"), "taxonomy_admin", 9);
}
}
else if ($type == "taxonomy terms" && $node != NULL) {
$links = array();
if ($node->taxonomy) {
foreach ($node->taxonomy as $tid) {
$term = taxonomy_get_term($tid);
- $links[] = l($term->name, "taxonomy/page/or/$term->tid");
+ $links[] = l(t($term->name), "taxonomy/page/or/$term->tid");
+ $links[] = l($text, "taxonomy/page/or/$term->tid",
t($term->description) ? array("title" => t($term->description)) : array());
}
}
else {

/*
** Themes can print taxonomy links with:
**
** if (module_exist("taxonomy")) {
** $this->links(taxonomy_link("taxonomy terms", $node));
** }
*/

$links = array();
foreach (taxonomy_node_get_terms($node->nid) as $term) {
- $links[] = l($term->name, "taxonomy/page/or/$term->tid");
+ $links[] = l(t($term->name), "taxonomy/page/or/$term->tid");
+ $links[] = l($text, "taxonomy/page/or/$term->tid", t($term->description)
? array("title" => t($term->description)) : array());

}
}
return $links;
}
}
// --- End
* /



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise