Dear !
I've found Taxonomy_Menu is not integrated with I18n, a multilanguage module. I've fixed some code in Taxonomy_Menu for the module to integrate with I18n. Please review.
I18n is here: http://drupal.org/project/i18n

Regards,
Oliver Huynh

Comments

serg.remote’s picture

thanks, seem to work fine for me!

serg.remote’s picture

Just noticed - 'expanded' options doesn't apply for other languages so we either need to display all items translations in menu settings (like it works for taxonomy i18n) or apply 'expanded' option to translated terms automatically (I believe it can break things if translated taxonomy structure differs from original one).

Any chance to look at it?

Sisma_Net’s picture

Version: 6.x-1.x-dev » master
Component: Code » User interface
Assigned: oliver huynh » Unassigned
Category: feature » support

Hi,
I have this problem: installed taxonomy menu, configured, but when I change language by Language Switch block, taxonomy menu doesn't update.
To achieve this behaviour I HAVE to "Clear cache" from devel block.

For example, I have this:

Vocabulary
- Term 1 (english)
-- Term 1-1 (english)
- Term 1 (italian)
-- Term 1-1 (italian)
-- Term 1-2 (italian)

Correspondent terms are translated between languages. When I select Italian from language switcher, taxonomy menu still shows english terms (or vice versa).
I HAVE to clear cache to make taxonomy menu to reflect language switching, and so to make ONLY language specific terms to be visible.

Do I miss something?

Thanks for any help.

sylvaingirard’s picture

Patch seems to be working just fine.

Sisma_Net’s picture

Version: master » 6.x-2.x-dev

sylvaingirard wrote:

Patch seems to be working just fine.

I wrote:

Do I miss something?

Yes: my mistake when applying the patch.
Thanks, sylvaingirard.

indytechcook’s picture

Can you please write a patch that applies to the newest DEV? It is a total rewrite and the current patch no longer applies.

jonodunnett’s picture

Success! works for me too. Can these patches find their way into the current version please. Thanks for your work developing and tuning this module.

strndy’s picture

same problem as Sisma_Net - January 21, 2009 - 19:21

tomsm’s picture

Is there a version available that contains this patch, because I have no experience in patching modules.
How do I apply a patch? Do I need a special program for this?

indytechcook’s picture

Status: Needs review » Patch (to be ported)

This patch was written against the previous version. Taxonomy Menu has been totally reprogrammed and the patch no longer applies. I need it ported to the latest version and I will be part of the release.

rondev’s picture

Version: 6.x-2.x-dev » 6.x-1.02
StatusFileSize
new14.21 KB

This is the 6.x.1.02 release patched with the codes published by oliverhuynh - October 3, 2008 - 12:47 for people interested in.

I didn't find the sources for an automatic patch to work then I patched manually as I do most of the time, finding the -lines and replacing by the +lines.

Seems to work at the moment.

Edit: I have to do a refresh in "Translate Interface" sometimes. Else some terms, not all, change language.

tomsm’s picture

Version: 6.x-2.x-dev » 6.x-1.02

When will this patch be ported and included in 6.x-2.x?
Now I have created 3 menus (one for each languages), but switching between languages does not work.
The only solution is one menu with terms translated into three languages. So I need this patch in 2.x. Thanks!

indytechcook’s picture

I added t() are the menu link title (sorry that I missed that in the first version) I'm not sure if this will resolve this issue. Please test and let me know. Look for the DEV version after today.

rondev’s picture

Version: 6.x-1.02 » 6.x-2.x-dev

I added t() are the menu link title

i just downloaded the today 2.x-dev commit #184322 and tested on my test site.
I have localized terms.
That changed nothing for me. All terms keep untranslated.

I like this improved module.

tomsm’s picture

Version: 6.x-1.02 » 6.x-2.x-dev

I have also installed the latest 6.x-2.x-dev of March 17.
I have 3 languages: English, French and Dutch.
I use per language terms as translation mode for my vocabulary.
Every term is translated in French and Dutch.

The menu shows all terms in all languages.
Normally, only terms that correspond to the chosen language should appear.

Nothing changed, the problem remains.

indytechcook’s picture

Status: Patch (to be ported) » Active

Thanks for the testing. I"ll dig a little deeper.

indytechcook’s picture

Ok. Attempt number 2. The main issue is that taxonomy menu doesn't handle the displaying of the menu, only saving the menu links. I'm not sure if I should be changing the taxonomy part of the code or the menu part of the code. In this version I changed the code that pulls the term id for the current language. I'm not sure if this will work. It's more to rule it out.

I do apologize as this is my first time coding with i18n.

tomsm’s picture

This version (of March 18) does not work. The menu is totally messed up and is not useable.
So you can rule it out, I think.

indytechcook’s picture

Thanks. I'll roll back that change and go into a different direction. I appreciate the patience.

indytechcook’s picture

Ok. Attempt number...

This time I looked through the i18nmenu code and saw that it alters the menu links as they are being saved. So I'm looking up the language for the term and placing it on the $link array as it's being passed to menu_link_save.

Please give this version a try. The DEV should be release in a few hours (overnight for me).

tomsm’s picture

Hi, I have tested the new DEV of March 19.

The problem remains: all terms are shown for every language. I use English (default), Dutch and French.

When I go to Site Building >> Menu I noticed following things when I edit the terms:
1. Terms (in English = default language) that are not yet translated in the taxonomy are set to: "All languages".
2. For already translated terms: English terms are set to Dutch, Dutch ones to French and French ones to Dutch.

When I set the language manually in this edit dialogue and save it, the menu items are correctly displayed according to the selected language.

I hope this information helps...

indytechcook’s picture

Thanks for testing. I'll keep digging. I thought I had it there.

rondev’s picture

I use i18n menu differently from tomsm.
To be more precise I use "Localize terms. Terms are common for all languages, but their name and description may be localized.". Default language "English" for locale.

Nothing translated.

Thank you for your work.

jonodunnett’s picture

subscribing. (I also use i18n with "Localize terms. Terms are common for all languages...").

PaV@drupal.ru’s picture

StatusFileSize
new146.6 KB

I'm posted in http://drupal.org/node/405742 and setting status "duplicate" :(

in new version i have same problem, see attach

vocab "Город" & "Мероприятия" should not show (curent language = esperanto)

indytechcook’s picture

There is still no resolution to this issue yet. The newest version does not have a fix.

rondev’s picture

Tested DEV of March 23.
I use "Localize terms. Terms are common for all languages, but their name and description may be localized.". Default language "English" for locale.

I have good links for taxonomy terms, but terms name remain untranslated
http://www.example.com/en/taxonomy/term/46 (term name: Apple - Default language)
http://www.example.com/es/taxonomy/term/46 (term name unchanged: Apple instead of Manzana)
http://www.example.com/fr/taxonomy/term/46 (term name unchanged: Apple instead of Pomme)

indytechcook’s picture

I need some help with this. Form what I can see it should work. I would be very grateful if someone would submit a patch.

tomsm’s picture

I have tested version 6.x-2.2 and the menu is totally messed up. Also the latest DEV of March 25 appears to have the same effect.
Many terms are children of various other terms etc. Really strange behaviour.

After reinstalling the DEV of March 23 the menu is useable again. All terms are set to "All languages" in the menu settings. When I edit a term in taxonomy it is reset to "All languages". I hope someone finds a patch fixing this i18nmenu setting. Thanks!

indytechcook’s picture

Ok. I compared the two versions and made the dev the same. Now it's back to square one to figure out how to get the correct menu items to display.

I do apologize for the issues, i18n is very new to me.

Neil

Cito’s picture

Similar to others I use taxonomy with "Localize terms. Terms are common for all languages, but their name and description may be localized." It is very convenient to maintain the translations with the "Translation table" module if you do it like that.

You will notice that the "Translation table" module has two separate translation tables for taxonomies and menus. In fact, these translations are kept apart with the "textgroup" field in the table "locales_source". If that field is set to "taxonomy", then it's a translation for a taxonomy term, if it is set to "menu", then it's a translation for a menu item.

When Drupal displays the menu, it looks up the translation for the textgroup "menu", not for "taxonomy". That's why the translations do not work for taxonomy terms in menus.

So what "Taxonomy menu" actually should do, but fails to do so far, is duplicate the entries with textgroup "taxonomy" to corresponding entries with textgroup "menu" whenever it creates a menu (and remove these entries when the menu is removed).

indytechcook’s picture

Thanks Cito. That's the piece I was missing.

niQo’s picture

StatusFileSize
new2.44 KB

Here is a try of implementation for term localization and taxonomy_menu.
This patch use directly terms translations on the menu (translation from textgroup 'taxonomy'), it doesn't duplicate strings in textgroup 'menu'.
So translations string are not in double and you don't need to add and maintain menu translations.

It may have side effects for others vocabulary multilingual options and need to be tested.

indytechcook’s picture

Status: Active » Needs review

Awesome niQo! Thanks! I'll do some basic testing but others, please give me test with various situations and I'll be very happy to commit this.

jonodunnett’s picture

Version: 6.x-2.x-dev » 6.x-2.3

NiQo's patch from #33 works (nice one!!) but has a small problem if the option "Item for Vocabulary" is checked.

When this is selected the vocabulary name item appears empty (same for all languages including default). All pages also show this error:

Menu and taxonomy name mismatch : TheNameOfYourVocabulary!=

Hopefully this detail is easy to sort out (let me know if more information about the problem would be useful).

rondev’s picture

Nothing to add more than jonowindsurf except "Item for Vocabulary"
Just to say it seems to work for me.

indytechcook’s picture

Status: Needs review » Needs work

The issue only seems to occur if i18nmenu and item for vocabulary is active.

strndy’s picture

Version: 6.x-2.3 » 6.x-2.x-dev

It works for me too! Gread job. Thanks.

There are two problems:

1) Display Number of Nodes

gives me

Menu and taxonomy name mismatch : English term (14)!=English term
Menu and taxonomy name mismatch : english term 2 (8)!=english term 2
Menu and taxonomy name mismatch : English term 3 (9)!=English term 3
and etc...

I don't thts possible, to fix easily. I suggest to give note, next to select box, that this doest'n work with translation of taxonomy.

2) Item for Vocabulary

Menu and taxonomy name mismatch : Vocabulary english name!=

Custom Path works fine.
thx again

indytechcook’s picture

I've done some research and here is my theory. These messages are occurring because there is no translation match for strings.

Display number of nodes because the title is actually a mix of words and numbers. I don't know of a way to fix this.

Item for Vocabulary because it doesn't seem that i18n creates a translation for the vocabulary. I don't know if you can manually add translations strings but you might try that.

jonodunnett’s picture

Have been looking through the database tables and it does appear that translations for vocabulary names ARE there (I also seem to remember translating the strings). I am not very familiar with how translation works but there do also appear to be entries in the "i18n_strings" table and corresponding entries in the "locales_source" and "locales_target" tables.

More on the error messages I get, initially I only noticed the first but there is another one...

1. "Menu and taxonomy name mismatch : NameOfVocabulary!=" (this on all pages).

2. "warning: preg_match() expects parameter 2 to be string, array given in C:\wamp\www\drupal\includes\bootstrap.inc on line 771." (this in addition to the previous error but only on pages/nodes that are part of a (any) taxonomy).

In both cases I only get the message if "Item for vocabulary" is checked. No errors if unchecked.

vlooivlerke’s picture

It Works!!

I did a slow, step by step install in English, Afrikaans, Zulu, Xhosa and Seshuto and it works with:

Taxonomy translation enabled
menu translation enabled
and translation_table.module, (very nice string translation interface for taxonomy and menus)

Doing the following will cause the: NameOfVocabulary!= mismatch

Changing the term of a node when you translate it. It would be better if the Taxonomy selector on translated nodes was grayed out.

Thanks, great great module.

P.S. The title of the Term, shown on the top of Taxonomy pages does not translate. Code in the page.tmp file is responsable for the printing of those titels. <?php if (!empty($title)): ?><h1 class="title"><?php print $title; ?></h1><?php endif; ?>

tomsm’s picture

I have set the translation setting of my vocabulary to "Localize terms".
Then I have translated the English terms with the translation table module.
The English menu items are sorted alphabetically.
When I change the language the terms are not sorted alphabetically. How can I fix this?
Thanks!

tomsm’s picture

I have noticed that when items have the same weight they are ordered alphabetically.

So I have tried to set the weight of all menu items to 0, but the translation does not work anymore.
Does taxonomy module need different weight settings in order to work properly?

Maybe, it would be nice if there was an option to disable weights in taxonomy menu so that items are always ordered alphabetically in every used language....

tomsm’s picture

I have found a workaround.
After setting all menu items to weight 0, I have translated all menu items with translation table and the menu works ok.
I have noticed that when I change the weight of a menu item it loses its translation link within the taxonomy.

Glowingtree’s picture

Should the patch listed in comment 33 be applied to the current DEV version? or to the current 6x2.3 version?

indytechcook’s picture

It has already been applied to the DEV version.

Glowingtree’s picture

Ok, I changed to the latest DEV version. Nothings different. I still have no clue how to have a Taxonomy Menu in 2 languages!! The Vocab is set to Localized terms, I translate the individual terms in the i18n Interface Translation. That doesn't really do anything for the menu. The menu items that Taxonomy Menu generates in the menu don't show up in the Translation Search, i cant translate them, I'm stuck!!!

This is for a vocabulary that will categorize blog posts by year/month for a click-able archive menu, so I was hoping that only one term needs to be picked, so someone translating content doesn't have to REPICK an additional french equivalent term when creating the node in the other language. I.E one term for the post, synced to the fr version so when hit the lang switcher, and you get the translated Menu-item/taxonomy term.

What am I doing wrong, what was this DEV patch for exactly.

Jeremy

tomsm’s picture

The translation works fine for me. I have English as default language + French and Dutch.
I also use localized terms. I have translated the terms with translation table.
Are your menu item settings correct? Language must be set to "All languages".

aimevp’s picture

Hi Glowingtree,

I don't know if this will help you but I have found a "not so elegant" workaround to the problem. It helps me further while waiting on a solution on the "Menu and taxonomy name mismatch"-problem. I too needed a taxonomy menu, with translations of terms and this is how I got it working "for now":

  • I made my taxonomy vocabulary "localized terms" with no language selected. I inputted my terms in English.
  • I placed all my terms under one "uber" parent term (which has the name of the button I need in my main menu => this because I need those terms as a submenu of my main menu)
  • I installed the translation_table module. In there you can very easely find your terms back and translate them in the different languages. Don't forget to translate the "uber" parent term also.
  • I setup my view in preparation for my taxonomy_menu (Term ID with Depth + Term ID depth modifier + path on the page display with "pathname/%" and all the other settings I need)
  • I install the taxonomy_menu module (6.x-2.3 with the patch from #33 integrated)
  • I go back to my taxonomy voc settings and select the menu I need my term menu in. menu path type I choose custom path and in the field "Base path for custom field" I put the "pathname" I inserted in my view wtihout "/%" at the end. No trailing slash in other words.
  • Normally I would select "item for vocabulary" but that gives me the "mismatch error" so I leave it unselected. With my uber parent term I still get the same disired result.

and voila... a multilanguage taxonomy menu...

As I said before not as clean as I would have wanted to with uber parent and so but it get's the job done...

Btw, great work with this module guy's.

There is only one thing I think is missing besides a solution on this problem of mismatched names. It would be great if you were able to select a menu-item instead of a full menu. That way it's much easier to place the tax_menu as a submenu without losing menu consistency. Because I know you can easely put this in a seperate menu and only show it on sertain page's but then you loose you're active state of you're main menu... Same thing for the breadcrumb. Unless there's another workaround???

Glowingtree’s picture

Hatznie, I basically have a similar setup, a main term (2009) which has sub-terms (Jan, Feb, Mar).

The only difference is that I created the taxonomy menu with regular version, then switched to DEV version. Should I have re-built the menu again? Also will the translated terms show up as translated menu items in the Taxonomy Menu when i switch to the other language? BTW I also applied the DHTML menu capability to my Taxonomy menu as well, i hope that isn't interfering with anything.

I will re-create and see what happens..

Glowingtree’s picture

re-created menu, works fine now.. that was the problem, no re-creation of menu after updating to dev vesion with patch applied

Glowingtree’s picture

ok, all the translated terms and menu items seem to be there for both languages. At least for my initial test post I tagged with the category "May" (shows up as Mai on fr side) But there is still a problem.

I get this mis-match error if go back to edit the translation of the node.

BTW The only options i have selected are "Syncronise changes to this Vocabulary" and "Hide Empty Terms"

how do i avoid this?

Glowingtree’s picture

my current issue probably has something to do with comment 41

Doing the following will cause the: NameOfVocabulary!= mismatch

Changing the term of a node when you translate it. It would be better if the Taxonomy selector on translated nodes was grayed out.

Also, I notice when creating a node the drop down list appears fine with my taxonomy-menu vocabulary.
However when I hit the langauge switcher, so that the interface is in French, and try to create a french node, the list is empty. But I can switch back to english, and just choose to create the post in French via the lang selection in the node-add form, the taxonomy term drop down filled again. So this is dictating the way content is added on a multi lang site.. ) :

I have other non taxonomy-menu linked free-tag terms I need to be able to tag the nodes with as well. May be tricky for me to get around mismatch issue as stated above.

ckng’s picture

StatusFileSize
new3.52 KB

This is an update to patch #33 against 6.x-2.3, which includes fixes to

- mismatch problem, including 'Display Number of Nodes' & 'Item for Vocabulary'
- blank vocabulary title for 'Item for Vocabulary'
- dynamic adding the number of nodes if enabled, the (COUNT) part is not part of translation

ckng’s picture

Status: Needs work » Needs review
rapsli’s picture

subscribing

dddave’s picture

Category: support » task

Is this problem also relevant if "Per language terms" is the setting for the vocabulary? Read through this issue but I am not sure?

asak’s picture

dddave: I'm trying to use this module with "Per language terms" but not having much success. it seems to work fine with the patch in #54 to localized terms - but i can't get the menu to properly display the correct menu links for every language with per language terms.

Has anyone had any success with this...?

UPDATE: I just went over this entire thread (again..).
After some more testings, it does seem to work quite well with localized terms.

I'm thinking: The only way for this to work with "Per language terms" vocabularies is to have Taxonomy Menu save the language of the term while adding/updating the menu item, as i18menu enables when activated. When using "per language terms" we have the language set at the taxonomy level (if we've set one) - but taxonomy menu does not pass this info to the menu system, and as such no language is set when saved as menu item.

So... I found this in taxonomy_menu.module, line 480:

//FIXME: i18nmenu need to be cleaned up to allow translation from other menu module
  if (module_exists('i18nmenu')) {
    $link['options']['alter'] = TRUE;
  }

I'm afraid i'm not exactly sure what this means, but i do think this is what we're looking for. I was thinking that adding a language in the arrays which are passed around would be sufficient - but no i have doubts. This may be more of an issue with i18nmenu then with taxonomy_menu.

Thought anyone?

asak’s picture

Ok...

I've added the following test code in taxonomy_module.module, in the latest -DEV version, in line 480:

//FIXME: i18nmenu need to be cleaned up to allow translation from other menu module
  if (module_exists('i18nmenu')) {
    $link['language'] = 'he';
    $link['options']['alter'] = TRUE;
  }

This successfully sets the language of the menu item after a rebuild to Hebrew.
The weird thing is - All menu items still show for all languages!
Even if i manually edit and save them - they still show.
If i use taxonomy_module without this change menu item are set with no language. If i then manually set the language of the items, they work as expected and only display when viewing the language which they are set to. This is strange.

dddave’s picture

Hi asak,

glad someone capabable has interest in it as I am definetly not the guy to digg into code. If you come up with a patch I am enthusiastic to test it.

Of course I experience the same problems as you with "Terms per language".

asak’s picture

Not sure that "capable" is the correct word here... ;)

After some more testing i found that i was partly wrong.
When manually setting the language of menu items, after taxonomy_menu creates them with no language set, does not function correctly.
That's odd.

I'll keep messing with this- but would sure appreciate some help here ;)

dddave’s picture

Lol - I should really be more careful during previewing.

As I said I have no clue about coding but I can test patches. So I can only hope that someone can give you a hand or some clarifying insight.

asak’s picture

StatusFileSize
new3.45 KB
new955 bytes

Getting closer:

I found a thread about i18nmenu: #253498: i18nmenu doesn't work with module-defined menu items. , and this comment with a patch: http://drupal.org/node/253498#comment-829150
The patch seems to be for a version other then 6.x-1.0 of i18n, which i'm using, but i was able to make the changes as such (starting line 39 of i18nmenu.module) and messed around with it until - I think i got it working! ;)

I'm attaching 2 patches - one for i18nmenu.module (1.2.2.11) the other for taxonomy_menu.module (1.19.2.2.2.36).

This is FAR FROM PERFECT and needs more work - but it works for me.

I tried it using the "Rebuild menu on submit" and tried manually adding a term to the system - both cases update the menu correctly.

i18n gurus - please have a look at this... not sure it's the correct way but could be a good start.

taran2l’s picture

Subscribing

asak’s picture

I must add - the patches in #63 disable to usage of localized terms, and only works for "Per language terms". it should all go into a big if {} or something... but that beyond my current experience...

Freso’s picture

Status: Needs review » Needs work

Well, first of all: All that commented-out code ought to be removed. It's rather cumbersome to tell what code has been added, when it's buried beneath heaps of "disabled" code.

ckng’s picture

Working patch for "Localize terms" is at #54.

@asak / #64
If you are working on "Per language terms", please provide a clean patch rather than patch on top of other patches, we can't see your code nor what you are trying to do.

dddave’s picture

Title: Integrate with I18n » Integrate with I18n (I) - "Localize terms"

I hope it is ok that I opened #498786: Integrate with i18n (II) - Solution for "Per language terms".
I think one task per issue is enough. ;) It tends to get messy when multiple patches about different problems are discussed in one issue.

So @asak
Please post the improved patches at the new issue.

thekayra’s picture

Is there anyone testing patch #54?

Let's concentrate only on "Localise Terms" in this thread @dddave kindly opened another issue.

thekayra’s picture

OK I have done some testing myself.

I still have the "Menu and taxonomy name mismatch" problem. Even though it does not really affect the way the website is working, it still makes taxonomy menu unusuable in a multilingual environment.

The translations in the translate interface are all fine, however I can't make the taxonomy menu to use these. If I rebuil the menu after having name mismatch problem, the problem goes away, until I create a new content. Maybe creating language neutral items are causing the problem. will check that as well.

At some point I have been able to make the menu translate itself according to the language selected. However, when I started to have "name mismatch" problems and I tweaked a little the settings in taxonomy and taxonomy menu, I can't this to work again. I am going to uninstall taxonomy menu completely and reinstall to double check the issue.

mailking’s picture

subscribing

indytechcook’s picture

I'm adding the patch on #54 to the next beta release.

indytechcook’s picture

Status: Needs work » Needs review

change status

indytechcook’s picture

#54 Added to 2.4-beta1.

rondev’s picture

#316632-70: Integrate with I18n (I) - "Localize terms":

The translations in the translate interface are all fine, however I can't make the taxonomy menu to use these. If I rebuil the menu after having name mismatch problem, the problem goes away, until I create a new content. Maybe creating language neutral items are causing the problem. will check that as well.

Same for me.

thekayra’s picture

Sorry folks was not in UK for some time. Here I am back again.

@indytechcook: I was already using the the patch in #54. And still have the same problems.

Is anybody working on this issue or taxonomy menu is still unsuable in multilingual environment? Will try to solve it myself at some point but I am more keen on the layout of the site than the functionality issues at the moment. so it might take upto a month for me to start coding for Drupal (which will be the first attempt for me unfortunately).

Miteto’s picture

"Menu and taxonomy name mismatch" problem appeared for me when I added images to terms using "Taxonomy Image" module.

PS: It's not related whether the new content is language neutral, english or any other language.

workonwomen’s picture

subscribe

giorgosk’s picture

I am using 2.4-beta1 and as described in #74 patch is included in that version

I got the "Menu and taxonomy name mismatch" Warnings after adding some translations
Cleaning cache, and rebuilding the taxonomy menu did not work
but,
disabling and reenabling the menu for the vocabulary and all the Warnings went away

I have added a new term in vocabulary and translations and everything works fine ...

EDIT: spoke too soon

a little while later one Warning reappeared, disabled and enabled vocabulary again
and ALL warnings reappeared ...

if it makes any difference the menus appear to be working correct i18n-wise
but the warnings are annoying ...

jvieille’s picture

Same problem

indytechcook’s picture

Added Comment from #619898: Update to beta3: menu items are not translated anymore - multilingual settings: localize terms

I have a site with 3 languages: English (default), Dutch and French.

When I update from 6.x-2.4-beta1 to beta3 and rebuild the menu, my menu items are not translated anymore. Whatever interface language I select, they remain in English.

My taxonomy multilingual settings are "Localize terms. Terms are common for all languages, but their name and description may be localized."

When I rebuild the menu with 6.x-2.4-beta1 there is no problem.

Other module information:
Drupal core: 6.14
Internationalization 6.x-1.x-dev (2009-Oct-20)

mcsolas’s picture

Subscribing. Seem to have run into this issue.

vnb’s picture

Subscribing

rogerpfaff’s picture

subscribing

gmreed’s picture

subscribing

jvieille’s picture

It seems we are back to square one with beta3.
The menu translation does not work anymore, and we get a lot of warnings as a premium.
This is very anoying, Taxonomy menu is not usable at all now.

indytechcook’s picture

The only major change was adding batchapi to create the menu. I added an option to make the use of batchapi optional. Please the latest dev should be available within 12 hours. Please test when it is.

rogerpfaff’s picture

Hi there,

could this be the same issue like #364254: Doesn't work when vocabulary Translation mode is set to "Localize terms"?

Also if you route the created menu through the nice menu code the menu is translated.

jvieille’s picture

I am trying the last dev.

Taxonomy multilingual settings are "Localize terms. Terms are common for all languages, but their name and description may be localized."

- Taxonomy menu shows translated terms only if the menu option "Auto expand menu items" is not set.
(by the way, this option doesn't do anything for me)
- Taxonomy menu ignores vocabulary name translation

I found a bug in Drupal Core that does handles string translation in a single namespace.
for example, I have a taxonomy term "Home" that is translated in French by "Maison"
There is a string "Home" that identifies the site landing page which is translated in French by "Accueil"
That triggers a Locale module error and prevents the taxonomy menu to build correctly.

Thanks for the significant progresses
JV

indytechcook’s picture

The Auto Expand option just sets the "expanded" option for the menu link to TRUE. Shouldn't really effect anything else.

I need an opinion if this is ready for the next stable release with the warning that the vocab translation doesn't exist due an issue with Drupal Core.

tomsm’s picture

Beta 1 worked perfectly, Beta 4 does not. So I think that the current Beta 4 is not ready for the next stable release.

What did I do:
1. I installed beta 4, rebuild the menu, and the translation of the menu is broken: I always get English terms.
2. I reinstalled beta 1, rebuild the menu, and the translation is OK again.

PS: With installation I mean replacing the taxonomy_menu folder in the sites/all/modules folder.

See also my post #81.

jvieille’s picture

After more checks:

- There is no bug in Core, the issue is still confined in Taxonomy menu:
When several strings in different groups (vocabulary term, menus/blocks, interface...) are identical, Taxonomy menu generates an error if that string is one of the menu item it tries to create.
It seems that TM searches for the translation based on the string only, not the particlar group/vocuabulary it is part of. If the query gets more than one translation, it breaks.

- The Vocabularyname translation is not processed at all - not related to the previous issue, just a missing feature

Thanks

looks for the string transaltions regardless they are in the specific

, ora term is identical striung that another string

jvieille’s picture

If this bug is too difficult to address or sucks too much resource (I think that vocabulary translation support is more important), the documentation can mention something like that:

"Due to a known issue, individual terms that are defined more than once in the entire site context (vocuabularies, interface) trigger an error then generating menus holding these items.
To overcome this issue, such problematic term shall be renamed so it does not conflict with any other string.
The translations themselves can be set at will, so there is no impact on the displayed items."

indytechcook’s picture

@tomsm: Check the newest release: http://drupal.org/node/651232

jvieille’s picture

Works like a charm for me. The string bug is fixed.
(Note that the menu settings are lost on upgrade)

However, the vocabulary name is still untranslated

Thank you so much for the nice work

tomsn, are you still suffering any other issue?

tomsm’s picture

I have tested the latest releases 6.x-2.4-rc1 (2009-Dec-04) and 6.x-2.x-dev (2009-Dec-05), but still the same issue as I described at #91:
taxonomy terms are not translated anymore.

I have these taxonomy menu settings:
- menu path type: custom path
- Base path for custom path: taxonomy/products

I use a customized "taxonomy term" view, that comes with the views module.

indytechcook’s picture

Alright guys.

What is this check for?

if ($item['title'] != ($term->name . $display_num)) {
  // Should not happen
  drupal_set_message(t('Menu and taxonomy name mismatch: @title != @name', array('@title' => $item['title'], '@name' => $term->name . $display_num)), 'error');
}

It just displays a message. It's probably better as a watchdog or not att all. It seems to be causing havoc #652772: "Menu and taxonomy name mismatch" error with Taxonomy access control.

Any objection?

indytechcook’s picture

StatusFileSize
new999 bytes

Here is a patch to change the drupal_set_message to a watchdog. You can apply it against 2.4-rc1

jvieille’s picture

This seems to work for me
Thanks!

klonos’s picture

subscribing

indytechcook’s picture

I need some more input. jvieille says everything is working and tomsm is saying it isn't. Others? This code (minus the patch in comment 98) is part of 2.4-rc1 (http://drupal.org/node/651232)

rondev’s picture

Doesn't work for me on my test site even after rebuilding the menu.
Taxonomy Menu 6.x-2.4-rc1 + patch
Internationalization 6.x-1.2 and refresh the strings

The terms are not sorted.

sinasquax’s picture

Why don't you use title callback / arguments with the menu items generated ?

It make the possibility to create title (menu item's name) dynamically (for the number of terms in a vocabulary) and possibly avoid the problem with i18n.

Sorry for my bad english

indytechcook’s picture

@sinasquax, could you please elaborate?

Here is the main piece of code that creates the $link array that is sent to menu_link_save(). We don't use hook_menu. There is no need to since taxonomy_menu doesn't not control the page callback.

$link  = array(
  'link_title' => t($item['name']),
  'menu_name' => $item['menu_name'],
  'plid' => $plid,
  'options' => array('attributes' => array('title' => t(trim($item['description']) ? $item['description'] : $item['name']))),
  'weight' => $weight,
  'module' => 'taxonomy_menu',
  'expanded' => variable_get('taxonomy_menu_expanded_'. $item['vid'], TRUE),
  'link_path' => $path,
);
tomsm’s picture

I just tested the latest releases 6.x-2.x-dev and rc2, the problem I described at #96 still remains:
taxonomy terms appear untranslated when I change my interface language, they remain in English (= my default language)

These are my settings:

Menu location:
Menu path type: Custom path
Custom path for vocabulary: category
Use vocabulary path as base path: unchecked
Base path for custom path: taxonomy/products
Synchronise changes to this vocabulary: checked

(other options are unchecked)

I use a modified "taxonomy_term" view.

tomsm’s picture

Just installed and tested the latest version 6.x-2.5:
When I rebuild the menu with the interface language = English, the terms are in English and do not change when I switch languages.
When I rebuild the menu when I am using another interface language, French or Dutch, the menu items appear in that language but do not change when I switch interface languages.

I do not have this problem with 2.4-beta1.

nchase’s picture

I'm using 6.x.2.5 and the handling of i18n terms is not working. Whenever I create a node in one language everythings fine, as soon as I save the translation a new menu item containg the translated term is saved within the original language. Means I have a mixed menu of original and translated terms.

klavs’s picture

I have this issue with 6.x-2.5 as well :(

i'm using "localize term" option btw.

I see you are using 'name' => t($term->name),
'description' => t($term->description),
in function _taxonomy_menu_create_item

but appearently that's not where the menu items are coming from when shown on the page?

indytechcook’s picture

Version: 6.x-2.x-dev » 6.x-2.5
Status: Needs review » Needs work

klavs, this is where it gets difficlut for me. I save the menu items, but the core menu system (or block or other contrib module) displays them. Nothing has changed in the translate function between 2.3 and 2.5 so I'm not exactly sure what the issue is.

tomsm’s picture

Version: 6.x-2.5 » 6.x-2.7

I tested 6.x-2.7, issue remains...

klavs’s picture

I looked up how menus and i18n works in d6 - and it seems you shouldn't call t() at all.

See: http://drupal.org/node/140311

It seems the menu should just be saved in its standard language - and then drupal applies t() when the menu is rendered.

Does this make any sense?

I tried to remove the t() around the title where I could find it - but's still not translated - even though my other menus (with manually added links) are translated just fine :(

klavs’s picture

I got it working - I don't know if I've done it the right way though.

I've removed all calls to t() on link_title etc. and in function taxonomy_menu_translated_menu_link_alter I modified this line:
$item['title'] = tt('taxonomy:term:'. $term->tid .':name', $term->name) . $display_num;

to
$item['link_title'] = tt('taxonomy:term:'. $term->tid .':name', $term->name) . $display_num;

AFAIK this menu alter function shouldn't even be necessary as I understand the menu system - but for some reason it is, and atleast it works this way :)

indytechcook’s picture

@klavs, that's great. Can you create a patch? http://drupal.org/patch

Once you upload the path, go ahead and set the status to "needs reviews"

Cheers,
Neil

klavs’s picture

Status: Needs work » Needs review
StatusFileSize
new1.85 KB

Patch done - I just figured the change was so small it wasn't worth a patch :)

klavs’s picture

This patch also fixed a problem I was seeing, where I had hits on translation search on the "$taxonomy_name (@count)" - I had 16 if there was 16 nodes in a taxonomy - one for (1), (2) etc.

indytechcook’s picture

Thanks klavs, I'll commit later, I'm at Drupalcon at this moment.

indytechcook’s picture

tomsm’s picture

I have tested the lastest dev, and I confirm that the patch of klavs works. Great job! Thanks!

Note: When I updated the module, the translations were gone, but after a rebuild of the menu everything is ok.

But I have noticed that the patch has a problem when I use the DHTML menu module.
When I open a parent term, the child terms are not translated. When I select one of these child terms, all child terms do appear translated.

I did not have this problem with my previous version 6.x-2.4-beta1.

klavs’s picture

@tomsm:
I have a guess at what could fix that.
around line 999 - where it says:
$item['link_title'] = tt('taxonomy:term:'. $term->tid .':name', $term->name) . $display_num;

Add a line below it that says:

$item['title'] = tt('taxonomy:term:'. $term->tid .':name', $term->name) . $display_num;

See if that doesn't fix it for dmenu.

tomsm’s picture

@ klavs:

Thanks, that fixed the problem !

rondev’s picture

@ klavs:
Tested taxonomy_menu 6.x-2.x-dev April 21, 2010 - 01:17
It works without error now.
But the translated terms are not sorted.

I still use Taxonomy Menu 6.x-2.4-beta1 on production site.

klavs’s picture

Since taxonomy_menu does not handle the viewing/rendering of the menu (it just fills the menu in the standard menu system) - it has nothing to with sorting of the items.

I can see the menu system doesn't sort them - even though all menupoints have a weight of "-50" in my menu. AFAIk it should sort all of same weight, alphabeticly.

perhaps a bug in the menu system?

klavs’s picture

The sorting issue is a seperate issue - and should have a seperate issue created for it.

I found that the menu system only sorts alphabeticly - if items have a weight of 0 (just by googleing - so no guarantees :)

This module pr. default - inserts items in the order they have in the taxonomy - and this stays - even when translated.

If you want it to sort alphabeticly - you could do this:
In function _taxonomy_menu_save:
Line ~497 - make sure it looks like this instead (comment out 3 lines and insert the weight = 0;)
//$weight = variable_get('taxonomy_menu_weight', 0);
//$weight++;
//variable_set('taxonomy_menu_weight', $weight);
$weight = 0;

This should IMHO be setup as an option in the taxonomy_menu with a name like "sort alphabeticly - instead of according to taxonomy sort" - and then it could just check for that in the mentioned function.

tomsm’s picture

It would indeed be a great option to sort the items alphabetically, also the translated menus.
I can sort the English (source) terms, but the translated terms just take in the place of the English ones, and are not sorted alphabetically.

So it would be great that the menu is sorted alphabetically, for every language.

klavs’s picture

@tomsm: then create an issue for it - it increases the chances of the maintainer seeing the issue.

Also - perhaps you could implement it and create a patch - there's already options - so you'd just be adding an extra - it's one of the easiest things to do - and this way you'd contribute to the module, and learn something in the process ;)

tomsm’s picture

Is it possible to commit the fix for DHTML menu (#119 of this issue) in the next dev release? Thank you.

indytechcook’s picture

Status: Needs review » Fixed

@tomsm, @klavs 's fix has been committed.

tomsm’s picture

Tested the latest dev of 2 May. Translation works, also with DHTML menu. Thanks!

rondev’s picture

Version: 6.x-2.7 » 6.x-2.x-dev

Tested OK.
Now sorting is good.

I just have this error in log:
"mb_strlen() expects parameter 1 to be string, array given in /homez.32/calfacha/www/includes/unicode.inc on line 404."
I don't know if it is related.

tomsm’s picture

@klavs

I created an issue for the alphabetical sorting of translated terms problem: http://drupal.org/node/790906

Thanks for your help

Status: Fixed » Closed (fixed)

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

sistro’s picture

Hi, I got the same problems as above.

I've tried Taxonomy Blocok: http://drupal.org/project/taxonomy_block
It work fine, it shows correctly the translated term, while with taxonomy menu I can see only default term.

Please look at its code and try to find a definitive solution for taxonomy menu!

jvieille’s picture

still getting tons of "Menu and taxonomy name mismatch"...
Any hope to get rid of them?

jvieille’s picture

Status: Closed (fixed) » Active

Still active

chaugi’s picture

StatusFileSize
new14.96 KB

In case I have option "Display number of items" lead to result that original (default) language show everything fine, but in translated language node count is not shown

bartezz’s picture

How does this work? Downloaded and installed the latest dev, rebuild the taxonomy menu but nothing gets translated?
Please help... deadline is closing fast!

Cheers

mandreato’s picture

Subscribe

bartezz’s picture

Ok, back to 6.x-2.9 and it works now.
Remember to; /admin/build/translate/refresh

Small note tho, altho my menu items are translated the menu item descriptions haven't been translated so on mouse hovers they show the original ALT/Title text...

Cheers

hedac’s picture

I'm having the mismatch issue... only when using "display number of items"
and also have the issue that chaugi mentions. item numbers are only displayed in default language. In other languages, terms are translated, but no (number)

Mr P’s picture

Re. #129. Yep. See http://drupal.org/node/1020504. Seem to get this after 6.x.2.3...

jvieille’s picture

wiped comment

castawaybcn’s picture

StatusFileSize
new17.46 KB
new17.49 KB
new33.69 KB

My experience so far with 6.x-2.9 and the following options enabled: custom path, use term name, sync changes, auto expand menu items & display descendants. (screenshot 1)

- Menu items are properly translated
- Custom path is not translated. This makes sense as it is not (and I think it actually should be) a multilingual variable. I have tried to add it to settings.php but did not succeed.
- Titles and destination vocabulary are not translated (screenshots 2 & 3). Instead, term for the site language is being used (Catalan in my case).

Please tell me if I could supply any further details or test a patch. This is a wonderful module, and it would be great if it could be used on a multilingual site.

calculus’s picture

Subscribe

shaneonabike’s picture

I'm having some luck with this on multi language site using 6.x-2.9

castawaybcn’s picture

Could you care to elaborate? ;)

hles’s picture

There will be work on i18n integration in the 7.x-2.x branch.
Ref.: #1665308: [i18n] Integrate Taxonomy Menu with i18n_menu and entity_translation.

dstol’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

The Drupal 6 version is no longer supported