Configuration Language Lock
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 (eg. 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 take a best effort to enforce it consistently across configuration writes and install.
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. This means 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 language admin UI
- runs rewrite batches after module/theme installs
- normalizes recipe-imported config to the lock language
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. If there are mismatches with language in configuration you can come back here later and manually enforce consistency again.
Additional Requirements
The module optionally works with Interface translation module. When that is enabled, the config langcode rewrite features of that (on module install) are disabled and a replacement is provided which is based on the lock language instead and can handle switching from foreign language to another foreign language.
Similar projects
There is the Config Read-only mode module which protects all writes to your configuration and will naturally avoid diverging the languages too of course. On the other hand Configuration Language Lock just does a best effort enforcement of a consistent language, and does not prohibit configuration changes in general.
Community Documentation
The module readme has more details about the implementation.