Populate fields on admin

How to add locales to the admin programatically?

I’m using the following code to add locales to my project(file 1).

Function loaded on bootstrap:

  async bootstrap({ strapi }: { strapi: Core.Strapi }) {
    await createMediaFolders(strapi);
    await addLocales(strapi);
  },

When running the first time it gives the following issue(file 2).

Despite of this, the locales are added, but it breaks the admin when browsing on settings section, see the video.

What’s better way to add locales to the admin programatically?

Thank you!

This topic has been created from a Discord post (1234375862288384010) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

Here are the browser errors:

Admin is broken after that migration and it is not working even after removing the locales.

Just to confirm; you are using the strapi 5 beta, right?
I can tell from the pretty error message you got in your browser.

And to answer your question; I highly recommend using Config-Sync for adding the locales programatically.
Using that you don’t have to think about how the programatic import functions, it just works.

that’s right!

does it work on Strapi ? :sweat_smile:

Not yet for Strapi 5 haha

But soon !!

it could be a good solution, let’s see <@211722558385553408> opinion.

@here I am not seeing any log error after adding those locales when I use the same function in Strapi v4!!!

Config Sync v2.0.0-beta.1 was released for Strapi 5

You could try that out Luis!

You already migrated it Boaz? Lol :sweat_smile:

With some help of Josh :star2:

Ahhh okay well I may want to setup a meeting with you to see what kind of troubles you had

Next week we are all in Spain but if you have some time after may 20th let me know

I could do a call May 22, if that suits your schedule

Have fun in Spain! :sun_with_face: