How to change the language code in multilingual website

Created on 19 March 2025, 18 days ago

Hi team

I have existing website with multilingual support. Drupal 10.3.9

The default language is English with language code en
I need to change the language code to en-us

I already have content associated with en, I want to update all of their language codes to en-us from en without my translations getting affected.

Regards
Divya

📌 Task
Status

Active

Version

10.3

Component

language system

Created by

🇮🇳India divya.lakshman

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @divya.lakshman
  • 🇮🇳India Ishani Patel

    Hello @diwya,
    You can export, modify, and import the language settings using Drush to change the language code:
    Steps-1: Export Language Configuration using the command below:
    - drush cex
    Step-2: Find the language.entity.en.yml file in the exported config directory and change:

                  TO :
                  <code>id: en-us
                  langcode: en-us

    Step 3: Import the Updated Configuration:
    - drush cim
    - drush cr

    Thank you!

Production build 0.71.5 2024