From f95fd168a951b9eb9bfaf16258bf8ef5acc55f45 Mon Sep 17 00:00:00 2001 From: bencun Date: Mon, 23 Jan 2023 14:59:15 +0100 Subject: [PATCH] feat: field localization * Localize field labels and values. * More localization. --- src/collections/Forms/fields.ts | 6 ++++++ src/collections/Forms/index.ts | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/src/collections/Forms/fields.ts b/src/collections/Forms/fields.ts index b2364d1..5d8247b 100644 --- a/src/collections/Forms/fields.ts +++ b/src/collections/Forms/fields.ts @@ -14,6 +14,7 @@ const label: Field = { name: 'label', label: 'Label', type: 'text', + localized: true, }; const required: Field = { @@ -64,6 +65,7 @@ const Select: Block = { { name: 'defaultValue', label: 'Default Value', + localized: true, type: 'text', admin: { width: '50%', @@ -88,6 +90,7 @@ const Select: Block = { label: 'Label', type: 'text', required: true, + localized: true, admin: { width: '50%', }, @@ -146,6 +149,7 @@ const Text: Block = { name: 'defaultValue', label: 'Default Value', type: 'text', + localized: true, admin: { width: '50%', }, @@ -192,6 +196,7 @@ const TextArea: Block = { { name: 'defaultValue', label: 'Default Value', + localized: true, type: 'text', admin: { width: '50%', @@ -560,6 +565,7 @@ const Message: Block = { { name: 'message', type: 'richText', + localized: true, }, ], }; diff --git a/src/collections/Forms/index.ts b/src/collections/Forms/index.ts index 4b93775..ef21a13 100644 --- a/src/collections/Forms/index.ts +++ b/src/collections/Forms/index.ts @@ -110,6 +110,7 @@ export const generateFormCollection = (formConfig: PluginConfig): CollectionConf { name: 'submitButtonLabel', type: 'text', + localized: true, }, { name: 'confirmationType', @@ -133,6 +134,7 @@ export const generateFormCollection = (formConfig: PluginConfig): CollectionConf { name: 'confirmationMessage', type: 'richText', + localized: true, required: true, admin: { condition: (_, siblingData) => siblingData?.confirmationType === 'message', @@ -206,11 +208,13 @@ export const generateFormCollection = (formConfig: PluginConfig): CollectionConf label: 'Subject', defaultValue: 'You\'ve received a new message.', required: true, + localized: true, }, { type: 'richText', name: 'message', label: 'Message', + localized: true, admin: { description: 'Enter the message that should be sent in this email.', },