Part of the Entity ecosystem · 308 projects
This module provides a developer tool to programmatically change the default language of an entity. It offers a service that allows developers to update an entity's default language, with options to decide whether to update translations and specify which languages to target.
Entity Change Default Language changes the default (original) language of translatable content, for example a node created in English that should be Spanish. The translation in the new language becomes the original one, and the old default language can stay as a translation.
Key features
- A "Change default language" operation on content, with a confirmation form.
- Works on every translatable content entity type: nodes, taxonomy terms, blocks, users and more.
- Creates the new default translation when it is missing, so content with a single translation can be changed too.
- Chooses which translations to keep and whether the old default language stays.
- Paragraphs follow their host, and other reference fields follow on request.
- The whole change runs in one database transaction, rolled back on failure.
- Drush commands for one entity or a whole entity type, through a queue.
How it works
- User interface: users with the "Change the default language of content entities" permission, who may also edit the content, get a "Change default language" operation.
- Settings: at Configuration > Regional and language > Entity Change Default Language, exclude some entity types or allow only some. By default every translatable content entity type is enabled.
- Drush:
drush ecdl:cdl node 1 eschanges one entity now, anddrush ecdl:dlet node esqueues every entity of a type. - Service: code calls
\Drupal::service('entity_change_default_language')->update($entity, 'es'). - Queue: cron processes the queued items, tries a failed one up to 5 times in all and logs every skipped one.
Requirements
- Drupal 11.4 or later, or Drupal 12, and PHP 8.3 or later.
- Language and Content Translation, both in core.
- Drush 13 or later, only for the Drush commands.
Sites on Drupal 9, 10 or 11.0 to 11.3 can use the 1.0.x branch.
Documentation
Read the user documentation, with screenshots of every step, and the README.
Looking for Drupal support?
- Premium support from the project maintainers
- Get in touch with us
Ask your assistant about Entity Change Default Language
Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works
Depends on
Dependencies of the latest stable release
- content_translation Drupal core
- language Drupal core
Required by
Tracked projects that depend on this one
No tracked projects depend on this one yet.
More in the Entity ecosystem
Most installed first