Dropdown Language Switcher
Provides a block with Drupal's Dropbutton element to switch site language, offering enhanced display options compared to the core Language Switcher Block.
dropdown_language
Install
composer require 'drupal/dropdown_language:^4.1'
composer require 'drupal/dropdown_language:^3.1'
Overview
The Dropdown Language module provides an enhanced language switcher block that uses Drupal's built-in Dropbutton UI element instead of a simple unordered list of links. This provides a more compact and user-friendly interface for multilingual websites.
The module offers flexible labeling options including language names, language IDs (codes), native language names, or fully customizable labels per block instance. It also includes SEO enhancements by optionally filtering out links to untranslated content, ensuring that language switcher links only point to actually available translations.
The block automatically hides when only one language is configured, and does not render on 403/404 error pages. The current language is displayed prominently at the top of the dropdown and marked as active without being a clickable link.
Features
- Language switcher block using Drupal's dropbutton element for compact display
- Multiple display options: Language Name, Language ID (code), Native Name, or Custom Labels
- Optional fieldset wrapper with 'Switch Language' title for visual grouping
- SEO enhancement: Filter untranslated content to only show links to available translations
- Option to keep block visible even when only one translation is available
- Automatic block hiding on 403/404 error pages
- Current language displayed at top with active styling and non-clickable
- Supports multiple language types: Interface Language and Content Language
- Per-block instance custom labels when Custom Labels mode is selected
- Integrates with Drupal's language negotiation system
Use Cases
Basic Multilingual Website
For a website with multiple languages where visitors need to switch between language versions. Place the Dropdown Language block in the header region and configure it to show language names. The compact dropdown format saves space while providing clear language selection.
SEO-Optimized Language Switcher
For websites where SEO is important and you want to avoid showing language links for untranslated content. Enable the 'Filter Untranslated' option to automatically hide language options that don't have actual translations, preventing search engines from indexing empty or fallback content pages.
Custom Language Labels for Branding
For websites that need specific language labels (e.g., showing flags with text, abbreviations, or custom terminology). Select 'Custom Labels' in global settings, then configure each block instance with the desired labels for each language.
Compact Language Code Display
For designs where space is limited and a compact representation is preferred. Select 'Language ID' display mode to show two-letter language codes (EN, DE, FR) instead of full language names.
Separate Interface and Content Language Switching
For advanced multilingual setups where interface language (menu, UI elements) and content language can be different. Place separate Dropdown Language blocks for each language type, allowing users to independently control interface and content languages.
Tips
- Place the block in a highly visible region like the header for easy access
- Use Native Name display for international audiences as visitors can identify their language more easily
- When using Custom Labels mode, create separate block instances per language and use Language visibility conditions to show the appropriate labels for each language
- The current language is automatically placed at the top of the dropdown and styled with an 'active-language' CSS class for custom styling
- Consider enabling the fieldset wrapper ('Switch Language' Decor) to make the language switcher more prominent and accessible
Technical Details
Admin Pages 1
/admin/config/regional/dropdown-language-switcher
Global configuration settings for all Dropdown Language Switcher blocks. Controls how language labels are displayed and visual presentation options.
Hooks 1
hook_help
Provides help text for the module on the admin help page
Troubleshooting 5
Ensure at least two languages are configured at Administration > Configuration > Regional and Language > Languages. The block automatically hides when only one language is available unless 'Keep block visible' option is enabled.
Navigate to Administration > Configuration > Regional and Language > Languages, click 'Edit' on your default language (e.g., English), check 'Enable interface translation to English', and save. Then use User interface translation to translate the string.
This is expected behavior - the module intentionally does not render the block on error pages (403 Forbidden and 404 Not Found) to avoid confusion and broken links.
Ensure 'Custom Labels' is selected in the global settings at /admin/config/regional/dropdown-language-switcher. Then edit each block instance to configure the custom labels for each language.
Enable 'Remove links if no translation is detected' in the global settings. Note this only works with Entity-based content (nodes, taxonomy terms, etc.) and requires proper translation configuration.
Security Notes 2
- The module requires 'administer site configuration' permission to access the settings page
- Translation access is checked before showing language links when filter_untranslated is enabled - users without view access to a translation won't see that language option