Configuration Language Lock
This module helps keep your Drupal site's configuration language consistent by enforcing a single, designated language for all configuration. It prevents multilingual drift by ensuring configuration is stored in your chosen language, regardless of import or request language, and provides a tool to fix any existing inconsistencies.
Configuration Language Lock takes a best effort to ensure that site configuration is stored in one explicitly chosen language, regardless of request language or source language of imported configuration. It also provides a settings page to update configuration that may have been created earlier in another language or somehow slipped through the protections of this module (e.g. with config sync where the enforcement is intentionally skipped).
This solves common multilingual drift problems where configuration can end up with mixed langcode values after UI edits, module/theme installs, config actions, or recipe application.
In multilingual sites, configuration may be created or updated in whatever language is current for the request, or in whatever language a config file was shipped with — even in invalid languages in case of recipes. Over time, this can produce inconsistent configuration language state.
This module provides a single lock language and takes a best effort to enforce it consistently across configuration writes and installs.
Features
After initial installation and when the locked language is unset, the module does not interfere with Drupal's config handling intentionally. This keeps existing behavior unchanged until an administrator explicitly selects a configuration language. Installing the module without configuring it should be safe and undoable.
When a valid lock language is configured, the module:
- enforces config entity
langcodeon save withhook_entity_presave - hides language selectors on core config entity forms where they would appear (menu, date format, vocabulary, and view)
- protects the lock language from deletion
- annotates the lock language in the language admin UI
- runs rewrite batches after module/theme installs
- normalizes recipe-imported config to the lock language
- optionally follows the site default language automatically when it changes
Post-Installation
Configure the locked language at admin/config/regional/config-language-lock. The page will inform you of the distribution of languages across your config and offer to unify them under one language, which is later kept enforced on a best effort basis. Optionally enable the follow site default language checkbox to have the lock and a full rewrite batch triggered automatically whenever the site default language is changed. If there are mismatches in configuration language you can come back here later and manually enforce consistency again.
Additional Requirements
The module optionally works with the Interface translation module. When that is enabled, the config langcode rewrite features of that module (on module and theme install) are disabled and a replacement is provided which is based on the lock language instead and can handle switching from one foreign language to another.
Similar projects
There is the Config Read-only mode module which protects all writes to your configuration and will naturally avoid diverging languages too. Configuration Language Lock, by contrast, just takes a best effort to enforce a consistent language and does not prohibit configuration changes in general.
You may also want to try Language Audit which surfaces a lot more details about configuration language divergence on your site. If the all-in-one update method in this module is not right for you, that would help you find language issues (and manually fix them using config export/import for example).
Community Documentation
The module has really extensive documentation about what it does and how it does it.
LLM disclosure
The development of the module was accelerated with LLM.
Depends on
Dependencies of the latest stable release
No dependencies recorded for this project.
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.