@strapi/i18n 0.0.0-next.7ff82e00c12aa44d99b20c7b95fe781a4b8d7435 → 0.0.0-next.807d2d1373c0c4b2c9c8a23debef0bf1b6af5fc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/components/BulkLocaleActionModal.js +262 -0
- package/dist/admin/components/BulkLocaleActionModal.js.map +1 -0
- package/dist/admin/components/BulkLocaleActionModal.mjs +260 -0
- package/dist/admin/components/BulkLocaleActionModal.mjs.map +1 -0
- package/dist/admin/components/CMHeaderActions.js +968 -0
- package/dist/admin/components/CMHeaderActions.js.map +1 -0
- package/dist/admin/components/CMHeaderActions.mjs +942 -0
- package/dist/admin/components/CMHeaderActions.mjs.map +1 -0
- package/dist/admin/components/CMListViewModalsAdditionalInformation.js +69 -0
- package/dist/admin/components/CMListViewModalsAdditionalInformation.js.map +1 -0
- package/dist/admin/components/CMListViewModalsAdditionalInformation.mjs +65 -0
- package/dist/admin/components/CMListViewModalsAdditionalInformation.mjs.map +1 -0
- package/dist/admin/components/CheckboxConfirmation.js +155 -0
- package/dist/admin/components/CheckboxConfirmation.js.map +1 -0
- package/dist/admin/components/CheckboxConfirmation.mjs +134 -0
- package/dist/admin/components/CheckboxConfirmation.mjs.map +1 -0
- package/dist/admin/components/CreateLocale.js +394 -0
- package/dist/admin/components/CreateLocale.js.map +1 -0
- package/dist/admin/components/CreateLocale.mjs +368 -0
- package/dist/admin/components/CreateLocale.mjs.map +1 -0
- package/dist/admin/components/DeleteLocale.js +90 -0
- package/dist/admin/components/DeleteLocale.js.map +1 -0
- package/dist/admin/components/DeleteLocale.mjs +69 -0
- package/dist/admin/components/DeleteLocale.mjs.map +1 -0
- package/dist/admin/components/EditLocale.js +212 -0
- package/dist/admin/components/EditLocale.js.map +1 -0
- package/dist/admin/components/EditLocale.mjs +190 -0
- package/dist/admin/components/EditLocale.mjs.map +1 -0
- package/dist/admin/components/LocaleListCell.js +102 -0
- package/dist/admin/components/LocaleListCell.js.map +1 -0
- package/dist/admin/components/LocaleListCell.mjs +100 -0
- package/dist/admin/components/LocaleListCell.mjs.map +1 -0
- package/dist/admin/components/LocalePicker.js +105 -0
- package/dist/admin/components/LocalePicker.js.map +1 -0
- package/dist/admin/components/LocalePicker.mjs +84 -0
- package/dist/admin/components/LocalePicker.mjs.map +1 -0
- package/dist/admin/components/LocaleTable.js +143 -0
- package/dist/admin/components/LocaleTable.js.map +1 -0
- package/dist/admin/components/LocaleTable.mjs +122 -0
- package/dist/admin/components/LocaleTable.mjs.map +1 -0
- package/dist/admin/constants.js +37 -0
- package/dist/admin/constants.js.map +1 -0
- package/dist/admin/constants.mjs +35 -0
- package/dist/admin/constants.mjs.map +1 -0
- package/dist/admin/contentManagerHooks/editView.js +109 -0
- package/dist/admin/contentManagerHooks/editView.js.map +1 -0
- package/dist/admin/contentManagerHooks/editView.mjs +88 -0
- package/dist/admin/contentManagerHooks/editView.mjs.map +1 -0
- package/dist/admin/contentManagerHooks/listView.js +44 -0
- package/dist/admin/contentManagerHooks/listView.js.map +1 -0
- package/dist/admin/contentManagerHooks/listView.mjs +42 -0
- package/dist/admin/contentManagerHooks/listView.mjs.map +1 -0
- package/dist/admin/contentReleasesHooks/releaseDetailsView.js +20 -0
- package/dist/admin/contentReleasesHooks/releaseDetailsView.js.map +1 -0
- package/dist/admin/contentReleasesHooks/releaseDetailsView.mjs +18 -0
- package/dist/admin/contentReleasesHooks/releaseDetailsView.mjs.map +1 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.js +110 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.js.map +1 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.mjs +89 -0
- package/dist/admin/hooks/useAILocalizationJobsPolling.mjs.map +1 -0
- package/dist/admin/hooks/useI18n.js +78 -0
- package/dist/admin/hooks/useI18n.js.map +1 -0
- package/dist/admin/hooks/useI18n.mjs +57 -0
- package/dist/admin/hooks/useI18n.mjs.map +1 -0
- package/dist/admin/index.js +226 -5
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs +202 -5
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/middlewares/extendCTBAttributeInitialData.js +71 -0
- package/dist/admin/middlewares/extendCTBAttributeInitialData.js.map +1 -0
- package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs +69 -0
- package/dist/admin/middlewares/extendCTBAttributeInitialData.mjs.map +1 -0
- package/dist/admin/middlewares/extendCTBInitialData.js +40 -0
- package/dist/admin/middlewares/extendCTBInitialData.js.map +1 -0
- package/dist/admin/middlewares/extendCTBInitialData.mjs +38 -0
- package/dist/admin/middlewares/extendCTBInitialData.mjs.map +1 -0
- package/dist/admin/middlewares/rbac-middleware.js +49 -0
- package/dist/admin/middlewares/rbac-middleware.js.map +1 -0
- package/dist/admin/middlewares/rbac-middleware.mjs +28 -0
- package/dist/admin/middlewares/rbac-middleware.mjs.map +1 -0
- package/dist/admin/pages/SettingsPage.js +182 -0
- package/dist/admin/pages/SettingsPage.js.map +1 -0
- package/dist/admin/pages/SettingsPage.mjs +179 -0
- package/dist/admin/pages/SettingsPage.mjs.map +1 -0
- package/dist/admin/pluginId.js +6 -0
- package/dist/admin/pluginId.js.map +1 -0
- package/dist/admin/pluginId.mjs +4 -0
- package/dist/admin/pluginId.mjs.map +1 -0
- package/dist/admin/services/aiLocalizationJobs.js +26 -0
- package/dist/admin/services/aiLocalizationJobs.js.map +1 -0
- package/dist/admin/services/aiLocalizationJobs.mjs +24 -0
- package/dist/admin/services/aiLocalizationJobs.mjs.map +1 -0
- package/dist/admin/services/api.js +15 -0
- package/dist/admin/services/api.js.map +1 -0
- package/dist/admin/services/api.mjs +13 -0
- package/dist/admin/services/api.mjs.map +1 -0
- package/dist/admin/services/locales.js +72 -0
- package/dist/admin/services/locales.js.map +1 -0
- package/dist/admin/services/locales.mjs +66 -0
- package/dist/admin/services/locales.mjs.map +1 -0
- package/dist/admin/services/relations.js +23 -0
- package/dist/admin/services/relations.js.map +1 -0
- package/dist/admin/services/relations.mjs +21 -0
- package/dist/admin/services/relations.mjs.map +1 -0
- package/dist/admin/services/settings.js +30 -0
- package/dist/admin/services/settings.js.map +1 -0
- package/dist/admin/services/settings.mjs +27 -0
- package/dist/admin/services/settings.mjs.map +1 -0
- package/dist/admin/src/components/CMHeaderActions.d.ts +18 -5
- package/dist/admin/src/components/LocaleListCell.d.ts +2 -1
- package/dist/admin/src/components/tests/CreateLocale.test.d.ts +1 -0
- package/dist/admin/src/components/tests/DeleteLocale.test.d.ts +1 -0
- package/dist/admin/src/components/tests/EditLocale.test.d.ts +1 -0
- package/dist/admin/src/components/tests/LocaleListCell.test.d.ts +1 -0
- package/dist/admin/src/contentReleasesHooks/releaseDetailsView.d.ts +1 -1
- package/dist/admin/src/hooks/useAILocalizationJobsPolling.d.ts +9 -0
- package/dist/admin/src/pages/tests/SettingsPage.test.d.ts +1 -0
- package/dist/admin/src/services/aiLocalizationJobs.d.ts +6 -0
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/locales.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +1 -1
- package/dist/admin/src/services/settings.d.ts +5 -0
- package/dist/admin/src/utils/schemas.d.ts +642 -16
- package/dist/admin/tests/server.d.ts +1 -0
- package/dist/admin/tests/utils.d.ts +6 -0
- package/dist/admin/translations/de.json.js +66 -0
- package/dist/admin/translations/de.json.js.map +1 -0
- package/dist/admin/translations/de.json.mjs +64 -0
- package/dist/admin/translations/de.json.mjs.map +1 -0
- package/dist/admin/translations/dk.json.js +66 -0
- package/dist/admin/translations/dk.json.js.map +1 -0
- package/dist/admin/translations/dk.json.mjs +64 -0
- package/dist/admin/translations/dk.json.mjs.map +1 -0
- package/dist/admin/translations/en.json.js +91 -0
- package/dist/admin/translations/en.json.js.map +1 -0
- package/dist/admin/translations/en.json.mjs +89 -0
- package/dist/admin/translations/en.json.mjs.map +1 -0
- package/dist/admin/translations/es.json.js +66 -0
- package/dist/admin/translations/es.json.js.map +1 -0
- package/dist/admin/translations/es.json.mjs +64 -0
- package/dist/admin/translations/es.json.mjs.map +1 -0
- package/dist/admin/translations/fr.json.js +66 -0
- package/dist/admin/translations/fr.json.js.map +1 -0
- package/dist/admin/translations/fr.json.mjs +64 -0
- package/dist/admin/translations/fr.json.mjs.map +1 -0
- package/dist/admin/translations/ko.json.js +65 -0
- package/dist/admin/translations/ko.json.js.map +1 -0
- package/dist/admin/translations/ko.json.mjs +63 -0
- package/dist/admin/translations/ko.json.mjs.map +1 -0
- package/dist/admin/translations/pl.json.js +66 -0
- package/dist/admin/translations/pl.json.js.map +1 -0
- package/dist/admin/translations/pl.json.mjs +64 -0
- package/dist/admin/translations/pl.json.mjs.map +1 -0
- package/dist/admin/translations/ru.json.js +68 -0
- package/dist/admin/translations/ru.json.js.map +1 -0
- package/dist/admin/translations/ru.json.mjs +66 -0
- package/dist/admin/translations/ru.json.mjs.map +1 -0
- package/dist/admin/translations/tr.json.js +66 -0
- package/dist/admin/translations/tr.json.js.map +1 -0
- package/dist/admin/translations/tr.json.mjs +64 -0
- package/dist/admin/translations/tr.json.mjs.map +1 -0
- package/dist/admin/translations/uk.json.js +82 -0
- package/dist/admin/translations/uk.json.js.map +1 -0
- package/dist/admin/translations/uk.json.mjs +80 -0
- package/dist/admin/translations/uk.json.mjs.map +1 -0
- package/dist/admin/translations/zh-Hans.json.js +57 -0
- package/dist/admin/translations/zh-Hans.json.js.map +1 -0
- package/dist/admin/translations/zh-Hans.json.mjs +55 -0
- package/dist/admin/translations/zh-Hans.json.mjs.map +1 -0
- package/dist/admin/translations/zh.json.js +66 -0
- package/dist/admin/translations/zh.json.js.map +1 -0
- package/dist/admin/translations/zh.json.mjs +64 -0
- package/dist/admin/translations/zh.json.mjs.map +1 -0
- package/dist/admin/utils/baseQuery.js +8 -0
- package/dist/admin/utils/baseQuery.js.map +1 -0
- package/dist/admin/utils/baseQuery.mjs +6 -0
- package/dist/admin/utils/baseQuery.mjs.map +1 -0
- package/dist/admin/utils/clean.js +70 -0
- package/dist/admin/utils/clean.js.map +1 -0
- package/dist/admin/utils/clean.mjs +68 -0
- package/dist/admin/utils/clean.mjs.map +1 -0
- package/dist/admin/utils/fields.js +34 -0
- package/dist/admin/utils/fields.js.map +1 -0
- package/dist/admin/utils/fields.mjs +31 -0
- package/dist/admin/utils/fields.mjs.map +1 -0
- package/dist/admin/utils/getTranslation.js +8 -0
- package/dist/admin/utils/getTranslation.js.map +1 -0
- package/dist/admin/utils/getTranslation.mjs +6 -0
- package/dist/admin/utils/getTranslation.mjs.map +1 -0
- package/dist/admin/utils/prefixPluginTranslations.js +11 -0
- package/dist/admin/utils/prefixPluginTranslations.js.map +1 -0
- package/dist/admin/utils/prefixPluginTranslations.mjs +9 -0
- package/dist/admin/utils/prefixPluginTranslations.mjs.map +1 -0
- package/dist/admin/utils/schemas.js +74 -0
- package/dist/admin/utils/schemas.js.map +1 -0
- package/dist/admin/utils/schemas.mjs +72 -0
- package/dist/admin/utils/schemas.mjs.map +1 -0
- package/dist/admin/utils/strings.js +6 -0
- package/dist/admin/utils/strings.js.map +1 -0
- package/dist/admin/utils/strings.mjs +4 -0
- package/dist/admin/utils/strings.mjs.map +1 -0
- package/dist/server/bootstrap.js +81 -0
- package/dist/server/bootstrap.js.map +1 -0
- package/dist/server/bootstrap.mjs +79 -0
- package/dist/server/bootstrap.mjs.map +1 -0
- package/dist/server/constants/index.js +29 -0
- package/dist/server/constants/index.js.map +1 -0
- package/dist/server/constants/index.mjs +25 -0
- package/dist/server/constants/index.mjs.map +1 -0
- package/dist/server/constants/iso-locales.json.js +2427 -0
- package/dist/server/constants/iso-locales.json.js.map +1 -0
- package/dist/server/constants/iso-locales.json.mjs +2425 -0
- package/dist/server/constants/iso-locales.json.mjs.map +1 -0
- package/dist/server/content-types/index.js +10 -0
- package/dist/server/content-types/index.js.map +1 -0
- package/dist/server/content-types/index.mjs +8 -0
- package/dist/server/content-types/index.mjs.map +1 -0
- package/dist/server/content-types/locale/index.js +10 -0
- package/dist/server/content-types/locale/index.js.map +1 -0
- package/dist/server/content-types/locale/index.mjs +8 -0
- package/dist/server/content-types/locale/index.mjs.map +1 -0
- package/dist/server/content-types/locale/schema.json.js +46 -0
- package/dist/server/content-types/locale/schema.json.js.map +1 -0
- package/dist/server/content-types/locale/schema.json.mjs +38 -0
- package/dist/server/content-types/locale/schema.json.mjs.map +1 -0
- package/dist/server/controllers/ai-localization-jobs.js +47 -0
- package/dist/server/controllers/ai-localization-jobs.js.map +1 -0
- package/dist/server/controllers/ai-localization-jobs.mjs +45 -0
- package/dist/server/controllers/ai-localization-jobs.mjs.map +1 -0
- package/dist/server/controllers/content-types.js +76 -0
- package/dist/server/controllers/content-types.js.map +1 -0
- package/dist/server/controllers/content-types.mjs +74 -0
- package/dist/server/controllers/content-types.mjs.map +1 -0
- package/dist/server/controllers/index.js +18 -0
- package/dist/server/controllers/index.js.map +1 -0
- package/dist/server/controllers/index.mjs +16 -0
- package/dist/server/controllers/index.mjs.map +1 -0
- package/dist/server/controllers/iso-locales.js +13 -0
- package/dist/server/controllers/iso-locales.js.map +1 -0
- package/dist/server/controllers/iso-locales.mjs +11 -0
- package/dist/server/controllers/iso-locales.mjs.map +1 -0
- package/dist/server/controllers/locales.js +108 -0
- package/dist/server/controllers/locales.js.map +1 -0
- package/dist/server/controllers/locales.mjs +87 -0
- package/dist/server/controllers/locales.mjs.map +1 -0
- package/dist/server/controllers/settings.js +24 -0
- package/dist/server/controllers/settings.js.map +1 -0
- package/dist/server/controllers/settings.mjs +22 -0
- package/dist/server/controllers/settings.mjs.map +1 -0
- package/dist/server/controllers/validate-locale-creation.js +47 -0
- package/dist/server/controllers/validate-locale-creation.js.map +1 -0
- package/dist/server/controllers/validate-locale-creation.mjs +45 -0
- package/dist/server/controllers/validate-locale-creation.mjs.map +1 -0
- package/dist/server/domain/locale.js +11 -0
- package/dist/server/domain/locale.js.map +1 -0
- package/dist/server/domain/locale.mjs +9 -0
- package/dist/server/domain/locale.mjs.map +1 -0
- package/dist/server/graphql.js +115 -0
- package/dist/server/graphql.js.map +1 -0
- package/dist/server/graphql.mjs +113 -0
- package/dist/server/graphql.mjs.map +1 -0
- package/dist/server/index.js +18 -3460
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +17 -3443
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/models/ai-localization-job.js +60 -0
- package/dist/server/models/ai-localization-job.js.map +1 -0
- package/dist/server/models/ai-localization-job.mjs +57 -0
- package/dist/server/models/ai-localization-job.mjs.map +1 -0
- package/dist/server/register.js +81 -0
- package/dist/server/register.js.map +1 -0
- package/dist/server/register.mjs +79 -0
- package/dist/server/register.mjs.map +1 -0
- package/dist/server/routes/admin.js +142 -0
- package/dist/server/routes/admin.js.map +1 -0
- package/dist/server/routes/admin.mjs +140 -0
- package/dist/server/routes/admin.mjs.map +1 -0
- package/dist/server/routes/content-api.js +19 -0
- package/dist/server/routes/content-api.js.map +1 -0
- package/dist/server/routes/content-api.mjs +17 -0
- package/dist/server/routes/content-api.mjs.map +1 -0
- package/dist/server/routes/index.js +12 -0
- package/dist/server/routes/index.js.map +1 -0
- package/dist/server/routes/index.mjs +10 -0
- package/dist/server/routes/index.mjs.map +1 -0
- package/dist/server/routes/validation/locale.js +57 -0
- package/dist/server/routes/validation/locale.js.map +1 -0
- package/dist/server/routes/validation/locale.mjs +36 -0
- package/dist/server/routes/validation/locale.mjs.map +1 -0
- package/dist/server/services/ai-localization-jobs.js +64 -0
- package/dist/server/services/ai-localization-jobs.js.map +1 -0
- package/dist/server/services/ai-localization-jobs.mjs +62 -0
- package/dist/server/services/ai-localization-jobs.mjs.map +1 -0
- package/dist/server/services/ai-localizations.js +268 -0
- package/dist/server/services/ai-localizations.js.map +1 -0
- package/dist/server/services/ai-localizations.mjs +266 -0
- package/dist/server/services/ai-localizations.mjs.map +1 -0
- package/dist/server/services/content-types.js +157 -0
- package/dist/server/services/content-types.js.map +1 -0
- package/dist/server/services/content-types.mjs +155 -0
- package/dist/server/services/content-types.mjs.map +1 -0
- package/dist/server/services/index.js +28 -0
- package/dist/server/services/index.js.map +1 -0
- package/dist/server/services/index.mjs +26 -0
- package/dist/server/services/index.mjs.map +1 -0
- package/dist/server/services/iso-locales.js +12 -0
- package/dist/server/services/iso-locales.js.map +1 -0
- package/dist/server/services/iso-locales.mjs +10 -0
- package/dist/server/services/iso-locales.mjs.map +1 -0
- package/dist/server/services/locales.js +114 -0
- package/dist/server/services/locales.js.map +1 -0
- package/dist/server/services/locales.mjs +112 -0
- package/dist/server/services/locales.mjs.map +1 -0
- package/dist/server/services/localizations.js +68 -0
- package/dist/server/services/localizations.js.map +1 -0
- package/dist/server/services/localizations.mjs +66 -0
- package/dist/server/services/localizations.mjs.map +1 -0
- package/dist/server/services/metrics.js +30 -0
- package/dist/server/services/metrics.js.map +1 -0
- package/dist/server/services/metrics.mjs +28 -0
- package/dist/server/services/metrics.mjs.map +1 -0
- package/dist/server/services/permissions/actions.js +136 -0
- package/dist/server/services/permissions/actions.js.map +1 -0
- package/dist/server/services/permissions/actions.mjs +134 -0
- package/dist/server/services/permissions/actions.mjs.map +1 -0
- package/dist/server/services/permissions/engine.js +52 -0
- package/dist/server/services/permissions/engine.js.map +1 -0
- package/dist/server/services/permissions/engine.mjs +50 -0
- package/dist/server/services/permissions/engine.mjs.map +1 -0
- package/dist/server/services/permissions/sections-builder.js +45 -0
- package/dist/server/services/permissions/sections-builder.js.map +1 -0
- package/dist/server/services/permissions/sections-builder.mjs +43 -0
- package/dist/server/services/permissions/sections-builder.mjs.map +1 -0
- package/dist/server/services/permissions.js +14 -0
- package/dist/server/services/permissions.js.map +1 -0
- package/dist/server/services/permissions.mjs +12 -0
- package/dist/server/services/permissions.mjs.map +1 -0
- package/dist/server/services/sanitize/index.js +34 -0
- package/dist/server/services/sanitize/index.js.map +1 -0
- package/dist/server/services/sanitize/index.mjs +32 -0
- package/dist/server/services/sanitize/index.mjs.map +1 -0
- package/dist/server/services/settings.js +25 -0
- package/dist/server/services/settings.js.map +1 -0
- package/dist/server/services/settings.mjs +23 -0
- package/dist/server/services/settings.mjs.map +1 -0
- package/dist/server/src/bootstrap.d.ts.map +1 -1
- package/dist/server/src/controllers/ai-localization-jobs.d.ts +17 -0
- package/dist/server/src/controllers/ai-localization-jobs.d.ts.map +1 -0
- package/dist/server/src/controllers/index.d.ts +10 -0
- package/dist/server/src/controllers/index.d.ts.map +1 -1
- package/dist/server/src/controllers/settings.d.ts +7 -0
- package/dist/server/src/controllers/settings.d.ts.map +1 -0
- package/dist/server/src/index.d.ts +47 -8
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/models/ai-localization-job.d.ts +5 -0
- package/dist/server/src/models/ai-localization-job.d.ts.map +1 -0
- package/dist/server/src/models/index.d.ts +5 -0
- package/dist/server/src/models/index.d.ts.map +1 -0
- package/dist/server/src/register.d.ts +1 -1
- package/dist/server/src/register.d.ts.map +1 -1
- package/dist/server/src/routes/admin.d.ts.map +1 -1
- package/dist/server/src/routes/content-api.d.ts +5 -8
- package/dist/server/src/routes/content-api.d.ts.map +1 -1
- package/dist/server/src/routes/index.d.ts +3 -7
- package/dist/server/src/routes/index.d.ts.map +1 -1
- package/dist/server/src/routes/validation/index.d.ts +2 -0
- package/dist/server/src/routes/validation/index.d.ts.map +1 -0
- package/dist/server/src/routes/validation/locale.d.ts +41 -0
- package/dist/server/src/routes/validation/locale.d.ts.map +1 -0
- package/dist/server/src/services/ai-localization-jobs.d.ts +26 -0
- package/dist/server/src/services/ai-localization-jobs.d.ts.map +1 -0
- package/dist/server/src/services/ai-localizations.d.ts +18 -0
- package/dist/server/src/services/ai-localizations.d.ts.map +1 -0
- package/dist/server/src/services/index.d.ts +33 -0
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/localizations.d.ts +1 -1
- package/dist/server/src/services/localizations.d.ts.map +1 -1
- package/dist/server/src/services/settings.d.ts +13 -0
- package/dist/server/src/services/settings.d.ts.map +1 -0
- package/dist/server/src/utils/index.d.ts +7 -1
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/src/validation/settings.d.ts +12 -0
- package/dist/server/src/validation/settings.d.ts.map +1 -0
- package/dist/server/utils/index.js +16 -0
- package/dist/server/utils/index.js.map +1 -0
- package/dist/server/utils/index.mjs +13 -0
- package/dist/server/utils/index.mjs.map +1 -0
- package/dist/server/validation/content-types.js +18 -0
- package/dist/server/validation/content-types.js.map +1 -0
- package/dist/server/validation/content-types.mjs +16 -0
- package/dist/server/validation/content-types.mjs.map +1 -0
- package/dist/server/validation/locales.js +23 -0
- package/dist/server/validation/locales.js.map +1 -0
- package/dist/server/validation/locales.mjs +20 -0
- package/dist/server/validation/locales.mjs.map +1 -0
- package/dist/server/validation/settings.js +11 -0
- package/dist/server/validation/settings.js.map +1 -0
- package/dist/server/validation/settings.mjs +9 -0
- package/dist/server/validation/settings.mjs.map +1 -0
- package/dist/shared/contracts/ai-localization-jobs.d.ts +27 -0
- package/dist/shared/contracts/ai-localization-jobs.d.ts.map +1 -0
- package/dist/shared/contracts/content-manager.d.ts +1 -1
- package/dist/shared/contracts/settings.d.ts +40 -0
- package/dist/shared/contracts/shared.d.ts +1 -1
- package/dist/shared/contracts/shared.d.ts.map +1 -0
- package/package.json +18 -12
- package/dist/_chunks/SettingsPage-B-KzAqT3.mjs +0 -554
- package/dist/_chunks/SettingsPage-B-KzAqT3.mjs.map +0 -1
- package/dist/_chunks/SettingsPage-hyOi94O9.js +0 -573
- package/dist/_chunks/SettingsPage-hyOi94O9.js.map +0 -1
- package/dist/_chunks/de-BOhNX_-5.js +0 -65
- package/dist/_chunks/de-BOhNX_-5.js.map +0 -1
- package/dist/_chunks/de-D80IRBP9.mjs +0 -65
- package/dist/_chunks/de-D80IRBP9.mjs.map +0 -1
- package/dist/_chunks/dk-CJ6Zzz78.mjs +0 -65
- package/dist/_chunks/dk-CJ6Zzz78.mjs.map +0 -1
- package/dist/_chunks/dk-cjXm0p3m.js +0 -65
- package/dist/_chunks/dk-cjXm0p3m.js.map +0 -1
- package/dist/_chunks/en-BTyF7WVW.mjs +0 -80
- package/dist/_chunks/en-BTyF7WVW.mjs.map +0 -1
- package/dist/_chunks/en-UlC0jh2t.js +0 -80
- package/dist/_chunks/en-UlC0jh2t.js.map +0 -1
- package/dist/_chunks/es-V8WnPN7w.mjs +0 -65
- package/dist/_chunks/es-V8WnPN7w.mjs.map +0 -1
- package/dist/_chunks/es-hr9b_HLp.js +0 -65
- package/dist/_chunks/es-hr9b_HLp.js.map +0 -1
- package/dist/_chunks/fr-BFmBbE0H.js +0 -65
- package/dist/_chunks/fr-BFmBbE0H.js.map +0 -1
- package/dist/_chunks/fr-F94noFiV.mjs +0 -65
- package/dist/_chunks/fr-F94noFiV.mjs.map +0 -1
- package/dist/_chunks/index-BcYj5jo9.mjs +0 -1589
- package/dist/_chunks/index-BcYj5jo9.mjs.map +0 -1
- package/dist/_chunks/index-C8NzsAKp.js +0 -1610
- package/dist/_chunks/index-C8NzsAKp.js.map +0 -1
- package/dist/_chunks/ko-C40pNQ9b.js +0 -64
- package/dist/_chunks/ko-C40pNQ9b.js.map +0 -1
- package/dist/_chunks/ko-CF-P3Car.mjs +0 -64
- package/dist/_chunks/ko-CF-P3Car.mjs.map +0 -1
- package/dist/_chunks/pl-Dxr9RUmD.mjs +0 -65
- package/dist/_chunks/pl-Dxr9RUmD.mjs.map +0 -1
- package/dist/_chunks/pl-JtWBy-JQ.js +0 -65
- package/dist/_chunks/pl-JtWBy-JQ.js.map +0 -1
- package/dist/_chunks/ru-B-4sVwXN.mjs +0 -67
- package/dist/_chunks/ru-B-4sVwXN.mjs.map +0 -1
- package/dist/_chunks/ru-COSWt3Nu.js +0 -67
- package/dist/_chunks/ru-COSWt3Nu.js.map +0 -1
- package/dist/_chunks/tr-BVj1O5ch.js +0 -65
- package/dist/_chunks/tr-BVj1O5ch.js.map +0 -1
- package/dist/_chunks/tr-Ccu6Yj11.mjs +0 -65
- package/dist/_chunks/tr-Ccu6Yj11.mjs.map +0 -1
- package/dist/_chunks/zh-BIz395Ms.mjs +0 -65
- package/dist/_chunks/zh-BIz395Ms.mjs.map +0 -1
- package/dist/_chunks/zh-Hans-Bfo6_TCM.mjs +0 -56
- package/dist/_chunks/zh-Hans-Bfo6_TCM.mjs.map +0 -1
- package/dist/_chunks/zh-Hans-DIEm_EMC.js +0 -56
- package/dist/_chunks/zh-Hans-DIEm_EMC.js.map +0 -1
- package/dist/_chunks/zh-wkBPBkhc.js +0 -65
- package/dist/_chunks/zh-wkBPBkhc.js.map +0 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { useQueryParams } from '@strapi/admin/strapi-admin';
|
|
3
|
+
import { useCollator, Menu, Flex, Typography } from '@strapi/design-system';
|
|
4
|
+
import { stringify } from 'qs';
|
|
5
|
+
import { useIntl } from 'react-intl';
|
|
6
|
+
import { useNavigate } from 'react-router-dom';
|
|
7
|
+
import { useGetLocalesQuery } from '../services/locales.mjs';
|
|
8
|
+
import { getTranslation } from '../utils/getTranslation.mjs';
|
|
9
|
+
|
|
10
|
+
const LocaleListCell = ({ locale: currentLocale, localizations, documentId })=>{
|
|
11
|
+
const { locale: language, formatMessage } = useIntl();
|
|
12
|
+
const { data: locales = [] } = useGetLocalesQuery();
|
|
13
|
+
const navigate = useNavigate();
|
|
14
|
+
const [{ query }] = useQueryParams();
|
|
15
|
+
const formatter = useCollator(language, {
|
|
16
|
+
sensitivity: 'base'
|
|
17
|
+
});
|
|
18
|
+
if (!Array.isArray(locales) || !localizations) {
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
const availableLocales = localizations.map((loc)=>loc.locale);
|
|
22
|
+
const localesForDocument = locales.reduce((acc, locale)=>{
|
|
23
|
+
const createdLocale = [
|
|
24
|
+
currentLocale,
|
|
25
|
+
...availableLocales
|
|
26
|
+
].find((loc)=>{
|
|
27
|
+
return loc === locale.code;
|
|
28
|
+
});
|
|
29
|
+
if (createdLocale) {
|
|
30
|
+
const name = locale.isDefault ? `${locale.name} (default)` : locale.name;
|
|
31
|
+
acc.push({
|
|
32
|
+
code: locale.code,
|
|
33
|
+
name
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return acc;
|
|
37
|
+
}, []).toSorted((a, b)=>formatter.compare(a.name, b.name));
|
|
38
|
+
const getDisplayText = ()=>{
|
|
39
|
+
const displayedLocales = localesForDocument.slice(0, 2);
|
|
40
|
+
const remainingCount = localesForDocument.length - 2;
|
|
41
|
+
const baseText = displayedLocales.map(({ name })=>name).join(', ');
|
|
42
|
+
if (remainingCount <= 0) {
|
|
43
|
+
return baseText;
|
|
44
|
+
}
|
|
45
|
+
return formatMessage({
|
|
46
|
+
id: getTranslation('CMListView.popover.display-locales.more'),
|
|
47
|
+
defaultMessage: '{locales} + {count} more'
|
|
48
|
+
}, {
|
|
49
|
+
locales: baseText,
|
|
50
|
+
count: remainingCount
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
const handleLocaleClick = (localeCode)=>{
|
|
54
|
+
navigate({
|
|
55
|
+
pathname: documentId,
|
|
56
|
+
search: stringify({
|
|
57
|
+
plugins: {
|
|
58
|
+
...query.plugins,
|
|
59
|
+
i18n: {
|
|
60
|
+
locale: localeCode
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
});
|
|
65
|
+
};
|
|
66
|
+
return /*#__PURE__*/ jsxs(Menu.Root, {
|
|
67
|
+
children: [
|
|
68
|
+
/*#__PURE__*/ jsx(Menu.Trigger, {
|
|
69
|
+
children: /*#__PURE__*/ jsx(Flex, {
|
|
70
|
+
minWidth: "100%",
|
|
71
|
+
alignItems: "center",
|
|
72
|
+
justifyContent: "center",
|
|
73
|
+
fontWeight: "regular",
|
|
74
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
|
75
|
+
textColor: "neutral800",
|
|
76
|
+
ellipsis: true,
|
|
77
|
+
marginRight: 2,
|
|
78
|
+
children: getDisplayText()
|
|
79
|
+
})
|
|
80
|
+
})
|
|
81
|
+
}),
|
|
82
|
+
/*#__PURE__*/ jsx(Menu.Content, {
|
|
83
|
+
children: localesForDocument.map(({ code, name })=>/*#__PURE__*/ jsx(Menu.Item, {
|
|
84
|
+
onClick: (e)=>{
|
|
85
|
+
e.stopPropagation();
|
|
86
|
+
handleLocaleClick(code);
|
|
87
|
+
},
|
|
88
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
|
89
|
+
textColor: "neutral800",
|
|
90
|
+
fontWeight: "regular",
|
|
91
|
+
children: name
|
|
92
|
+
})
|
|
93
|
+
}, code))
|
|
94
|
+
})
|
|
95
|
+
]
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export { LocaleListCell };
|
|
100
|
+
//# sourceMappingURL=LocaleListCell.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleListCell.mjs","sources":["../../../admin/src/components/LocaleListCell.tsx"],"sourcesContent":["import { useQueryParams } from '@strapi/admin/strapi-admin';\nimport { Flex, Menu, Typography, useCollator } from '@strapi/design-system';\nimport { stringify } from 'qs';\nimport { useIntl } from 'react-intl';\nimport { useNavigate } from 'react-router-dom';\n\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { I18nBaseQuery } from '../types';\n\ninterface LocaleListCellProps {\n localizations: { locale: string }[];\n locale: string;\n documentId: string;\n}\n\nconst LocaleListCell = ({\n locale: currentLocale,\n localizations,\n documentId,\n}: LocaleListCellProps) => {\n const { locale: language, formatMessage } = useIntl();\n const { data: locales = [] } = useGetLocalesQuery();\n const navigate = useNavigate();\n const [{ query }] = useQueryParams<I18nBaseQuery>();\n const formatter = useCollator(language, {\n sensitivity: 'base',\n });\n\n if (!Array.isArray(locales) || !localizations) {\n return null;\n }\n\n const availableLocales = localizations.map((loc) => loc.locale);\n\n const localesForDocument = locales\n .reduce<Array<{ code: string; name: string }>>((acc, locale) => {\n const createdLocale = [currentLocale, ...availableLocales].find((loc) => {\n return loc === locale.code;\n });\n\n if (createdLocale) {\n const name = locale.isDefault ? `${locale.name} (default)` : locale.name;\n acc.push({ code: locale.code, name });\n }\n\n return acc;\n }, [])\n .toSorted((a, b) => formatter.compare(a.name, b.name));\n\n const getDisplayText = () => {\n const displayedLocales = localesForDocument.slice(0, 2);\n const remainingCount = localesForDocument.length - 2;\n\n const baseText = displayedLocales.map(({ name }) => name).join(', ');\n\n if (remainingCount <= 0) {\n return baseText;\n }\n\n return formatMessage(\n {\n id: getTranslation('CMListView.popover.display-locales.more'),\n defaultMessage: '{locales} + {count} more',\n },\n { locales: baseText, count: remainingCount }\n );\n };\n\n const handleLocaleClick = (localeCode: string) => {\n navigate({\n pathname: documentId,\n search: stringify({\n plugins: {\n ...query.plugins,\n i18n: { locale: localeCode },\n },\n }),\n });\n };\n\n return (\n <Menu.Root>\n <Menu.Trigger>\n <Flex minWidth=\"100%\" alignItems=\"center\" justifyContent=\"center\" fontWeight=\"regular\">\n <Typography textColor=\"neutral800\" ellipsis marginRight={2}>\n {getDisplayText()}\n </Typography>\n </Flex>\n </Menu.Trigger>\n <Menu.Content>\n {localesForDocument.map(({ code, name }) => (\n <Menu.Item\n key={code}\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n handleLocaleClick(code);\n }}\n >\n <Typography textColor=\"neutral800\" fontWeight=\"regular\">\n {name}\n </Typography>\n </Menu.Item>\n ))}\n </Menu.Content>\n </Menu.Root>\n );\n};\n\nexport { LocaleListCell };\nexport type { LocaleListCellProps };\n"],"names":["LocaleListCell","locale","currentLocale","localizations","documentId","language","formatMessage","useIntl","data","locales","useGetLocalesQuery","navigate","useNavigate","query","useQueryParams","formatter","useCollator","sensitivity","Array","isArray","availableLocales","map","loc","localesForDocument","reduce","acc","createdLocale","find","code","name","isDefault","push","toSorted","a","b","compare","getDisplayText","displayedLocales","slice","remainingCount","length","baseText","join","id","getTranslation","defaultMessage","count","handleLocaleClick","localeCode","pathname","search","stringify","plugins","i18n","_jsxs","Menu","Root","_jsx","Trigger","Flex","minWidth","alignItems","justifyContent","fontWeight","Typography","textColor","ellipsis","marginRight","Content","Item","onClick","e","stopPropagation"],"mappings":";;;;;;;;;AAiBMA,MAAAA,cAAAA,GAAiB,CAAC,EACtBC,MAAAA,EAAQC,aAAa,EACrBC,aAAa,EACbC,UAAU,EACU,GAAA;AACpB,IAAA,MAAM,EAAEH,MAAQI,EAAAA,QAAQ,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAC5C,IAAA,MAAM,EAAEC,IAAAA,EAAMC,OAAU,GAAA,EAAE,EAAE,GAAGC,kBAAAA,EAAAA;AAC/B,IAAA,MAAMC,QAAWC,GAAAA,WAAAA,EAAAA;AACjB,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,CAAC,GAAGC,cAAAA,EAAAA;IACpB,MAAMC,SAAAA,GAAYC,YAAYX,QAAU,EAAA;QACtCY,WAAa,EAAA;AACf,KAAA,CAAA;AAEA,IAAA,IAAI,CAACC,KAAMC,CAAAA,OAAO,CAACV,OAAAA,CAAAA,IAAY,CAACN,aAAe,EAAA;QAC7C,OAAO,IAAA;AACT;AAEA,IAAA,MAAMiB,mBAAmBjB,aAAckB,CAAAA,GAAG,CAAC,CAACC,GAAAA,GAAQA,IAAIrB,MAAM,CAAA;AAE9D,IAAA,MAAMsB,kBAAqBd,GAAAA,OAAAA,CACxBe,MAAM,CAAwC,CAACC,GAAKxB,EAAAA,MAAAA,GAAAA;AACnD,QAAA,MAAMyB,aAAgB,GAAA;AAACxB,YAAAA,aAAAA;AAAkBkB,YAAAA,GAAAA;SAAiB,CAACO,IAAI,CAAC,CAACL,GAAAA,GAAAA;YAC/D,OAAOA,GAAAA,KAAQrB,OAAO2B,IAAI;AAC5B,SAAA,CAAA;AAEA,QAAA,IAAIF,aAAe,EAAA;AACjB,YAAA,MAAMG,IAAO5B,GAAAA,MAAAA,CAAO6B,SAAS,G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,MAAQ+C,EAAAA;AAAW;AAC7B;AACF,aAAA;AACF,SAAA,CAAA;AACF,KAAA;IAEA,qBACEM,IAAA,CAACC,KAAKC,IAAI,EAAA;;AACR,0BAAAC,GAAA,CAACF,KAAKG,OAAO,EAAA;AACX,gBAAA,QAAA,gBAAAD,GAACE,CAAAA,IAAAA,EAAAA;oBAAKC,QAAS,EAAA,MAAA;oBAAOC,UAAW,EAAA,QAAA;oBAASC,cAAe,EAAA,QAAA;oBAASC,UAAW,EAAA,SAAA;AAC3E,oBAAA,QAAA,gBAAAN,GAACO,CAAAA,UAAAA,EAAAA;wBAAWC,SAAU,EAAA,YAAA;wBAAaC,QAAQ,EAAA,IAAA;wBAACC,WAAa,EAAA,CAAA;AACtD/B,wBAAAA,QAAAA,EAAAA,cAAAA;;;;AAIP,0BAAAqB,GAAA,CAACF,KAAKa,OAAO,EAAA;0BACV7C,kBAAmBF,CAAAA,GAAG,CAAC,CAAC,EAAEO,IAAI,EAAEC,IAAI,EAAE,iBACrC4B,GAACF,CAAAA,IAAAA,CAAKc,IAAI,EAAA;AAERC,wBAAAA,OAAAA,EAAS,CAACC,CAAAA,GAAAA;AACRA,4BAAAA,CAAAA,CAAEC,eAAe,EAAA;4BACjBzB,iBAAkBnB,CAAAA,IAAAA,CAAAA;AACpB,yBAAA;AAEA,wBAAA,QAAA,gBAAA6B,GAACO,CAAAA,UAAAA,EAAAA;4BAAWC,SAAU,EAAA,YAAA;4BAAaF,UAAW,EAAA,SAAA;AAC3ClC,4BAAAA,QAAAA,EAAAA;;AAPED,qBAAAA,EAAAA,IAAAA,CAAAA;;;;AAcjB;;;;"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var strapiAdmin = require('@strapi/admin/strapi-admin');
|
|
6
|
+
var designSystem = require('@strapi/design-system');
|
|
7
|
+
var reactIntl = require('react-intl');
|
|
8
|
+
var useI18n = require('../hooks/useI18n.js');
|
|
9
|
+
var locales = require('../services/locales.js');
|
|
10
|
+
var getTranslation = require('../utils/getTranslation.js');
|
|
11
|
+
|
|
12
|
+
function _interopNamespaceDefault(e) {
|
|
13
|
+
var n = Object.create(null);
|
|
14
|
+
if (e) {
|
|
15
|
+
Object.keys(e).forEach(function (k) {
|
|
16
|
+
if (k !== 'default') {
|
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return e[k]; }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
n.default = e;
|
|
26
|
+
return Object.freeze(n);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
30
|
+
|
|
31
|
+
const LocalePicker = ()=>{
|
|
32
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
33
|
+
const [{ query }, setQuery] = strapiAdmin.useQueryParams();
|
|
34
|
+
const { hasI18n, canRead, canCreate } = useI18n.useI18n();
|
|
35
|
+
const { data: locales$1 = [] } = locales.useGetLocalesQuery(undefined, {
|
|
36
|
+
skip: !hasI18n
|
|
37
|
+
});
|
|
38
|
+
const handleChange = React__namespace.useCallback((code, replace = false)=>{
|
|
39
|
+
setQuery({
|
|
40
|
+
page: 1,
|
|
41
|
+
plugins: {
|
|
42
|
+
...query.plugins,
|
|
43
|
+
i18n: {
|
|
44
|
+
locale: code
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}, 'push', replace);
|
|
48
|
+
}, [
|
|
49
|
+
query.plugins,
|
|
50
|
+
setQuery
|
|
51
|
+
]);
|
|
52
|
+
React__namespace.useEffect(()=>{
|
|
53
|
+
if (!Array.isArray(locales$1) || !hasI18n) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Handle the case where the current locale query param doesn't exist
|
|
58
|
+
* in the list of available locales, so we redirect to the default locale.
|
|
59
|
+
*/ const currentDesiredLocale = query.plugins?.i18n?.locale;
|
|
60
|
+
const doesLocaleExist = locales$1.find((loc)=>loc.code === currentDesiredLocale);
|
|
61
|
+
const defaultLocale = locales$1.find((locale)=>locale.isDefault);
|
|
62
|
+
if (!doesLocaleExist && defaultLocale?.code) {
|
|
63
|
+
handleChange(defaultLocale.code, true);
|
|
64
|
+
}
|
|
65
|
+
}, [
|
|
66
|
+
hasI18n,
|
|
67
|
+
handleChange,
|
|
68
|
+
locales$1,
|
|
69
|
+
query.plugins?.i18n?.locale
|
|
70
|
+
]);
|
|
71
|
+
const sortedLocaleOptions = React__namespace.useMemo(()=>{
|
|
72
|
+
const displayedLocales = Array.isArray(locales$1) ? locales$1.filter((locale)=>{
|
|
73
|
+
/**
|
|
74
|
+
* If you can create or read we allow you to see the locale exists
|
|
75
|
+
* this is because in the ListView, you may be able to create a new entry
|
|
76
|
+
* in a locale you can't read.
|
|
77
|
+
*/ return canCreate.includes(locale.code) || canRead.includes(locale.code);
|
|
78
|
+
}) : [];
|
|
79
|
+
return displayedLocales.sort((a, b)=>a.name.localeCompare(b.name)).map((locale)=>/*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelectOption, {
|
|
80
|
+
value: locale.code,
|
|
81
|
+
children: locale.name
|
|
82
|
+
}, locale.id));
|
|
83
|
+
}, [
|
|
84
|
+
locales$1,
|
|
85
|
+
canCreate,
|
|
86
|
+
canRead
|
|
87
|
+
]);
|
|
88
|
+
if (!hasI18n || !Array.isArray(locales$1) || locales$1.length === 0) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
return /*#__PURE__*/ jsxRuntime.jsx(designSystem.SingleSelect, {
|
|
92
|
+
size: "S",
|
|
93
|
+
"aria-label": formatMessage({
|
|
94
|
+
id: getTranslation.getTranslation('actions.select-locale'),
|
|
95
|
+
defaultMessage: 'Select locale'
|
|
96
|
+
}),
|
|
97
|
+
value: query.plugins?.i18n?.locale || locales$1.find((locale)=>locale.isDefault)?.code,
|
|
98
|
+
// @ts-expect-error – This can be removed in V2 of the DS.
|
|
99
|
+
onChange: handleChange,
|
|
100
|
+
children: sortedLocaleOptions
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
exports.LocalePicker = LocalePicker;
|
|
105
|
+
//# sourceMappingURL=LocalePicker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalePicker.js","sources":["../../../admin/src/components/LocalePicker.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams } from '@strapi/admin/strapi-admin';\nimport { SingleSelect, SingleSelectOption } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { I18nBaseQuery } from '../types';\n\ninterface Query extends I18nBaseQuery {\n page?: number;\n}\n\nconst LocalePicker = () => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<Query>();\n\n const { hasI18n, canRead, canCreate } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery(undefined, {\n skip: !hasI18n,\n });\n\n const handleChange = React.useCallback(\n (code: string, replace = false) => {\n setQuery(\n {\n page: 1,\n plugins: { ...query.plugins, i18n: { locale: code } },\n },\n 'push',\n replace\n );\n },\n [query.plugins, setQuery]\n );\n\n React.useEffect(() => {\n if (!Array.isArray(locales) || !hasI18n) {\n return;\n }\n /**\n * Handle the case where the current locale query param doesn't exist\n * in the list of available locales, so we redirect to the default locale.\n */\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleChange(defaultLocale.code, true);\n }\n }, [hasI18n, handleChange, locales, query.plugins?.i18n?.locale]);\n\n const sortedLocaleOptions = React.useMemo(() => {\n const displayedLocales = Array.isArray(locales)\n ? locales.filter((locale) => {\n /**\n * If you can create or read we allow you to see the locale exists\n * this is because in the ListView, you may be able to create a new entry\n * in a locale you can't read.\n */\n return canCreate.includes(locale.code) || canRead.includes(locale.code);\n })\n : [];\n\n return displayedLocales\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((locale) => (\n <SingleSelectOption key={locale.id} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ));\n }, [locales, canCreate, canRead]);\n\n if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {\n return null;\n }\n\n return (\n <SingleSelect\n size=\"S\"\n aria-label={formatMessage({\n id: getTranslation('actions.select-locale'),\n defaultMessage: 'Select locale',\n })}\n value={query.plugins?.i18n?.locale || locales.find((locale) => locale.isDefault)?.code}\n // @ts-expect-error – This can be removed in V2 of the DS.\n onChange={handleChange}\n >\n {sortedLocaleOptions}\n </SingleSelect>\n );\n};\n\nexport { LocalePicker };\n"],"names":["LocalePicker","formatMessage","useIntl","query","setQuery","useQueryParams","hasI18n","canRead","canCreate","useI18n","data","locales","useGetLocalesQuery","undefined","skip","handleChange","React","useCallback","code","replace","page","plugins","i18n","locale","useEffect","Array","isArray","currentDesiredLocale","doesLocaleExist","find","loc","defaultLocale","isDefault","sortedLocaleOptions","useMemo","displayedLocales","filter","includes","sort","a","b","name","localeCompare","map","_jsx","SingleSelectOption","value","id","length","SingleSelect","size","aria-label","getTranslation","defaultMessage","onChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAMA,YAAe,GAAA,IAAA;IACnB,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAC1B,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,EAAEC,SAAS,GAAGC,0BAAAA,EAAAA;AAE9B,IAAA,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,SAAS,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AAO,EAAEC,IAAAA,EAAMC,MAAUZ,IAAAA,SAAAA,CAAQkB,IAAI,CAAC,CAACN,MAAAA,GAAWA,MAAOS,CAAAA,SAAS,CAAGd,EAAAA,IAAAA;;QAElFoC,QAAUvC,EAAAA,YAAAA;AAETkB,QAAAA,QAAAA,EAAAA;;AAGP;;;;"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { useQueryParams } from '@strapi/admin/strapi-admin';
|
|
4
|
+
import { SingleSelectOption, SingleSelect } from '@strapi/design-system';
|
|
5
|
+
import { useIntl } from 'react-intl';
|
|
6
|
+
import { useI18n } from '../hooks/useI18n.mjs';
|
|
7
|
+
import { useGetLocalesQuery } from '../services/locales.mjs';
|
|
8
|
+
import { getTranslation } from '../utils/getTranslation.mjs';
|
|
9
|
+
|
|
10
|
+
const LocalePicker = ()=>{
|
|
11
|
+
const { formatMessage } = useIntl();
|
|
12
|
+
const [{ query }, setQuery] = useQueryParams();
|
|
13
|
+
const { hasI18n, canRead, canCreate } = useI18n();
|
|
14
|
+
const { data: locales = [] } = useGetLocalesQuery(undefined, {
|
|
15
|
+
skip: !hasI18n
|
|
16
|
+
});
|
|
17
|
+
const handleChange = React.useCallback((code, replace = false)=>{
|
|
18
|
+
setQuery({
|
|
19
|
+
page: 1,
|
|
20
|
+
plugins: {
|
|
21
|
+
...query.plugins,
|
|
22
|
+
i18n: {
|
|
23
|
+
locale: code
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}, 'push', replace);
|
|
27
|
+
}, [
|
|
28
|
+
query.plugins,
|
|
29
|
+
setQuery
|
|
30
|
+
]);
|
|
31
|
+
React.useEffect(()=>{
|
|
32
|
+
if (!Array.isArray(locales) || !hasI18n) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Handle the case where the current locale query param doesn't exist
|
|
37
|
+
* in the list of available locales, so we redirect to the default locale.
|
|
38
|
+
*/ const currentDesiredLocale = query.plugins?.i18n?.locale;
|
|
39
|
+
const doesLocaleExist = locales.find((loc)=>loc.code === currentDesiredLocale);
|
|
40
|
+
const defaultLocale = locales.find((locale)=>locale.isDefault);
|
|
41
|
+
if (!doesLocaleExist && defaultLocale?.code) {
|
|
42
|
+
handleChange(defaultLocale.code, true);
|
|
43
|
+
}
|
|
44
|
+
}, [
|
|
45
|
+
hasI18n,
|
|
46
|
+
handleChange,
|
|
47
|
+
locales,
|
|
48
|
+
query.plugins?.i18n?.locale
|
|
49
|
+
]);
|
|
50
|
+
const sortedLocaleOptions = React.useMemo(()=>{
|
|
51
|
+
const displayedLocales = Array.isArray(locales) ? locales.filter((locale)=>{
|
|
52
|
+
/**
|
|
53
|
+
* If you can create or read we allow you to see the locale exists
|
|
54
|
+
* this is because in the ListView, you may be able to create a new entry
|
|
55
|
+
* in a locale you can't read.
|
|
56
|
+
*/ return canCreate.includes(locale.code) || canRead.includes(locale.code);
|
|
57
|
+
}) : [];
|
|
58
|
+
return displayedLocales.sort((a, b)=>a.name.localeCompare(b.name)).map((locale)=>/*#__PURE__*/ jsx(SingleSelectOption, {
|
|
59
|
+
value: locale.code,
|
|
60
|
+
children: locale.name
|
|
61
|
+
}, locale.id));
|
|
62
|
+
}, [
|
|
63
|
+
locales,
|
|
64
|
+
canCreate,
|
|
65
|
+
canRead
|
|
66
|
+
]);
|
|
67
|
+
if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
return /*#__PURE__*/ jsx(SingleSelect, {
|
|
71
|
+
size: "S",
|
|
72
|
+
"aria-label": formatMessage({
|
|
73
|
+
id: getTranslation('actions.select-locale'),
|
|
74
|
+
defaultMessage: 'Select locale'
|
|
75
|
+
}),
|
|
76
|
+
value: query.plugins?.i18n?.locale || locales.find((locale)=>locale.isDefault)?.code,
|
|
77
|
+
// @ts-expect-error – This can be removed in V2 of the DS.
|
|
78
|
+
onChange: handleChange,
|
|
79
|
+
children: sortedLocaleOptions
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { LocalePicker };
|
|
84
|
+
//# sourceMappingURL=LocalePicker.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocalePicker.mjs","sources":["../../../admin/src/components/LocalePicker.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useQueryParams } from '@strapi/admin/strapi-admin';\nimport { SingleSelect, SingleSelectOption } from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { useI18n } from '../hooks/useI18n';\nimport { useGetLocalesQuery } from '../services/locales';\nimport { getTranslation } from '../utils/getTranslation';\n\nimport type { I18nBaseQuery } from '../types';\n\ninterface Query extends I18nBaseQuery {\n page?: number;\n}\n\nconst LocalePicker = () => {\n const { formatMessage } = useIntl();\n const [{ query }, setQuery] = useQueryParams<Query>();\n\n const { hasI18n, canRead, canCreate } = useI18n();\n const { data: locales = [] } = useGetLocalesQuery(undefined, {\n skip: !hasI18n,\n });\n\n const handleChange = React.useCallback(\n (code: string, replace = false) => {\n setQuery(\n {\n page: 1,\n plugins: { ...query.plugins, i18n: { locale: code } },\n },\n 'push',\n replace\n );\n },\n [query.plugins, setQuery]\n );\n\n React.useEffect(() => {\n if (!Array.isArray(locales) || !hasI18n) {\n return;\n }\n /**\n * Handle the case where the current locale query param doesn't exist\n * in the list of available locales, so we redirect to the default locale.\n */\n const currentDesiredLocale = query.plugins?.i18n?.locale;\n const doesLocaleExist = locales.find((loc) => loc.code === currentDesiredLocale);\n const defaultLocale = locales.find((locale) => locale.isDefault);\n if (!doesLocaleExist && defaultLocale?.code) {\n handleChange(defaultLocale.code, true);\n }\n }, [hasI18n, handleChange, locales, query.plugins?.i18n?.locale]);\n\n const sortedLocaleOptions = React.useMemo(() => {\n const displayedLocales = Array.isArray(locales)\n ? locales.filter((locale) => {\n /**\n * If you can create or read we allow you to see the locale exists\n * this is because in the ListView, you may be able to create a new entry\n * in a locale you can't read.\n */\n return canCreate.includes(locale.code) || canRead.includes(locale.code);\n })\n : [];\n\n return displayedLocales\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((locale) => (\n <SingleSelectOption key={locale.id} value={locale.code}>\n {locale.name}\n </SingleSelectOption>\n ));\n }, [locales, canCreate, canRead]);\n\n if (!hasI18n || !Array.isArray(locales) || locales.length === 0) {\n return null;\n }\n\n return (\n <SingleSelect\n size=\"S\"\n aria-label={formatMessage({\n id: getTranslation('actions.select-locale'),\n defaultMessage: 'Select locale',\n })}\n value={query.plugins?.i18n?.locale || locales.find((locale) => locale.isDefault)?.code}\n // @ts-expect-error – This can be removed in V2 of the DS.\n onChange={handleChange}\n >\n {sortedLocaleOptions}\n </SingleSelect>\n );\n};\n\nexport { LocalePicker };\n"],"names":["LocalePicker","formatMessage","useIntl","query","setQuery","useQueryParams","hasI18n","canRead","canCreate","useI18n","data","locales","useGetLocalesQuery","undefined","skip","handleChange","React","useCallback","code","replace","page","plugins","i18n","locale","useEffect","Array","isArray","currentDesiredLocale","doesLocaleExist","find","loc","defaultLocale","isDefault","sortedLocaleOptions","useMemo","displayedLocales","filter","includes","sort","a","b","name","localeCompare","map","_jsx","SingleSelectOption","value","id","length","SingleSelect","size","aria-label","getTranslation","defaultMessage","onChange"],"mappings":";;;;;;;;;AAgBA,MAAMA,YAAe,GAAA,IAAA;IACnB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAC1B,IAAA,MAAM,CAAC,EAAEC,KAAK,EAAE,EAAEC,SAAS,GAAGC,cAAAA,EAAAA;AAE9B,IAAA,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAEC,SAAS,EAAE,GAAGC,OAAAA,EAAAA;AACxC,IAAA,MAAM,EAAEC,IAAMC,EAAAA,OAAAA,GAAU,EAAE,EAAE,GAAGC,mBAAmBC,SAAW,EAAA;AAC3DC,QAAAA,IAAAA,EAAM,CAACR;AACT,K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kB,QAAAA,QAAAA,EAAAA;;AAGP;;;;"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
var designSystem = require('@strapi/design-system');
|
|
6
|
+
var reactIntl = require('react-intl');
|
|
7
|
+
var getTranslation = require('../utils/getTranslation.js');
|
|
8
|
+
var DeleteLocale = require('./DeleteLocale.js');
|
|
9
|
+
var EditLocale = require('./EditLocale.js');
|
|
10
|
+
|
|
11
|
+
function _interopNamespaceDefault(e) {
|
|
12
|
+
var n = Object.create(null);
|
|
13
|
+
if (e) {
|
|
14
|
+
Object.keys(e).forEach(function (k) {
|
|
15
|
+
if (k !== 'default') {
|
|
16
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function () { return e[k]; }
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
var React__namespace = /*#__PURE__*/_interopNamespaceDefault(React);
|
|
29
|
+
|
|
30
|
+
const LocaleTable = ({ locales = [], canDelete, canUpdate })=>{
|
|
31
|
+
const [editLocaleId, setEditLocaleId] = React__namespace.useState();
|
|
32
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
33
|
+
const handleClick = (localeId)=>()=>{
|
|
34
|
+
if (canUpdate) {
|
|
35
|
+
setEditLocaleId(localeId);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
return /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Table, {
|
|
39
|
+
colCount: 4,
|
|
40
|
+
rowCount: locales.length + 1,
|
|
41
|
+
children: [
|
|
42
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Thead, {
|
|
43
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
|
|
46
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
47
|
+
variant: "sigma",
|
|
48
|
+
textColor: "neutral600",
|
|
49
|
+
children: formatMessage({
|
|
50
|
+
id: getTranslation.getTranslation('Settings.locales.row.id'),
|
|
51
|
+
defaultMessage: 'ID'
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
}),
|
|
55
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
|
|
56
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
57
|
+
variant: "sigma",
|
|
58
|
+
textColor: "neutral600",
|
|
59
|
+
children: formatMessage({
|
|
60
|
+
id: getTranslation.getTranslation('Settings.locales.row.displayName'),
|
|
61
|
+
defaultMessage: 'Display name'
|
|
62
|
+
})
|
|
63
|
+
})
|
|
64
|
+
}),
|
|
65
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
|
|
66
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
67
|
+
variant: "sigma",
|
|
68
|
+
textColor: "neutral600",
|
|
69
|
+
children: formatMessage({
|
|
70
|
+
id: getTranslation.getTranslation('Settings.locales.row.default-locale'),
|
|
71
|
+
defaultMessage: 'Default locale'
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
75
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Th, {
|
|
76
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.VisuallyHidden, {
|
|
77
|
+
children: "Actions"
|
|
78
|
+
})
|
|
79
|
+
})
|
|
80
|
+
]
|
|
81
|
+
})
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Tbody, {
|
|
84
|
+
children: locales.map((locale)=>/*#__PURE__*/ jsxRuntime.jsxs(React__namespace.Fragment, {
|
|
85
|
+
children: [
|
|
86
|
+
/*#__PURE__*/ jsxRuntime.jsxs(designSystem.Tr, {
|
|
87
|
+
onClick: handleClick(locale.id),
|
|
88
|
+
style: {
|
|
89
|
+
cursor: canUpdate ? 'pointer' : 'default'
|
|
90
|
+
},
|
|
91
|
+
children: [
|
|
92
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
93
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
94
|
+
textColor: "neutral800",
|
|
95
|
+
children: locale.id
|
|
96
|
+
})
|
|
97
|
+
}),
|
|
98
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
99
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
100
|
+
textColor: "neutral800",
|
|
101
|
+
children: locale.name
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
105
|
+
children: /*#__PURE__*/ jsxRuntime.jsx(designSystem.Typography, {
|
|
106
|
+
textColor: "neutral800",
|
|
107
|
+
children: locale.isDefault ? formatMessage({
|
|
108
|
+
id: getTranslation.getTranslation('Settings.locales.default'),
|
|
109
|
+
defaultMessage: 'Default'
|
|
110
|
+
}) : null
|
|
111
|
+
})
|
|
112
|
+
}),
|
|
113
|
+
/*#__PURE__*/ jsxRuntime.jsx(designSystem.Td, {
|
|
114
|
+
children: /*#__PURE__*/ jsxRuntime.jsxs(designSystem.Flex, {
|
|
115
|
+
gap: 1,
|
|
116
|
+
justifyContent: "flex-end",
|
|
117
|
+
onClick: (e)=>e.stopPropagation(),
|
|
118
|
+
children: [
|
|
119
|
+
canUpdate && /*#__PURE__*/ jsxRuntime.jsx(EditLocale.EditLocale, {
|
|
120
|
+
...locale
|
|
121
|
+
}),
|
|
122
|
+
canDelete && !locale.isDefault && /*#__PURE__*/ jsxRuntime.jsx(DeleteLocale.DeleteLocale, {
|
|
123
|
+
...locale
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
}),
|
|
130
|
+
/*#__PURE__*/ jsxRuntime.jsx(EditLocale.EditModal, {
|
|
131
|
+
...locale,
|
|
132
|
+
onOpenChange: ()=>setEditLocaleId(undefined),
|
|
133
|
+
open: editLocaleId === locale.id
|
|
134
|
+
})
|
|
135
|
+
]
|
|
136
|
+
}, locale.id))
|
|
137
|
+
})
|
|
138
|
+
]
|
|
139
|
+
});
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
exports.LocaleTable = LocaleTable;
|
|
143
|
+
//# sourceMappingURL=LocaleTable.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleTable.js","sources":["../../../admin/src/components/LocaleTable.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n Flex,\n Table,\n Tbody,\n Td,\n Th,\n Thead,\n Tr,\n Typography,\n VisuallyHidden,\n} from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nimport { DeleteLocale } from './DeleteLocale';\nimport { EditLocale, EditModal } from './EditLocale';\n\nimport type { Locale } from '../../../shared/contracts/locales';\n\n/* -------------------------------------------------------------------------------------------------\n * LocaleTable\n * -----------------------------------------------------------------------------------------------*/\n\ntype LocaleTableProps = {\n locales?: Locale[];\n canDelete?: boolean;\n canUpdate?: boolean;\n onDeleteLocale?: (locale: Locale) => void;\n onEditLocale?: (locale: Locale) => void;\n};\n\nconst LocaleTable = ({ locales = [], canDelete, canUpdate }: LocaleTableProps) => {\n const [editLocaleId, setEditLocaleId] = React.useState<Locale['id']>();\n const { formatMessage } = useIntl();\n\n const handleClick = (localeId: Locale['id']) => () => {\n if (canUpdate) {\n setEditLocaleId(localeId);\n }\n };\n\n return (\n <Table colCount={4} rowCount={locales.length + 1}>\n <Thead>\n <Tr>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.id'),\n defaultMessage: 'ID',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.displayName'),\n defaultMessage: 'Display name',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.default-locale'),\n defaultMessage: 'Default locale',\n })}\n </Typography>\n </Th>\n <Th>\n <VisuallyHidden>Actions</VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n <Tbody>\n {locales.map((locale) => (\n <React.Fragment key={locale.id}>\n <Tr\n onClick={handleClick(locale.id)}\n style={{ cursor: canUpdate ? 'pointer' : 'default' }}\n >\n <Td>\n <Typography textColor=\"neutral800\">{locale.id}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{locale.name}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">\n {locale.isDefault\n ? formatMessage({\n id: getTranslation('Settings.locales.default'),\n defaultMessage: 'Default',\n })\n : null}\n </Typography>\n </Td>\n <Td>\n <Flex gap={1} justifyContent=\"flex-end\" onClick={(e) => e.stopPropagation()}>\n {canUpdate && <EditLocale {...locale} />}\n {canDelete && !locale.isDefault && <DeleteLocale {...locale} />}\n </Flex>\n </Td>\n </Tr>\n <EditModal\n {...locale}\n onOpenChange={() => setEditLocaleId(undefined)}\n open={editLocaleId === locale.id}\n />\n </React.Fragment>\n ))}\n </Tbody>\n </Table>\n );\n};\n\nexport { LocaleTable };\nexport type { LocaleTableProps };\n"],"names":["LocaleTable","locales","canDelete","canUpdate","editLocaleId","setEditLocaleId","React","useState","formatMessage","useIntl","handleClick","localeId","_jsxs","Table","colCount","rowCount","length","_jsx","Thead","Tr","Th","Typography","variant","textColor","id","getTranslation","defaultMessage","VisuallyHidden","Tbody","map","locale","Fragment","onClick","style","cursor","Td","name","isDefault","Flex","gap","justifyContent","e","stopPropagation","EditLocale","DeleteLocale","EditModal","onOpenChange","undefined","open"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCMA,MAAAA,WAAAA,GAAc,CAAC,EAAEC,OAAAA,GAAU,EAAE,EAAEC,SAAS,EAAEC,SAAS,EAAoB,GAAA;AAC3E,IAAA,MAAM,CAACC,YAAAA,EAAcC,eAAgB,CAAA,GAAGC,iBAAMC,QAAQ,EAAA;IACtD,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;IAE1B,MAAMC,WAAAA,GAAc,CAACC,QAA2B,GAAA,IAAA;AAC9C,YAAA,IAAIR,SAAW,EAAA;gBACbE,eAAgBM,CAAAA,QAAAA,CAAAA;AAClB;AACF,SAAA;AAEA,IAAA,qBACEC,eAACC,CAAAA,kBAAAA,EAAAA;QAAMC,QAAU,EAAA,CAAA;QAAGC,QAAUd,EAAAA,OAAAA,CAAQe,MAAM,GAAG,CAAA;;0BAC7CC,cAACC,CAAAA,kBAAAA,EAAAA;AACC,gBAAA,QAAA,gBAAAN,eAACO,CAAAA,eAAAA,EAAAA;;sCACCF,cAACG,CAAAA,eAAAA,EAAAA;AACC,4BAAA,QAAA,gBAAAH,cAACI,CAAAA,uBAAAA,EAAAA;gCAAWC,OAAQ,EAAA,OAAA;gCAAQC,SAAU,EAAA,YAAA;0CACnCf,aAAc,CAAA;AACbgB,oCAAAA,EAAAA,EAAIC,6BAAe,CAAA,yBAAA,CAAA;oCACnBC,cAAgB,EAAA;AAClB,iCAAA;;;sCAGJT,cAACG,CAAAA,eAAAA,EAAAA;AACC,4BAAA,QAAA,gBAAAH,cAACI,CAAAA,uBAAAA,EAAAA;gCAAWC,OAAQ,EAAA,OAAA;gCAAQC,SAAU,EAAA,YAAA;0CACnCf,aAAc,CAAA;AACbgB,oCAAAA,EAAAA,EAAIC,6BAAe,CAAA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,MAAOO,CAAAA,SAAS,GACb7B,aAAc,CAAA;AACZgB,gDAAAA,EAAAA,EAAIC,6BAAe,CAAA,0BAAA,CAAA;gDACnBC,cAAgB,EAAA;6CAElB,CAAA,GAAA;;;kDAGRT,cAACkB,CAAAA,eAAAA,EAAAA;AACC,wCAAA,QAAA,gBAAAvB,eAAC0B,CAAAA,iBAAAA,EAAAA;4CAAKC,GAAK,EAAA,CAAA;4CAAGC,cAAe,EAAA,UAAA;4CAAWR,OAAS,EAAA,CAACS,CAAMA,GAAAA,CAAAA,CAAEC,eAAe,EAAA;;AACtEvC,gDAAAA,SAAAA,kBAAac,cAAC0B,CAAAA,qBAAAA,EAAAA;AAAY,oDAAA,GAAGb;;AAC7B5B,gDAAAA,SAAAA,IAAa,CAAC4B,MAAAA,CAAOO,SAAS,kBAAIpB,cAAC2B,CAAAA,yBAAAA,EAAAA;AAAc,oDAAA,GAAGd;;;;;;;0CAI3Db,cAAC4B,CAAAA,oBAAAA,EAAAA;AACE,gCAAA,GAAGf,MAAM;AACVgB,gCAAAA,YAAAA,EAAc,IAAMzC,eAAgB0C,CAAAA,SAAAA,CAAAA;gCACpCC,IAAM5C,EAAAA,YAAAA,KAAiB0B,OAAON;;;AA/BbM,qBAAAA,EAAAA,MAAAA,CAAON,EAAE,CAAA;;;;AAsCxC;;;;"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { Table, Thead, Tr, Th, Typography, VisuallyHidden, Tbody, Td, Flex } from '@strapi/design-system';
|
|
4
|
+
import { useIntl } from 'react-intl';
|
|
5
|
+
import { getTranslation } from '../utils/getTranslation.mjs';
|
|
6
|
+
import { DeleteLocale } from './DeleteLocale.mjs';
|
|
7
|
+
import { EditLocale, EditModal } from './EditLocale.mjs';
|
|
8
|
+
|
|
9
|
+
const LocaleTable = ({ locales = [], canDelete, canUpdate })=>{
|
|
10
|
+
const [editLocaleId, setEditLocaleId] = React.useState();
|
|
11
|
+
const { formatMessage } = useIntl();
|
|
12
|
+
const handleClick = (localeId)=>()=>{
|
|
13
|
+
if (canUpdate) {
|
|
14
|
+
setEditLocaleId(localeId);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
return /*#__PURE__*/ jsxs(Table, {
|
|
18
|
+
colCount: 4,
|
|
19
|
+
rowCount: locales.length + 1,
|
|
20
|
+
children: [
|
|
21
|
+
/*#__PURE__*/ jsx(Thead, {
|
|
22
|
+
children: /*#__PURE__*/ jsxs(Tr, {
|
|
23
|
+
children: [
|
|
24
|
+
/*#__PURE__*/ jsx(Th, {
|
|
25
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
|
26
|
+
variant: "sigma",
|
|
27
|
+
textColor: "neutral600",
|
|
28
|
+
children: formatMessage({
|
|
29
|
+
id: getTranslation('Settings.locales.row.id'),
|
|
30
|
+
defaultMessage: 'ID'
|
|
31
|
+
})
|
|
32
|
+
})
|
|
33
|
+
}),
|
|
34
|
+
/*#__PURE__*/ jsx(Th, {
|
|
35
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
|
36
|
+
variant: "sigma",
|
|
37
|
+
textColor: "neutral600",
|
|
38
|
+
children: formatMessage({
|
|
39
|
+
id: getTranslation('Settings.locales.row.displayName'),
|
|
40
|
+
defaultMessage: 'Display name'
|
|
41
|
+
})
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
/*#__PURE__*/ jsx(Th, {
|
|
45
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
|
46
|
+
variant: "sigma",
|
|
47
|
+
textColor: "neutral600",
|
|
48
|
+
children: formatMessage({
|
|
49
|
+
id: getTranslation('Settings.locales.row.default-locale'),
|
|
50
|
+
defaultMessage: 'Default locale'
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
}),
|
|
54
|
+
/*#__PURE__*/ jsx(Th, {
|
|
55
|
+
children: /*#__PURE__*/ jsx(VisuallyHidden, {
|
|
56
|
+
children: "Actions"
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
})
|
|
61
|
+
}),
|
|
62
|
+
/*#__PURE__*/ jsx(Tbody, {
|
|
63
|
+
children: locales.map((locale)=>/*#__PURE__*/ jsxs(React.Fragment, {
|
|
64
|
+
children: [
|
|
65
|
+
/*#__PURE__*/ jsxs(Tr, {
|
|
66
|
+
onClick: handleClick(locale.id),
|
|
67
|
+
style: {
|
|
68
|
+
cursor: canUpdate ? 'pointer' : 'default'
|
|
69
|
+
},
|
|
70
|
+
children: [
|
|
71
|
+
/*#__PURE__*/ jsx(Td, {
|
|
72
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
|
73
|
+
textColor: "neutral800",
|
|
74
|
+
children: locale.id
|
|
75
|
+
})
|
|
76
|
+
}),
|
|
77
|
+
/*#__PURE__*/ jsx(Td, {
|
|
78
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
|
79
|
+
textColor: "neutral800",
|
|
80
|
+
children: locale.name
|
|
81
|
+
})
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ jsx(Td, {
|
|
84
|
+
children: /*#__PURE__*/ jsx(Typography, {
|
|
85
|
+
textColor: "neutral800",
|
|
86
|
+
children: locale.isDefault ? formatMessage({
|
|
87
|
+
id: getTranslation('Settings.locales.default'),
|
|
88
|
+
defaultMessage: 'Default'
|
|
89
|
+
}) : null
|
|
90
|
+
})
|
|
91
|
+
}),
|
|
92
|
+
/*#__PURE__*/ jsx(Td, {
|
|
93
|
+
children: /*#__PURE__*/ jsxs(Flex, {
|
|
94
|
+
gap: 1,
|
|
95
|
+
justifyContent: "flex-end",
|
|
96
|
+
onClick: (e)=>e.stopPropagation(),
|
|
97
|
+
children: [
|
|
98
|
+
canUpdate && /*#__PURE__*/ jsx(EditLocale, {
|
|
99
|
+
...locale
|
|
100
|
+
}),
|
|
101
|
+
canDelete && !locale.isDefault && /*#__PURE__*/ jsx(DeleteLocale, {
|
|
102
|
+
...locale
|
|
103
|
+
})
|
|
104
|
+
]
|
|
105
|
+
})
|
|
106
|
+
})
|
|
107
|
+
]
|
|
108
|
+
}),
|
|
109
|
+
/*#__PURE__*/ jsx(EditModal, {
|
|
110
|
+
...locale,
|
|
111
|
+
onOpenChange: ()=>setEditLocaleId(undefined),
|
|
112
|
+
open: editLocaleId === locale.id
|
|
113
|
+
})
|
|
114
|
+
]
|
|
115
|
+
}, locale.id))
|
|
116
|
+
})
|
|
117
|
+
]
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
export { LocaleTable };
|
|
122
|
+
//# sourceMappingURL=LocaleTable.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LocaleTable.mjs","sources":["../../../admin/src/components/LocaleTable.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n Flex,\n Table,\n Tbody,\n Td,\n Th,\n Thead,\n Tr,\n Typography,\n VisuallyHidden,\n} from '@strapi/design-system';\nimport { useIntl } from 'react-intl';\n\nimport { getTranslation } from '../utils/getTranslation';\n\nimport { DeleteLocale } from './DeleteLocale';\nimport { EditLocale, EditModal } from './EditLocale';\n\nimport type { Locale } from '../../../shared/contracts/locales';\n\n/* -------------------------------------------------------------------------------------------------\n * LocaleTable\n * -----------------------------------------------------------------------------------------------*/\n\ntype LocaleTableProps = {\n locales?: Locale[];\n canDelete?: boolean;\n canUpdate?: boolean;\n onDeleteLocale?: (locale: Locale) => void;\n onEditLocale?: (locale: Locale) => void;\n};\n\nconst LocaleTable = ({ locales = [], canDelete, canUpdate }: LocaleTableProps) => {\n const [editLocaleId, setEditLocaleId] = React.useState<Locale['id']>();\n const { formatMessage } = useIntl();\n\n const handleClick = (localeId: Locale['id']) => () => {\n if (canUpdate) {\n setEditLocaleId(localeId);\n }\n };\n\n return (\n <Table colCount={4} rowCount={locales.length + 1}>\n <Thead>\n <Tr>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.id'),\n defaultMessage: 'ID',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.displayName'),\n defaultMessage: 'Display name',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\" textColor=\"neutral600\">\n {formatMessage({\n id: getTranslation('Settings.locales.row.default-locale'),\n defaultMessage: 'Default locale',\n })}\n </Typography>\n </Th>\n <Th>\n <VisuallyHidden>Actions</VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n <Tbody>\n {locales.map((locale) => (\n <React.Fragment key={locale.id}>\n <Tr\n onClick={handleClick(locale.id)}\n style={{ cursor: canUpdate ? 'pointer' : 'default' }}\n >\n <Td>\n <Typography textColor=\"neutral800\">{locale.id}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{locale.name}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">\n {locale.isDefault\n ? formatMessage({\n id: getTranslation('Settings.locales.default'),\n defaultMessage: 'Default',\n })\n : null}\n </Typography>\n </Td>\n <Td>\n <Flex gap={1} justifyContent=\"flex-end\" onClick={(e) => e.stopPropagation()}>\n {canUpdate && <EditLocale {...locale} />}\n {canDelete && !locale.isDefault && <DeleteLocale {...locale} />}\n </Flex>\n </Td>\n </Tr>\n <EditModal\n {...locale}\n onOpenChange={() => setEditLocaleId(undefined)}\n open={editLocaleId === locale.id}\n />\n </React.Fragment>\n ))}\n </Tbody>\n </Table>\n );\n};\n\nexport { LocaleTable };\nexport type { LocaleTableProps };\n"],"names":["LocaleTable","locales","canDelete","canUpdate","editLocaleId","setEditLocaleId","React","useState","formatMessage","useIntl","handleClick","localeId","_jsxs","Table","colCount","rowCount","length","_jsx","Thead","Tr","Th","Typography","variant","textColor","id","getTranslation","defaultMessage","VisuallyHidden","Tbody","map","locale","Fragment","onClick","style","cursor","Td","name","isDefault","Flex","gap","justifyContent","e","stopPropag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