Contentful logo

Contentful Community

Change default locale for content export/import task

Dear all,

we would like to copy content from one space to a second using the contentful CLI space export/import tool.

The problem is, that the first space has two locales, with de-DE as default and en-US as secondary locale (all contents are managed german and english) and the second space has only en-US as locale.

In order to do the copy, both spaces need the same default locale. So I added de-DE as a second locale in the target space and made it default. The copy job then works fine.

However, after the copy I needed to remove the additional de-DE locale. This is not possible, though, because I can not switch the default locale back from de-DE to en-US. Changing the default locale merely “renames” the locale, meaning: the default locale has the name “en-US” after changing it, but it the fields still contain german text.

Anybody has a clue on how to effectively make another locale the default?

Thanks in advance
Eckhard

Hi @e_schneider the procedure to achieve what you need is the following:

  • Perform an export from the old space
  • Open the JSON using and editor and find the section ‘locales’. There you will have the list of locales. You will need to change the property ‘default’ from true to false for de-DE, and from false to true for en-US
  • Create a new empty space, with en-US as default locale and de-DE as the second locale
  • Perform the import of the updated JSON file to the new space. Note that en-US content for required fields should exist, otherwise the entries won’t be publishable.

Once everything is imported correctly, you can remove the de-DE locale and the new space will only the en-US as you need :slight_smile: