Strapi Create New Locale with EntityService

You can create with default id in array like below:

const translated = await translate(json.value,
                                                            {from: 'en', to: 'iw'});
const res= await strapi.entityService
                    .create("api::general-translation.general-translation",{
data: {
localizations:[defaultID],
key: json.key,
value: translated.text,
locale: 'he'
},
populate:{localizations:true}
})

You must add localizations true parameter in populate and also 

Yorumlar

Bu blogdaki popüler yayınlar