From 217da4062611308d3bd146694b41c99313326d4d Mon Sep 17 00:00:00 2001 From: littlemight Date: Thu, 30 Oct 2025 20:58:29 +0800 Subject: [PATCH 1/6] feat(i18n): extract text from dropdown field + AI generated translation --- .../MultiSelect/MultiSelectProvider.tsx | 25 ++++++++++++++----- .../SingleSelect/SingleSelectProvider.tsx | 8 ++++-- .../features/public-form/fields/en-sg.ts | 2 ++ .../features/public-form/fields/index.ts | 2 ++ .../features/public-form/fields/ms-sg.ts | 2 ++ .../features/public-form/fields/ta-sg.ts | 2 ++ .../features/public-form/fields/zh-sg.ts | 2 ++ 7 files changed, 35 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/Dropdown/MultiSelect/MultiSelectProvider.tsx b/frontend/src/components/Dropdown/MultiSelect/MultiSelectProvider.tsx index fc8473ad51..36f59994dd 100644 --- a/frontend/src/components/Dropdown/MultiSelect/MultiSelectProvider.tsx +++ b/frontend/src/components/Dropdown/MultiSelect/MultiSelectProvider.tsx @@ -1,4 +1,5 @@ import { useCallback, useEffect, useMemo, useRef, useState } from 'react' +import { useTranslation } from 'react-i18next' import { VirtuosoHandle } from 'react-virtuoso' import { FormControlOptions, @@ -73,9 +74,9 @@ export const MultiSelectProvider = ({ onBlur, name, filter = defaultFilter, - nothingFoundLabel = 'No matching results', + nothingFoundLabel, placeholder: placeholderProp, - clearButtonLabel = 'Clear selection', + clearButtonLabel, isSearchable = true, defaultIsOpen, isInvalid: isInvalidProp, @@ -92,6 +93,7 @@ export const MultiSelectProvider = ({ }: MultiSelectProviderProps): JSX.Element => { const { items, getItemByValue } = useItems({ rawItems }) const [isFocused, setIsFocused] = useState(false) + const { t } = useTranslation() // Inject for components to manipulate const inputRef = useRef(null) @@ -171,8 +173,19 @@ export const MultiSelectProvider = ({ const dynamicPlaceholder = useMemo(() => { if (placeholderProp === null || selectedItems.length > 0) return '' - return placeholderProp ?? 'Select options' - }, [placeholderProp, selectedItems.length]) + return ( + placeholderProp ?? + t('features.publicForm.components.fields.dropdown.selectOptions') + ) + }, [placeholderProp, selectedItems.length, t]) + + const nothingFoundLabelTranslated = + nothingFoundLabel ?? + t('features.publicForm.components.fields.dropdown.nothingFound') + + const clearButtonLabelTranslated = + clearButtonLabel ?? + t('features.publicForm.components.fields.dropdown.clearSelection') const { toggleMenu, @@ -313,11 +326,11 @@ export const MultiSelectProvider = ({ selectItem, highlightedIndex, items: filteredItems, - nothingFoundLabel, + nothingFoundLabel: nothingFoundLabelTranslated, inputValue, isSearchable, name, - clearButtonLabel, + clearButtonLabel: clearButtonLabelTranslated, placeholder: dynamicPlaceholder, styles, isFocused, diff --git a/frontend/src/components/Dropdown/SingleSelect/SingleSelectProvider.tsx b/frontend/src/components/Dropdown/SingleSelect/SingleSelectProvider.tsx index 5746e64cba..3404f077d9 100644 --- a/frontend/src/components/Dropdown/SingleSelect/SingleSelectProvider.tsx +++ b/frontend/src/components/Dropdown/SingleSelect/SingleSelectProvider.tsx @@ -53,7 +53,7 @@ export const SingleSelectProvider = ({ name, filter = defaultFilter, placeholder: placeholderProp, - clearButtonLabel = 'Clear selection', + clearButtonLabel, isClearable = true, isSearchable = true, initialIsOpen, @@ -94,6 +94,10 @@ export const SingleSelectProvider = ({ 'features.publicForm.components.fields.dropdown.nothingFound', ) + const clearButtonLabelTranslated = + clearButtonLabel ?? + t('features.publicForm.components.fields.dropdown.clearSelection') + const getFilteredItems = useCallback( (filterValue?: string) => filterValue ? filter(items, filterValue) : items, @@ -274,7 +278,7 @@ export const SingleSelectProvider = ({ isReadOnly, isRequired, name, - clearButtonLabel, + clearButtonLabel: clearButtonLabelTranslated, placeholder, styles, isFocused, diff --git a/frontend/src/i18n/locales/features/public-form/fields/en-sg.ts b/frontend/src/i18n/locales/features/public-form/fields/en-sg.ts index a258ed65d4..880512098f 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/en-sg.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/en-sg.ts @@ -11,6 +11,8 @@ export const enSG: Fields = { dropdown: { placeholder: 'Select an option', nothingFound: 'No matching results', + clearSelection: 'Clear selection', + selectOptions: 'Select options', }, attachment: { disabled: 'Attachment upload is disabled for you', diff --git a/frontend/src/i18n/locales/features/public-form/fields/index.ts b/frontend/src/i18n/locales/features/public-form/fields/index.ts index 2bb314f040..32c43f39b2 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/index.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/index.ts @@ -9,6 +9,8 @@ export interface Fields { dropdown: { placeholder: string nothingFound: string + clearSelection: string + selectOptions: string } email: { validation: { diff --git a/frontend/src/i18n/locales/features/public-form/fields/ms-sg.ts b/frontend/src/i18n/locales/features/public-form/fields/ms-sg.ts index 4feace59c8..d0414f86d5 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/ms-sg.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/ms-sg.ts @@ -13,6 +13,8 @@ export const msSG: PartialDeep = { dropdown: { placeholder: 'Pilih satu pilihan', nothingFound: 'Tiada hasil yang sepadan', + clearSelection: 'Kosongkan pilihan', + selectOptions: 'Pilih pilihan', }, attachment: { maxFileSize: 'Saiz fail maksimum: {readableMaxSize}', diff --git a/frontend/src/i18n/locales/features/public-form/fields/ta-sg.ts b/frontend/src/i18n/locales/features/public-form/fields/ta-sg.ts index 61a2d36983..41b8d0dad6 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/ta-sg.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/ta-sg.ts @@ -13,6 +13,8 @@ export const taSG: PartialDeep = { dropdown: { placeholder: 'ஒரு விருப்பத்தை தேர்வு செய்யவும்', nothingFound: 'முடிவுகள் எதுவும் பொருந்தவில்லை', + clearSelection: 'தேர்வை அழிக்கவும்', + selectOptions: 'விருப்பங்களைத் தேர்ந்தெடுக்கவும்', }, attachment: { maxFileSize: 'கோப்பின் அதிகபட்ச அளவு: {readableMaxSize}', diff --git a/frontend/src/i18n/locales/features/public-form/fields/zh-sg.ts b/frontend/src/i18n/locales/features/public-form/fields/zh-sg.ts index 2817c80298..bdb4a944e9 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/zh-sg.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/zh-sg.ts @@ -13,6 +13,8 @@ export const zhSG: PartialDeep = { dropdown: { placeholder: '请选择一个选项', nothingFound: '没有匹配结果', + clearSelection: '清除选择', + selectOptions: '选择选项', }, attachment: { maxFileSize: '文件限制:不超过 {readableMaxSize}', From bc9ea3d262ac0199b9bb41eded7c155a5d4eb63c Mon Sep 17 00:00:00 2001 From: littlemight Date: Thu, 30 Oct 2025 21:06:20 +0800 Subject: [PATCH 2/6] feaet(i18n): extract text from calendar field + translation --- .../Calendar/CalendarBase/CalendarTodayButton.tsx | 9 +++++++-- .../components/DatePicker/DatePickerContext.tsx | 14 ++++++++++---- .../locales/features/public-form/fields/en-sg.ts | 9 +++++++++ .../locales/features/public-form/fields/index.ts | 9 +++++++++ .../locales/features/public-form/fields/ms-sg.ts | 9 +++++++++ .../locales/features/public-form/fields/ta-sg.ts | 9 +++++++++ .../locales/features/public-form/fields/zh-sg.ts | 9 +++++++++ 7 files changed, 62 insertions(+), 6 deletions(-) diff --git a/frontend/src/components/Calendar/CalendarBase/CalendarTodayButton.tsx b/frontend/src/components/Calendar/CalendarBase/CalendarTodayButton.tsx index 2e25ac4a4e..17ec57815b 100644 --- a/frontend/src/components/Calendar/CalendarBase/CalendarTodayButton.tsx +++ b/frontend/src/components/Calendar/CalendarBase/CalendarTodayButton.tsx @@ -1,3 +1,4 @@ +import { useTranslation } from 'react-i18next' import { Box } from '@chakra-ui/react' import Button from '~components/Button' @@ -8,16 +9,20 @@ import { useCalendarStyles } from './CalendarStyleProvider' export const CalendarTodayButton = (): JSX.Element => { const styles = useCalendarStyles() const { handleTodayClick, colorScheme } = useCalendar() + const { t } = useTranslation('translation', { + keyPrefix: 'features.publicForm.components.fields.calendar', + }) + return ( ) diff --git a/frontend/src/components/DatePicker/DatePickerContext.tsx b/frontend/src/components/DatePicker/DatePickerContext.tsx index 03ccd5165f..4652aa1736 100644 --- a/frontend/src/components/DatePicker/DatePickerContext.tsx +++ b/frontend/src/components/DatePicker/DatePickerContext.tsx @@ -10,6 +10,7 @@ import React, { useMemo, useRef, } from 'react' +import { useTranslation } from 'react-i18next' import { CSSObject, FormControlProps, @@ -101,6 +102,9 @@ const useProvideDatePicker = ({ const inputRef = useRef(null) const isMobile = useIsMobile() + const { t } = useTranslation('translation', { + keyPrefix: 'features.publicForm.components.fields.datePicker', + }) const disclosureProps = useDisclosure({ onClose: () => { @@ -161,16 +165,18 @@ const useProvideDatePicker = ({ ) const calendarButtonAria = useMemo(() => { - let ariaLabel = 'Select from date picker. ' + let ariaLabel = t('selectFromDatePicker') if (internalValue) { if (isValid(internalValue)) { - ariaLabel += `Selected date is ${internalValue.toLocaleDateString()}.` + ariaLabel += t('selectedDateIs', { + date: internalValue.toLocaleDateString(), + }) } else { - ariaLabel += 'The current selected date is invalid.' + ariaLabel += t('invalidDate') } } return ariaLabel - }, [internalValue]) + }, [internalValue, t]) const handleDateChange = useCallback( (date: Date | null) => { diff --git a/frontend/src/i18n/locales/features/public-form/fields/en-sg.ts b/frontend/src/i18n/locales/features/public-form/fields/en-sg.ts index 880512098f..c38866c093 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/en-sg.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/en-sg.ts @@ -66,4 +66,13 @@ export const enSG: Fields = { title: 'Send the following emails a copy of my responses upon submission', info: 'Separate multiple email addresses with a comma', }, + calendar: { + today: 'Today', + todayAriaLabel: "Focus on today's date", + }, + datePicker: { + selectFromDatePicker: 'Select from date picker. ', + selectedDateIs: 'Selected date is {date}.', + invalidDate: 'The current selected date is invalid.', + }, } diff --git a/frontend/src/i18n/locales/features/public-form/fields/index.ts b/frontend/src/i18n/locales/features/public-form/fields/index.ts index 32c43f39b2..a908eff81c 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/index.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/index.ts @@ -57,6 +57,15 @@ export interface Fields { title: string info: string } + calendar: { + today: string + todayAriaLabel: string + } + datePicker: { + selectFromDatePicker: string + selectedDateIs: string + invalidDate: string + } } export * from './en-sg' diff --git a/frontend/src/i18n/locales/features/public-form/fields/ms-sg.ts b/frontend/src/i18n/locales/features/public-form/fields/ms-sg.ts index d0414f86d5..afbc025432 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/ms-sg.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/ms-sg.ts @@ -45,4 +45,13 @@ export const msSG: PartialDeep = { }, }, }, + calendar: { + today: 'Hari ini', + todayAriaLabel: 'Fokus pada tarikh hari ini', + }, + datePicker: { + selectFromDatePicker: 'Pilih dari pemilih tarikh. ', + selectedDateIs: 'Tarikh yang dipilih ialah {date}.', + invalidDate: 'Tarikh yang dipilih semasa tidak sah.', + }, } diff --git a/frontend/src/i18n/locales/features/public-form/fields/ta-sg.ts b/frontend/src/i18n/locales/features/public-form/fields/ta-sg.ts index 41b8d0dad6..138c59c751 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/ta-sg.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/ta-sg.ts @@ -45,4 +45,13 @@ export const taSG: PartialDeep = { }, }, }, + calendar: { + today: 'இன்று', + todayAriaLabel: 'இன்றைய தேதியைக் கவனியுங்கள்', + }, + datePicker: { + selectFromDatePicker: 'தேதி தேர்வியிலிருந்து தேர்ந்தெடுக்கவும். ', + selectedDateIs: 'தேர்ந்தெடுக்கப்பட்ட தேதி {date}.', + invalidDate: 'தற்போது தேர்ந்தெடுக்கப்பட்ட தேதி தவறானது.', + }, } diff --git a/frontend/src/i18n/locales/features/public-form/fields/zh-sg.ts b/frontend/src/i18n/locales/features/public-form/fields/zh-sg.ts index bdb4a944e9..7f91b9884b 100644 --- a/frontend/src/i18n/locales/features/public-form/fields/zh-sg.ts +++ b/frontend/src/i18n/locales/features/public-form/fields/zh-sg.ts @@ -42,4 +42,13 @@ export const zhSG: PartialDeep = { }, }, }, + calendar: { + today: '今天', + todayAriaLabel: '专注于今天的日期', + }, + datePicker: { + selectFromDatePicker: '从日期选择器中选择。', + selectedDateIs: '选择的日期是 {date}。', + invalidDate: '当前选择的日期无效。', + }, } From 04ccc348a6c2ef67e1dfaad27aec82299492a7b6 Mon Sep 17 00:00:00 2001 From: littlemight Date: Thu, 30 Oct 2025 22:01:12 +0800 Subject: [PATCH 3/6] feat(i18n): extract text from preview form feature --- .../PreviewFormBanner/PreviewFormBanner.tsx | 40 +++++++++---------- .../i18n/locales/features/admin-form/en-sg.ts | 2 + .../i18n/locales/features/admin-form/index.ts | 1 + .../admin-form/preview-form-banner/en-sg.ts | 23 +++++++++++ .../admin-form/preview-form-banner/index.ts | 21 ++++++++++ 5 files changed, 65 insertions(+), 22 deletions(-) create mode 100644 frontend/src/i18n/locales/features/admin-form/preview-form-banner/en-sg.ts create mode 100644 frontend/src/i18n/locales/features/admin-form/preview-form-banner/index.ts diff --git a/frontend/src/features/admin-form/common/components/PreviewFormBanner/PreviewFormBanner.tsx b/frontend/src/features/admin-form/common/components/PreviewFormBanner/PreviewFormBanner.tsx index 755b65c081..d37057d6cf 100644 --- a/frontend/src/features/admin-form/common/components/PreviewFormBanner/PreviewFormBanner.tsx +++ b/frontend/src/features/admin-form/common/components/PreviewFormBanner/PreviewFormBanner.tsx @@ -57,7 +57,10 @@ const textProps: TextProps = { export const PreviewFormBanner = ({ isTemplate, }: PreviewFormBannerProps): JSX.Element => { - const { t } = useTranslation() + const { t } = useTranslation('translation', { + keyPrefix: 'features.adminForm.previewFormBanner', + }) + const { t: tCommon } = useTranslation() const { formId, isPaymentEnabled } = usePublicFormContext() const { data: { secretEnv } = {} } = useEnv() const { @@ -99,7 +102,7 @@ export const PreviewFormBanner = ({ mr={{ base: '0.5rem', md: '1rem' }} /> - {isTemplate ? 'Template Preview' : 'Form Preview'} + {isTemplate ? t('templatePreview') : t('formPreview')} {isTemplate ? ( @@ -111,35 +114,35 @@ export const PreviewFormBanner = ({ > - Back to FormSG + {t('backToFormSG')} } /> ) : ( )} @@ -165,7 +168,7 @@ export const PreviewFormBanner = ({ isFullWidth={true} {...mobileDrawerButtonProps} > - Use this template + {t('useTemplate')} @@ -184,27 +187,20 @@ export const PreviewFormBanner = ({ {secretEnv === 'production' ? ( - To test your payment form, replicate this form on our{' '} + {t('paymentWarning.production.prefix')} - testing platform. + {t('paymentWarning.production.linkText')} ) : ( - - You will not be able to make a test payment, or view submitted - answers or attachments in Form Preview mode. Open your form to - make a test payment or form submission. - + {t('paymentWarning.nonProduction')} )} )} {!isPaymentEnabled && ( {!(secretEnv === 'production') && ( - - You will not be able to view submitted answers or attachments in - Form Preview mode. Open your form to test a form submission. - + {t('previewWarning.withoutPayment')} )} )} diff --git a/frontend/src/i18n/locales/features/admin-form/en-sg.ts b/frontend/src/i18n/locales/features/admin-form/en-sg.ts index 0b4e8df75e..037bfdf9b1 100644 --- a/frontend/src/i18n/locales/features/admin-form/en-sg.ts +++ b/frontend/src/i18n/locales/features/admin-form/en-sg.ts @@ -6,11 +6,13 @@ import { enSG as feedback } from './feedback' import { enSG as meta } from './meta' import { enSG as modals } from './modals' import { enSG as navbar } from './navbar' +import { enSG as previewFormBanner } from './preview-form-banner' import { enSG as settings } from './settings' import { enSG as sidebar } from './sidebar' import { enSG as toasts } from './toasts' export const enSG = { + previewFormBanner, responses: { charts: responsesCharts, components: responsesComponents, diff --git a/frontend/src/i18n/locales/features/admin-form/index.ts b/frontend/src/i18n/locales/features/admin-form/index.ts index 9a6698fdcc..046df6bd7c 100644 --- a/frontend/src/i18n/locales/features/admin-form/index.ts +++ b/frontend/src/i18n/locales/features/admin-form/index.ts @@ -3,6 +3,7 @@ export { type Feedback } from './feedback' export { type Meta } from './meta' export { type Modals } from './modals' export { type Navbar } from './navbar' +export { type PreviewFormBanner } from './preview-form-banner' export { type ResponsesCharts } from './responses/charts' export { type ResponsesComponents } from './responses/components' export { type ResponsesIndividualResponse } from './responses/individual-response' diff --git a/frontend/src/i18n/locales/features/admin-form/preview-form-banner/en-sg.ts b/frontend/src/i18n/locales/features/admin-form/preview-form-banner/en-sg.ts new file mode 100644 index 0000000000..43dc934a86 --- /dev/null +++ b/frontend/src/i18n/locales/features/admin-form/preview-form-banner/en-sg.ts @@ -0,0 +1,23 @@ +import { PreviewFormBanner } from '.' + +export const enSG: PreviewFormBanner = { + templatePreview: 'Template Preview', + formPreview: 'Form Preview', + backToDashboardAriaLabel: 'Click to return to the admin dashboard', + backToFormSG: 'Back to FormSG', + useTemplateAriaLabel: 'Click to use this template', + useTemplate: 'Use this template', + templateActionsAriaLabel: 'Template preview actions', + paymentWarning: { + production: { + prefix: 'To test your payment form, replicate this form on our ', + linkText: 'testing platform.', + }, + nonProduction: + 'You will not be able to make a test payment, or view submitted answers or attachments in Form Preview mode. Open your form to make a test payment or form submission.', + }, + previewWarning: { + withoutPayment: + 'You will not be able to view submitted answers or attachments in Form Preview mode. Open your form to test a form submission.', + }, +} diff --git a/frontend/src/i18n/locales/features/admin-form/preview-form-banner/index.ts b/frontend/src/i18n/locales/features/admin-form/preview-form-banner/index.ts new file mode 100644 index 0000000000..533687e636 --- /dev/null +++ b/frontend/src/i18n/locales/features/admin-form/preview-form-banner/index.ts @@ -0,0 +1,21 @@ +export interface PreviewFormBanner { + templatePreview: string + formPreview: string + backToDashboardAriaLabel: string + backToFormSG: string + useTemplateAriaLabel: string + useTemplate: string + templateActionsAriaLabel: string + paymentWarning: { + production: { + prefix: string + linkText: string + } + nonProduction: string + } + previewWarning: { + withoutPayment: string + } +} + +export * from './en-sg' From 61332ac9d5268cd4b2537e699de3fd286a31c972 Mon Sep 17 00:00:00 2001 From: littlemight Date: Thu, 30 Oct 2025 22:12:57 +0800 Subject: [PATCH 4/6] feat(i18n): extract text for MFB related feature --- .../components/MagicFormBuilderAcceptDeny.tsx | 15 +++-- .../components/MagicFormBuilderButton.tsx | 7 ++- .../MagicFormBuilderPromptModal.tsx | 59 ++++++++++++------- .../MagicFormBuilderSmallButton.tsx | 7 ++- .../i18n/locales/features/admin-form/en-sg.ts | 2 + .../i18n/locales/features/admin-form/index.ts | 1 + .../admin-form/magic-form-builder/en-sg.ts | 55 +++++++++++++++++ .../admin-form/magic-form-builder/index.ts | 48 +++++++++++++++ 8 files changed, 164 insertions(+), 30 deletions(-) create mode 100644 frontend/src/i18n/locales/features/admin-form/magic-form-builder/en-sg.ts create mode 100644 frontend/src/i18n/locales/features/admin-form/magic-form-builder/index.ts diff --git a/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderAcceptDeny.tsx b/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderAcceptDeny.tsx index fde66a59d1..2de2a021c9 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderAcceptDeny.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderAcceptDeny.tsx @@ -1,3 +1,4 @@ +import { useTranslation } from 'react-i18next' import { Flex, Portal, Text } from '@chakra-ui/react' import { NextAndBackButtonGroup } from '~components/Button' @@ -12,20 +13,22 @@ const MagicFormBuilderAcceptDeny = ({ onAccept: () => void onDeny: () => void }) => { + const { t } = useTranslation('translation', { + keyPrefix: 'features.adminForm.magicFormBuilder.acceptDeny', + }) + return isOpen ? ( - - The created fields have been saved. -
- Keep them? + + {t('message')}
diff --git a/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderButton.tsx b/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderButton.tsx index e5ac5a0f6a..3efb43a0b6 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderButton.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderButton.tsx @@ -1,3 +1,4 @@ +import { useTranslation } from 'react-i18next' import { BiSolidMagicWand } from 'react-icons/bi' import Button from '~components/Button' @@ -7,6 +8,10 @@ const MagicFormBuilderButton = ({ }: { onClick: () => void }): JSX.Element => { + const { t } = useTranslation('translation', { + keyPrefix: 'features.adminForm.magicFormBuilder.button', + }) + return ( ) } diff --git a/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderPromptModal.tsx b/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderPromptModal.tsx index db3df4aaee..84b774b643 100644 --- a/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderPromptModal.tsx +++ b/frontend/src/features/admin-form/create/builder-and-design/MagicFormBuilder/components/MagicFormBuilderPromptModal.tsx @@ -9,6 +9,7 @@ import { UseFormSetError, UseFormSetValue, } from 'react-hook-form' +import { useTranslation } from 'react-i18next' import { BiSolidMagicWand } from 'react-icons/bi' import { Box, @@ -75,9 +76,13 @@ const PromptSelectorBar = ({ }[] onClick: (prompt: string) => void }) => { + const { t } = useTranslation('translation', { + keyPrefix: 'features.adminForm.magicFormBuilder.promptModal.textTab', + }) + return ( - Need inspiration? Try one of these: + {t('inspirationLabel')} errors: FieldErrors }) => { + const { t } = useTranslation('translation', { + keyPrefix: 'features.adminForm.magicFormBuilder.promptModal.textTab', + }) + return ( <> - - I want to create a form that collects... - + {t('promptLabel')}