UNPKG

strapi-plugin-i18n

Version:

This plugin enables to create, to read and to update content in different languages, both from the Admin Panel and from the API

21 lines (16 loc) 558 B
const createLocalesOption = (localesToDisplay, localesFromData) => { return localesToDisplay.map(({ name, code }) => { const matchingLocaleInData = localesFromData.find(({ locale }) => locale === code); let status = 'did-not-create-locale'; if (matchingLocaleInData) { status = matchingLocaleInData.published_at === null ? 'draft' : 'published'; } return { id: matchingLocaleInData ? matchingLocaleInData.id : null, label: name, value: code, status, }; }); }; export default createLocalesOption;