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.
When using the default 'Main menu' menu, and outputting that on the sitemap, the title, or menu name, isn't translated. There's is no way to change this title either (at least not that I can find). Adding t() around $menu['title'] isn't really good, since that could be a user defined string, but this needs a solution for core defined menus (Main menu, Navigation and User menu)
Comment | File | Size | Author |
---|---|---|---|
#7 | 1092160-sitemap-menu-translation.patch | 916 bytes | andypost |
#6 | 1092160-sitemap-menu-translation.patch | 903 bytes | andypost |
#1 | sitemap-1092160-translatable-menu-titles.patch | 910 bytes | blackdog |
Comments
Comment #1
blackdog CreditAttribution: blackdog commentedHere's a patch that runs the three core defined menus titles through t().
Comment #2
andypostmarked as duplicate #1094496: missing t()
Comment #3
andypostmarked as duplicate #1094496: missing t()
Comment #4
feo CreditAttribution: feo commented+1 for this solution, nobrainer
Confirmation of the bug.
Patch tested, problem was resolved.
Comment #5
andypostThis approach is wrong - core should not translate user-entered strings. I think module should use the same as node/add
Comment #6
andypostCore translates menu names so we should use the same as menu_block_info
Also there's a i18n code already comited in #1343588: Show menu names translated
current patch uses standard core's translation for menu names but allows i18n to work first
Comment #7
andypostMenu title should be check_plain()'ed because render layer does not do this so this leads to security issue - user input could be printed directly
Currently without i18n module a menu title is printed directly, so this issue MUST be fixed.
Comment #8
darrell_ulm CreditAttribution: darrell_ulm commentedThis is fixed in the latest 7.x-1.x-dev release.