I made a mistake during development of my Drupal 8 site. Some time ago I changed the default language (to german) - but I continued to create the configuration entities (like fields and so on) in english. Now I found out that this was not really smart - and I want to change the default language of all existing configuration entities. First of all I just tried to delete the german language - so Drupal 8 switches back to english as default. Now every new configuration entity (new field) is defined in english. That's fine. But every existing configuration entity shows "Unknown (de) (original)" as default language. And when I open it to save it again nothing changes. I took a look into the database considering to change it directly there - but unfortunately configuration is stored binary. Is there any other way to solve this problem? Thanks a lot for any help Jens


I changed the configuration directly in the MySQL table "config" (In my case table names has a prefix ("something_config") so change the example below if necessary).

The configuration values are in the column "data".

First I cast the content to a string.

Then I replace the definition of the wrong langcode. In my case I replace 's:8:"langcode";s:2:"de"' with 's:8:"langcode";s:2:"en"'.

In the end I cast the result of this replace operation back to binary and save it in "data".

These three steps can be managed in one single SQL statement:

UPDATE `config` SET data = cast(
    cast( data AS char ) , 's:8:"langcode";s:2:"de"', 's:8:"langcode";s:2:"en"'

Then clear the cache and you are done.


Export the full configuration in admin/config/development/configuration. You get the untranslated yaml files in the main folder. The translated yaml files are in languages/[languagecode].

The untranslated yaml files have the line

langcode: [languagecode]

You can change the language code in each yaml file and then import the full configuration back.

If you have translated text in the untranslated yaml files you can move this text to the translated yaml files in the language folder.

For a better workflow put the configuration in the sync folder (sites/default/files/config_HASH/sync) and import all in synchronize.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.