I'm using Vocabulary Index on a multilingual site with taxonomy and the i18n module. I have set up the translation mode for my vocabulary using the 2nd option: "Localize terms. Terms are common for all languages, but their name and description may be localized." Then I translated the vocabulary name, all the terms and their descriptions using the taxonomy translator page of the "Translation table" module. This works very well with the core features, but when I use Vocabulary Index, this is all displayed in the default language only.
The problem is that Vocabulary Index does not translate these terms, except in one place. But there, it uses the t() function. However, for translation of the taxonomy terms the tt() function should be used.
I have attached patches for the vocabindex.module and vocabindex.view.inc files which use the tt() function in all places where I think it's necessary. It works nicely for me.
(I'm not sure if tt() is available when i18n is not installed. If not, maybe we need to replace it with a dummy function in this case.)
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | vocabindex.patch | 9.14 KB | Cito |
| vocabindex.view_.inc_.patch | 763 bytes | Cito | |
| vocabindex.module.patch | 861 bytes | Cito |
Comments
Comment #1
xanoGreat initiative! :) Could you provide one large patch made with
cvs diff -upN > foo_bar.patchfrom Vocabulary Index' root folder? This makes the patch more readable and therefore easier to review. We also need a wrapper function for this so Vocabulary Index doesn't require i18n. Something like this:Comment #2
Cito commentedOk, here it is.
Comment #3
xanoWhoa, that is one weird patch, hehe :-P
I'll take a closer look at it tomorrow, thanks! :)
Comment #4
aimevpHi,
Is it possible it isn't just a Vocabulary Index problem? I have the same issue in my views. I don't have this module installed.
My situation is this:
I have a multilanguage website with a page called downloads. I made a language neutral custom content type to upload files. And each upload is categorized by a vocabulary that I've setup with the "localize terms" option. Then I made a view where the terms are used in an exposed filter. I had hoped that when I translate my terms i would see the translation in my dropdown box but I hoped wrong.
Initially while making my vocabulary I selected "english" as language of my vocabulary because I thought you needed to select a starting point for the translation. But in my view there were suddenly no terms available when i switched the language.
When I deleted the language specification in the database (for voc. and all terms) I had better but not perfect results. Then I got the english terms when I switched the language but no translation.
So I'm wondering if this isn't a taxonomy or i18n issue? Or is it me who did something wrong?
Grtzzzzz,
Hatznie.
Comment #5
xanoTaxonomy does nothing with term translation. i18n works fine, Vocabulary Index just wasn't integrated with it well enough.
Comment #6
Cito commented@hatznie: i18n provides the translation for taxonomy terms as a special feature. The only problem is that most modules - including Views - do not (yet) make use of this feature.
Comment #7
Cito commentedBy the way, the Taxonomy Menu has a similar problem (http://drupal.org/project/issues/taxonomy_menu).
Comment #8
xanoI tried i18n 5.x-2.5, but I couldn't find the option for multilingual vocabularies I know from 6.x-1.0. We need to find out what's possible for Drupal 5 and create patches for both branches.
Comment #9
arski commentedUmm, I tried applying this patch but it doesn't seem to really work... a lot of rejects etc. Could you please update the patch to the latest version of (6.x) vocabindex? Thanks!
Comment #10
micheleannj commentedsubscribing
Comment #11
micheleannj commentedJust dug around in the code and, it's not a robust solution, but you should be able to just change the following
function vocabindex_term_link($term, $vi) {
$term->path = taxonomy_term_path($term);
$term->name = check_plain(t($term->name));
to
function vocabindex_term_link($term, $vi) {
$term->path = taxonomy_term_path($term);
$term->name = check_plain(tt($term->name));
(it's "t" to "tt" in the last line).
The same thing would have to happen in the alphabetization functions too, or the sort order will be off...
Comment #12
eiland commentedjust, enlighten me, does this now work for D6.3 I just installed it and it seems not to?
Comment #13
eiland commentedSee http://truuk.climatesceptics.org/en/positie-van-de-boven - this page does only use 18n for the links, but not for the descriptions.
Comment #14
gritter commentedThe solution in #11 did not work for me (error message), but with a slight modification, it's ok:
vocabindex-6.x-2.3, file vocabindex.view.inc, line 590:
Replace
$term->name = check_plain(t($term->name));
by
$term->name = check_plain(tt("taxonomy:term:$term->tid:name", $term->name));
Comment #15
xanoVocabulary Index 5.x-y.z is no longer supported.
Comment #16
eiland commentedyo xano, drupal five already died a long time ago!