Closed (won't fix)
Project:
Internationalization
Version:
5.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
9 Jan 2007 at 19:57 UTC
Updated:
5 Nov 2009 at 18:37 UTC
Jump to comment: Most recent file
Comments
Comment #1
jose reyero commentedPatch looks ok. But can't we use the same 'translation_taxonomy_tids' for both taxonomy and taxonomy_menu ?
Comment #2
juanfe commentedI think i tried it, and ran into a problem with that approach because I have a nested taxonomy. You know the code much better than I do, but reconstructing why I ended up doing it this way, here's why.
Say the taxonomy tree looks like this:
so taxonomy_menu's urls when I'm looking at subterm 2 would be:
?q=en/taxonomy_menu/1/12
and the translated URL in portuguese would be
?q=pt/taxonomy_menu/3/18
This differs from the standard taxonomy/term/12 or taxonomy/term/1+12 URL structure that you'd see without taxonomy_menu. translation_taxonomy_tids assumes that $str_tids will be 12 or 1+12 or 1,12 or that. This means you'd have to change translation_taxonomy_tids to account for the nested structure of the taxonomy_menu URLs.
I was also not able to get it working.
I tried implementing your suggestion by adding
in translation_taxonomy_tids() and changing my code to
elseif (preg_match("/^(taxonomy_menu\/)(.*)$/",$url,$matches)) {
if ($str_tids = translation_taxonomy_tids($matches[2], $lang)) {
$url = "taxonomy_menu/$str_tids";
}
in translation_url() but I wasn't able to get the results -- when I look at my term_data table, my trids are '0's whereas when I look in i18n_node my trids are populated (which is why I'm using translation_node_nid() to translate the terms rather than translation_get_term_translations. I think this has to do with how I had to structure my categories to display properly using taxonomy_menu...
What I'll do is set this up in a standalone instance (separate from my current site) and validate this using only taxonomy_menu and i18n module with a simple category, and will let you know.
Regards,
Juan Felipe
Comment #3
pulpzebra commentedI don't know if the patch provided is for 4.7.x, but for sure it doesn't work for 5.x.
I had the same problem and following the hints from this patch I made the translation module work with taxonomy menu this way:
Modify the function translation_url this way:
Where $tids is the array that holds VOCABULARY_ID/TERM1_ID/TERM2_ID. $vid is the ID of Vocabulary that we have to strip off the chain of taxonomy terms.
2) Then, add the translation_taxonomy_menu_tids function
This function looks different than the one provided in the patch, since it uses the translation_term_tid rather than translation_node_nid function to translate the chain of terms.
I made it work in a simple environment with VOCABULARY/TERM (no nested taxonomy).
Could someone make further test about this and provide an official patch?
Thank you,
Paolo.
Comment #4
pulpzebra commentedErrata Corrige
In the first code chunk above I mentioned to put the changed code between STRONG tags... but...
Anyway the correct code is that:
Sorry guys...
Comment #5
ñull commentedI just post a back port of this code for version 4.7 here. Please apply it to that version too for others to enjoy. Works correctly with multilevel taxonomies.
For version 4.7 the same code is inserted in function translation_url as proposed by pulpzebra :
The function translation_taxonomy_menu_tids is different however. In 4.7 the function translation_taxonomy_tids doesn't seem to exist yet, so I just used translation_term_get_translations instead:
Sorry, but no time to create a patch now. I just attached the modified module.
Comment #6
gagarine commentedIn comment http://drupal.org/node/108070#comment-280343 I don't understant the preg_match...
Perhaps it's me but why the "^" operator (négation)? Whe search the "taxonomy_menu" chain... no?
I think this is more correct:
No?
Comment #7
Junesun commentedThank you, guys, you are my salvation! I needed a functioning multilingual menu for my site www.esperanto.info and the other solutions, e. g. translating menu items through string translation, just didn't cut it. I'm now using pulpzebra's solution in a nested taxonomy setting and it works great. Thanks so much! Could somebody add this to the next official release?
Now the only thing that I'd like to see with regard to taxonomies in the menu is that they automatically jump to the article if somebody clicks on a taxonomy menu item/category with only one article in it, while still listing every article if there are several. This would add to usability imho. Unfortunately even as a PHP programmer I'm utterly lost in Drupalese code, but I'm ready to pay $50 to whoever can implement this little extra, ideally as something you can switch on or off somewhere in the admin settings. If you're interested in taking on the task, contact me at yutian.mei@gmail.com .
Judith
Comment #8
pkej commentedI don't like to apply a patch without understanding what is happening. It seems to be something Judith likes, and probably I would like it as well, but please explain in different words what this patch is solving. (I haven't started making the translated menus yet, but I do know how the use strings for translation works).
Comment #9
summit commentedSubscribing,
greetings,
Martijn
Comment #10
nickysworld.net commentedI am too am trying to override the urls that taxonomy_menu produces and this thread was the closest thing I could find I'm sorry for the outdated response.
It changes forum urls such as
drupalSite.com/forum/17
with a 'category' url such as
drupalSite.com/1/2/17
I want to switch 'category' with 'forum' in the path and strip the 1/2/ so that the output matches the original url again.
Thank you for your insight.
Hello?
Aaaaaaaah!
Is anybody still here.
Comment #11
summit commentedHi,
I did exactly this! You can change category to forum on admin/settings/taxonomy_menu for taxonomy_menu.
You can strip the 1/2 with custom_url_rewrite in your settings.php.
Is this enough info to get you going?
greetings,
Martijn
Comment #12
jose reyero commentedOnly critical bug fixes for 5.x.