Drupal is a registered trademark of Dries Buytaert
Release: Leaflet 10.4.11 Minor update available for module leaflet (10.4.11). Release: Session Inspector 1.0.8 Minor update available for module session_inspector (1.0.8). Release: Migrate QA 2.0.4 Minor update available for module migrate_qa (2.0.4). Release: CKEditor Description List 3.0.0 Major update available for module ckeditor_descriptionlist (3.0.0). Release: FlowDrop 2.4.0 Minor update available for module flowdrop (2.4.0). Release: JWT Token Refresh 1.0.4 Minor update available for module jwt_token_refresh (1.0.4). Release: ConReg 1.0.0-beta1 First beta version released for module conreg (1.0.0-beta1). Release: AI Image Studio 1.0.0-beta8 New beta version released for module ai_image_studio (1.0.0-beta8). Usage Milestone: Role Theme Switcher Module role_theme_switcher crossed 1,000 active installs. Module Revived: Decoupled Router 2.0.7 Module decoupled_router updated after 11 months of inactivity (2.0.7).

This module enhances Drupal's language switching experience by replacing the default block with a modern button and modal dialog. It leverages native HTML dialog elements and Drupal core's HTMX integration for a performant, accessible, and modern interface, without relying on jQuery or other JavaScript frameworks.

A modern language switcher for Drupal that replaces the default language block with a trigger button + modal dialog pattern. Built on the native HTML <dialog> element and Drupal core's HTMX integration. No jQuery UI, no custom focus-trap libraries, no JavaScript frameworks.

How it works

The module places a block with a compact trigger button showing the current language. Clicking it opens a modal dialog that loads language switch links via HTMX. The dialog content is lazy-loaded as an HTML fragment: no JSON, no client-side rendering.

Key features

  • Native <dialog> with showModal(): built-in focus trapping, Escape key dismissal, and background inertness without custom JavaScript
  • HTMX-powered: uses Drupal 11.3's core/drupal.htmx library for server-rendered HTML fragment loading
  • Pluggable dialog content: a Drupal plugin system lets you swap out how language links are rendered, or create your own
  • No CSS by default: bring your own theme styles. An optional "classic dialog" CSS library is included for quick prototyping
  • Accessible: designed for WCAG 2.2 AA compliance out of the box. Proper focus management, ARIA attributes, hreflang/lang on links, CSS text-transform for uppercase, prefers-reduced-motion and forced-colors support

Included submodules

Language Switcher Dialog: Countries

Maps languages to countries and world regions. Adds country code, base language code, and region fields to each language configuration entity.

Ships two dialog content provider plugins:

  • Enhanced links: a flat list of language links enriched with country names and optional flag icons
  • Grouped by region: languages organized under region headings (Europe, Asia, etc.)

Also adds country-aware trigger button formats (e.g. "BE - NL", "Belgium - Dutch") and extends the trigger with optional flag icons.

Requires the Country module. Optionally integrates with Flags for country flag icons.

Language Switcher Dialog: GeoIP

Shows a one-time language suggestion popup for first-time visitors based on their IP-detected country. The popup is loaded via HTMX, uses a server-side cookie check to avoid repeat prompts, and includes configurable bot detection to skip search engine crawlers.

Requires the Countries submodule and Smart IP.

Language Switcher Dialog: disable_language support

Integrates with the disable_language module so disabled languages can be hidden from dialog-based language switching where appropriate.

Requirements

  • Drupal 11.3+ (for core HTMX support)
  • PHP 8.3+
  • Core Language module with two or more languages configured

Extending

The module is designed to be extended:

  • Dialog content provider plugins: drop a plugin class in Plugin/DialogContentProvider/ and it's auto-discovered in the settings form
  • Alter hooks: customize trigger button formats, world regions, GeoIP bot patterns, and dialog content
  • Template overrides: all templates follow standard Drupal theme suggestion patterns

See language_switcher_dialog.api.php for documented hook signatures.

🤖 Assisted Development

This module is maintained with the help of AI assistants for code generation, review, testing, and documentation. All code is carefully reviewed by the maintainers to ensure that quality and security standards are met.

Activity

Tracked releases
6
Tracked since
Apr 2026
Latest release
1 month ago
Releases (12 mo)
6 ▲ from 0
Maintenance
Active

Release Timeline

Releases

Version Type Release date
1.0.0-alpha5 Pre-release Jul 15, 2026
1.0.0-alpha4 Pre-release Jul 9, 2026
1.0.0-alpha3 Pre-release Jul 8, 2026
1.0.0-alpha2 Pre-release Jul 2, 2026
1.0.0-alpha1 Pre-release Apr 9, 2026
1.0.x-dev Dev Apr 9, 2026