logo       
Bookmark and Share

Re: Taxonomy t() proposed to Drupal developers: msg#00554

php.drupal.devel

Subject: Re: Taxonomy t() proposed to Drupal developers

This patch does not fit with the current role of the locale subsystem, which is to translate *interface* strings. None of the site specific strings are run through t() currently. Gerhard is proposing that Drupal should extend the usage of the locale system to the site specific strings too... That is still to be discussed IMHO. :)

I would at least differentiate the non-interface t() calls with a st() function or something... ('st' = site translation as opposed to 't' being the interface translation). Then some meta info need to be added to the site specific locale strings, so one can distinguish between them on the admin interface and when generating .po files.

Goba

Michael Lessard wrote:
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 | Mail Home | sitemap | FAQ | advertise