Hi,

Thank you for this great module.

I am wandering if it supports i18n Translated Terms ? Which are very important for me.

I have translated terms that I use for content taxo, but I do not see the translation either on view or edit.

What did I wrong ?

Thank you

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mh86’s picture

which widget type are you using?

chipway’s picture

Checkboxes/radio

mh86’s picture

ok.
I have never worked with translated terms until now. For loading the terms I'm using the taxonomy_get_tree function.
Do you know how translations are working with the core taxonomy fields?

chipway’s picture

I know that it should work, because I did a little modification to Taxonomy List.module to get my translated terms displayed, and I just modified 3 lines by adding t() arround some values (see http://drupal.org/node/297064 and comments at the top of the file).

But, as I am not a great developper, I do not know if it is the right way to do it.

Thank you

GN’s picture

It's an interesting question for me, too, since I cannot display translated taxonomy terms in dropdown selection lists of exposed filters in views (see i18n issue at http://drupal.org/node/295315 that has not yet been responded to), while translated labels for cck field values are displayed as they should be, and I wonder if it makes any sense to try building my views on Content taxonomy fields instead of taxonomy terms.

mh86’s picture

I was taking a short look into the i18ntaxonomy module, they are generating the translated option like following:

$choice->option = array($term->tid => str_repeat('-', $term->depth) . tt("taxonomy:term:$term->tid:name", $term->name));

Maybe we can include this in the content_taxonomy_allowed_values function, making a check if (module_exists('i18ntaxonomy')) .... .
But this still leaves the question how we handle autocompletes and tree widgets

mh86’s picture

@GN: if we get this working, translation of exposed filters should work too

chipway’s picture

Hi,

I have a remark about what I changed in Taxonomy List.module to have translated terms displayed :

With what I did on Taxonomy List.module, I have 2 terms to translate (for every term in my Taxonomy), like this :
1) Taxonomy Men's Polos
term:780:name

2) Built-in interface Men's Polos
.../taxonomy/vocabulary/1

- It may an advantage : I can change the translation depending on where I display the term)
- or a drawback : I have allways 2 translations to do.

chipway’s picture

Status: Active » Needs review
FileSize
3.97 KB

Hi,

I got a working translation for Content Taxonomy (on d6 dev of august 29) :

I changed the following lines like this :

line 194 : return t(check_plain($term->name)); = 00000000000
line 202 : return l(t($term->name), taxonomy_term_path($term), array('rel' => 'tag', 'title' => t($term->description))); = 00000000000
line 236 : $value = t($term->name);
line 233 : $value = str_repeat(' - ', $term->depth) . t($term->name);
line 319 : $terms[] = t(check_plain($term->name));
line 331 : $tokens['vocab'] = isset($vocabulary) ? t($vocabulary->name) : '';

Now content taxos are tranlated. We have to do a new translation for the new path , but we don't need to translate term taxo name.

Here is attached the module updated, because I don't konw how to do a patch file :

May somebody test it on its own ?
Could you test also content taxo translation in taxo trees ?

Thank you

chipway’s picture

Hi,

I still have a problem with order of translated terms : they are in the english order.

Thanks

David Lesieur’s picture

Title: Does Content Taxonomy support i18n Translated Terms ? » i18n support in Content Taxonomy
Status: Needs review » Needs work

@cwdrup: t() is not meant to be used for translating user data. As mh86 has pointed out in #6, i18n's tt() function must be used as in i18ntaxonomy.module. Also, when proposing changes, please try to provide proper patches as that will help others to review the changes.

I have just marked the following issues as duplicates:
#168908: Support of multilanguage taxonomy (i18n)
#194012: Integration with i18n/translation requires changes in content_taxonomy (a patch submitted there was for D5)
#280504: no translations of taxonomies in multilingual site
#322021: Exposing Content Taxonomy + i18n (suggests some changes using tt())
#384510: content_taxonomy and i18n

David Lesieur’s picture

Status: Needs work » Needs review
FileSize
3.73 KB

Here's a patch.

Some caveats:

  • This patchs supports the i18n's Localize terms translation mode. It does not support the Per language terms mode, which would probably complicate things a bit (because terms in distinct languages then get distinct term ids).
  • Terms are still sorted in their original language's order (because the sorting is performed by the Taxonomy module (at the SQL level), before the localization functions are called).
  • The Checkboxes/Radios and Select List widgets support localized terms, but the Autocomplete widget does not (note that the i18n module itself does not yet localize terms with the autocomplete of free-tagging vocabularies).
janusman’s picture

Needed this for 5.x-1.x-DEV; this is a patch for that; also depends on i18n_taxonomy module.

** NOTE THAT THIS IS FOR 5.x-dev version, and NOT for v6.x! ***

mh86’s picture

patch looks good :) would be great if some people who uses i18n and content taxonomy find some time to test this patch

DjebbZ’s picture

Hello guys !

I have a problem with i18n and Content Taxonomy.

I'm creating articles about travels, with this structure : Continent description -> Country description -> Destination teaser -> Destination. So I'm using 2 vocabularies for the continent and the countries, one for the "main category", one for the "sub category". My purpose is to insert taxonomy terms in some content, so I can create link to another taxonomy term. Example : In my content "continent", I show a description of the continent, and I want to link it the taxonomy/term page of the countries of this continent, instead of the full view of this continent. Said another way, my article "North America" is tagged with "continent", so it will show when I click the menu item continent, and "North America", so it will provide a link to taxonomy/term/, thus showing USA, Canada etc.

So I used Content taxonomy to distinguish where is this continent (term "continent") and where it should lead (term "country"). And thanks to Content Templates module, I can retrieve the latter value to create the link to the countries in this particular continent.

It works fine, but the vocabularies just don't show up in another language (Chinese in my case) when I create/edit content, and I'm sure it's not related to the language... So I (tried) to use the patch in #12 (thank you David Lesieur), but they still don't show up...

Did I patch correctly ? I just added the lines as shown in the patch into content_taxonomy.module file.
Do you see another workaround ? I really need my articles to display a link to another taxonomy/term page, and didn't find any other solution by my own. Even by using views, but I'm far from mastering it, as well as taxonomy system and Drupal in general...

David Lesieur’s picture

@DjebbZ: Are your Continent and Countries vocabularies using the Localize terms translation mode? The Per language terms mode is not supported by that patch.

DjebbZ’s picture

Yes they are. Even in this translation mode, it didn't work...
So my solution was no to use Content Taxonomy module, but instead to include one Taxonomy for category, and one CCK Link field (Link module), with the user typing it. Not as user friendly as wanted, but it works, so...
Thanks for the fast reply ! And Keep up the good work on this however great module ! I'm sure it will be greater when drupal will definetly properly handle multilingual content.

David Lesieur’s picture

That's strange... The patch in #12 is now in production use on a site, and has worked great for them so far.
Other people willing to test?

chaloalvarezj’s picture

Hi,
Thank you for the patch! This patch does what I was trying to say on http://drupal.org/node/322021#comment-1226324 . I have manually patched the recent dev version and everything is working perfectly!

@DjebbZ Try refreshing and updating your translations in: admin/build/translate/refresh (Don't forget to select taxonomy in the text groups).

DjebbZ’s picture

I had done this too, thanks for your attention. Already implemented my solution in production, but I'll be waiting for a stable release which integrates the patch to make use of the module again if necessary. Thank you all !

chipway’s picture

Hi David,

i tried to use tt() function. What i get is no more data is displayed !!

May be i forgot some thing.

Any idea about it ?

Thanks

joostvdl’s picture

Patch from #12 works perfectly.

David Lesieur’s picture

Status: Needs review » Reviewed & tested by the community

As the author of the patch, it may be inappropriate for me to mark the issue as RTBC, but so far there were 3 positive reviews...
The patch still applies (with offset).

castawaybcn’s picture

Patch from #12 works great for me too. Thanks!!

chipway’s picture

Hi,

Could you apply the patch to Dev version as it seems ok for me too ?

Thank you

David Lesieur’s picture

The patch was tested with the dev version (branch DRUPAL-6--1).

joostvdl’s picture

When wil this patch applied to the DEV release?

mh86’s picture

Status: Reviewed & tested by the community » Fixed

patch from #12 committed
thanks to everyone helping in writing and testing the patch

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

khorpyakov’s picture

FileSize
9.23 KB

This is a straight-forward solution for using localizable vocabularies with autocomplete widget. Terms are entered in current user's language. Note that solution has serious performance penalties (since we need to translate each term in array) and does not support multiple tags yet.

bibo’s picture

This fix is apparently not included in the last releases?
6.x-1.0-rc2 / 2009-Aug-19
6.x-1.x-dev / 2009-Sep-13

Also, what about the tree-widget? http://drupal.org/node/545366

Multilingual taxonomoes are really essential, at least for me, hope this gets fast to the releases.

zualas’s picture

#30 patch seems to be creating duplicate terms in localizable dictionaries...

zualas’s picture

Status: Closed (fixed) » Needs review

I am not a developer, so I cannot produce a fix, but I have found the error in the patch at #30, it lies in line 187:

if (($mode == I18N_TAXONOMY_LOCALIZE) and ($language->language != $vocabulary->language)) 

The second part of the evaluation if ($language->language != $vocabulary->language) will always return False when the default language is switched on, because Drupal does not set a language to a taxonomy term if it is written in default language.

To work around the issue, i had to change the condition to a really long one:

    if (($mode == I18N_TAXONOMY_LOCALIZE) and (($language->language != language_default('language')) or (($vocabulary->language != NULL) and ($language->language != $vocabulary->language))))

This works for me.

mitsuroseba’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Issue summary: View changes
FileSize
1.62 KB

Init patch for support i18n_taxonomy.