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.
A normal menu item has a language field attached to it. Can the same be done for a container?
Comments
Comment #1
rokr CreditAttribution: rokr commented+1
Container names should be translatable.
Nice module!
Comment #2
JohnAlbinHi Martinus and Ronald!
Containers are actually just standard menu links with these special traits:
To drupal's menu system containers and menu items are the same thing. So containers should be translatable just like menu items.
Are you having specific problems getting containers translated? (please tell me what.) Or are you just asking if they can be translated? (answer: I think so.)
Comment #3
JohnAlbinComment #4
lolandese CreditAttribution: lolandese commentedHi John,
A multilingual menu can be setup in multiple ways. I might use the "wrong" method to create my multilingual menus. I normally make a menu item in let's say English, "about us", and another one in German, "über uns". Done by assigning a language when creating a menu item. It seems the same method can't be used with a menu item container. The language field doesn't exist as with a normal menu item.
You write "containers should be translatable just like menu items". Menu items are wrapped up in the t() function to be translatable, if I'm not mistaken. That doesn't seem to be the case for containers. When I search the text I've put inside a container, "about us", through the translate interface (admin/build/translate/search), it says "No strings found for your search".
But even then, usualy the children (that are links) of a container point to different language versions (at least on a multilingual site they do). Then we need also seperate containers, but this makes them appear multiple times in the menu, because they show up on each language. So I would see "about us" next to "über uns".
I'm probably missing something or, like said before, simply use the "wrong" method to create my multilingual menus.
Thanks for your help.
Comment #5
JohnAlbinMartinus, I assure you that its me who doesn't know how to setup multilingual menus. As I've never done it!
I think I need to experience this for myself. Can you point to a tutorial or docs that say what modules I need to use to recreate your multi-lingual menus? Then I can debug a working example. Thanks!
Comment #6
lolandese CreditAttribution: lolandese commentedOk John,
Only making multilingual sites, I often forget that only 1 on 12 Drupal sites is multilingual. Most site builders never have to set it up. :)
Sit tight, here we go! There are more ways to create multilingual menus. I explain the most basic.
On a clean D6 install:
drush dl i18n menu_item_container
admin/build/modules
. Depends on: Internationalization, Menu, Block translation, String translation, Locale, Content translationadmin/settings/language/add
admin/build/menu-customize/primary-links/add
admin/build/menu-customize/primary-links/container-add
You'll see on the container form that the language field is not there.
Comment #7
JohnAlbinOh, crap. I think that's because its a different form (obviously). And i18n module is altering the original "add menu item" form.
Hmm… I can work around that. Thanks for the info!
Comment #8
JohnAlbinOk. The module now re-uses the standard menu item edit form and just alters it for container-specific attributes.
That means any module that works by altering the standard menu item form will work automatically with containers as well. :-)
Fixed. http://drupal.org/cvs?commit=487394
Comment #9
lolandese CreditAttribution: lolandese commentedTested in a multilanguage site. Works now as expected. Great enhancement. Thanks a lot. Good work.
Comment #10
JohnAlbinYay!