This module allows you to provide different URLs for external links in your Drupal menus based on the language of the menu item. It replaces the standard link and title fields with language-specific versions when enabled for a translated menu item, eliminating the need for separate menus for each language.
The "link" field for menu items is not translatable - this is fine for internal links since Drupal knows which version to reference automatically.
This can be a problem for external links, as there might be a need to provide a different URL based on the link language.
This module creates a "Provide Translated External Link" option in the menu link form for translated items.
When enabled, it replaces the Link and Title fields with versions that are language specific.
The current recommendation is to create language specific menus. This module eliminates the need for that.
Currently, the revised links get added in a preprocess hook.
Requirements
No special requirements. Requires menu_link_content from Drupal core.
Install
Install module via composer or via standard Drupal module install practices.
composer require drupal/multilingual_menu_urls
Enable via Drush:
drush en multilingual_menu_urls
Usage
- Install and enable module.
- Make Custom menu link translatable (admin/config/regional/content-language).
- Exclude "Provide Translated External Link" & "Translated Link" from being translated.
- Add menu link to a menu for default language and set external link.
- Translate menu link for another language and you should see "Provide Translated External Link" checkbox.
- Check the box and provide the translated information as needed.
- Save menu item.
- Test out menu links in the translated languages.
Ask your assistant about Multilingual Menu URLs
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- menu_link_content Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.