Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). UI Patterns (SDC in Drupal UI) 2.0.18 Minor update available for module ui_patterns (2.0.18). Varbase FAQs 9.2.1 Minor update available for module varbase_faqs (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

This module enhances language handling for Drupal users by automatically saving their preferred language when they switch it, displaying language names in their native translations, and seamlessly transitioning users to their previously selected language upon login.

This module does three things differently from Drupal core:

  1. Automatically saves the user's preferred language when they switch languages.
  2. Displays language names in their native translations ("Español" instead of "Spanish"). What this means is visible in the picture to the right.
  3. Seamlessly transitions to the user's previously preferred language during login.

Recommended installation

  1. Download and install the module in your usual way (I suggest using Composer and Drush).
  2. Go to Detection and selection (/admin/config/regional/language/detection).
  3. Uncheck all plugins except this module's User account saver. Only if User account saver is the only enabled plugin we can be sure we manage the transition to the user's previously preferred language during their login.
  4. Make sure your users have a way of switching the language. If you haven't set up anything yet, you can visit the block list page (/admin/structure/block) and add Drupal Core's "Language switcher" block.

Inner workings

Technically speaking, this module just supplies a LanguageNegotiation plugin. It leaves the visual part of picking a language to other modules. A typical setup is to use Core's “Language switcher” block, optionally in conjunction with the Language Icons module. The picture above is from this setup.

This module acts in 3 situations:

  1. When the user opens a page, Drupal needs to know which language the page should be rendered in. If you are curious, see the getLangcode() function in the code.
  2. When the user just switched the language: save it in his or her account (processInbound()).
  3. When the language switcher block needs to know which languages exist (getLanguageSwitchLinks()).

Supporting this module

To say “thank you” or financially support development of this module, you can send a few Euros via PayPal: [email protected]

Activity

Total releases
1
First release
Apr 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Release date
8.x-1.8 Stable Apr 22, 2025