Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
taxonomy_menu works like a charme. I've created Taxonomy projects with hierarchical structure and translated from german to english. For the setup, I've selected main-menu to put taxonomy_menu in. Just for the notes, I've used language detection by path "/" for german, "/en" for english.
In result, the taxonomy terms urls listed in menu will be in context, but the translation of the menu name is still in german.
thx for some hint...
Comment | File | Size | Author |
---|---|---|---|
#31 | 2630074-31.patch | 8.26 KB | pfrilling |
| |||
#28 | 2630074-28.patch | 1.74 KB | pfrilling |
| |||
#19 | 2630074-19.patch | 7.4 KB | martins.bertins |
#19 | interdiff-2630074-15-19.txt | 680 bytes | martins.bertins |
#15 | 2630074-15.patch | 7.36 KB | dawehner |
Comments
Comment #2
fragtom CreditAttribution: fragtom commentedComment #3
nerdsteinAdmittedly, I am not a translation expert. My suspicion is that we need to set the
langcode
attribute with the menu link definition, aligned with the taxonomy term's language.I am not sure of the steps to reproduce this, but I am submitting a patch that I believe will resolve this. @fragtom, can you submit steps for me to test (including configuring the translation settings) or can you test the patch?
Comment #4
killua99 CreditAttribution: killua99 commentedTo all this could we add a setting to control the view and only see items (on the menu) on the language you're looking for?
New issue for that?
Comment #5
bisonbleu CreditAttribution: bisonbleu commentedOk, thanks to @pbuyle and @nerdstein (Drupal North 2016 Sprint), here is a patch that fixes this issue.
Steps to test this patch (how to setup a multilingual taxonomy based menu).
admin/config/regional/language/detection,
use pathadmin/config/system/taxonomy_menu
and create a taxonomy menu e.g. AnimalsComment #6
XanoThe patch itself looks good based on a visual manual review!
I did find the following issues, but those are not touched by this patch. Ideally this patch will include a test, for which the issues below may need to be fixed in order to keep things simple and consistent.
This method MUST return a string to comply with the interface it implements.
This method MUST return a string to comply with the interface it implements.
Comment #7
dstolUpdating issue status based on Xano's review in #6
Comment #8
esclapes CreditAttribution: esclapes as a volunteer commentedI updated the patch to add tests and solve the concerns on #6.
I have also replaced the deprecated
EntityManager
for the more suitable alternatives.Edit: typo
Comment #10
esclapes CreditAttribution: esclapes as a volunteer commentedFix test fail because of missing
@group
and auto review of the following:$link
for$term
as done by bisonbleu in #5Comment #12
esclapes CreditAttribution: esclapes as a volunteer commentedSorry, the
@cover
change was not staged when I diffed the patch.Comment #13
eloivaque#12 m'ha funcionat. Works for me.
Comment #14
PhilYPatch #12 works well with Drupal 8.2.6 (at least for term name as I don't use description field).
Thanks
Comment #15
dawehnerI simplified the code a bit
Comment #16
dawehnerAs a test coverage it feels like having a kernel test would be better. The unit test just proves that the code works like the code looks like.
Comment #18
Utilvideo CreditAttribution: Utilvideo commented#15 not working, apply patch #12 work fine
Comment #19
martins.bertins CreditAttribution: martins.bertins at Wunder commentedFixed the error introduced by #15.
Comment #20
martins.bertins CreditAttribution: martins.bertins at Wunder commentedForgot to change status.
Comment #21
caw67 CreditAttribution: caw67 commentedalso here: modules works greta, but only without language! i cant edit the menu items and choose the language. and the module seems dont respect the language of my taxonomy terms
Comment #22
LauraRocksSorry I don't have more specific review, but I can confirm that we have a 8.3.2 site that had this problem, #19 fixed it for us and now the names are translated as well. Thank you!
Comment #23
mfrosch CreditAttribution: mfrosch as a volunteer commented#19 also works for me - thanks
Comment #24
gaurav.kapoor CreditAttribution: gaurav.kapoor at OpenSense Labs commented#19 Works fine.
1. I added a few taxonomy terms.
2. Enabled multilingual modules and provided translation for taxonomy terms.
3. Switched to language other than english.
And i could see all the menu items rendered in the different language.
Comment #25
Utilvideo CreditAttribution: Utilvideo commentedTested Work
Comment #26
tien_tia CreditAttribution: tien_tia as a volunteer commentedHi martin,
Applied patch in #19 and verified. It work.
Many thanks,
Comment #27
dstolThis needs a rebase against 8.x-3.x.
Comment #28
pfrillingI stepped through @martins.bertins patch from #19 and refactored the code a bit to hopefully make it more clean. My tests seem to be working properly.
Comment #29
gaurav.kapoor CreditAttribution: gaurav.kapoor at OpenSense Labs commentedSome coding standard issues , otherwise its good for RTBC. Changing to needs work.
Comment #30
dstolThe patch in #28 and the one in #19 seem to be wildly different. #28 also lacks the tests of #19.
Comment #31
pfrillingThe coding standard issues have been fixed. I also wrote a functional test to check the menu for the translated version of the taxonomy term. This was my first attempt at writing a test, so hopefully I did it right.
The code is definitely different than the original patch from #19. While rebasing, I noticed some deprecated function usage and I was trying to update those in the process.
Comment #32
LauraRocksI had to update to dev-version because of other fixes committed there, so patch #19 wasn't working anymore. Tried then patch #31 and it seems to do work fine.
Comment #34
dstolThanks for the contributions everyone!
Comment #36
eidoscomHi everyone, is the patch already in the 8.x-3.3 stable version? I have problems with translation and want to know before installing the dev version. Thanks!
Comment #37
maxplus CreditAttribution: maxplus commentedThanks,
working with current dev version indeed works as expected: menu items are shown in translated version
(patch #31 does not apply anymore to 8.x-3.3)
Thanks!