diff --git a/frontend/src/components/Field/Attachment/Attachment.tsx b/frontend/src/components/Field/Attachment/Attachment.tsx index 33af6f189c..62db491870 100644 --- a/frontend/src/components/Field/Attachment/Attachment.tsx +++ b/frontend/src/components/Field/Attachment/Attachment.tsx @@ -14,6 +14,7 @@ import omit from 'lodash/omit' import simplur from 'simplur' import { MB } from '~shared/constants/file' +import { Language } from '~shared/types' import { ATTACHMENT_THEME_KEY } from '~theme/components/Field/Attachment' import { ThemeColorScheme } from '~theme/foundations/colours' @@ -22,6 +23,7 @@ import { downloadFile } from './utils/downloadFile' import { AttachmentStylesProvider } from './AttachmentContext' import { AttachmentDropzone } from './AttachmentDropzone' import { AttachmentFileInfo } from './AttachmentFileInfo' +import { MAXIMUM_FILE_LABEL_TRANSLATIONS } from './constants' import { getFileExtension, getInvalidFileExtensionsInZip, @@ -99,6 +101,11 @@ export interface AttachmentProps extends UseFormControlProps { * Override callback function that is invoked when remove button is clicked. */ handleRemoveFileOverride?: () => void + + /** + * Selected language used for default labels + */ + selectedLanguage?: Language } export const Attachment = forwardRef( @@ -119,6 +126,7 @@ export const Attachment = forwardRef( isRemoveDisabled, handleDownloadFileOverride, handleRemoveFileOverride, + selectedLanguage = Language.ENGLISH, ...props }, ref, @@ -320,7 +328,8 @@ export const Attachment = forwardRef( textStyle="body-2" aria-hidden > - Maximum file size: {readableMaxSize} + {MAXIMUM_FILE_LABEL_TRANSLATIONS[selectedLanguage]}{' '} + {readableMaxSize} ) : null} diff --git a/frontend/src/components/Field/Attachment/constants.ts b/frontend/src/components/Field/Attachment/constants.ts new file mode 100644 index 0000000000..fe959ce623 --- /dev/null +++ b/frontend/src/components/Field/Attachment/constants.ts @@ -0,0 +1,8 @@ +import { Language } from '~shared/types' + +export const MAXIMUM_FILE_LABEL_TRANSLATIONS: Record = { + [Language.ENGLISH]: 'Maximum file size:', + [Language.CHINESE]: '文件限制:不超过', + [Language.MALAY]: 'Saiz fail maksimum:', + [Language.TAMIL]: 'கோப்பின் அதிகபட்ச அளவு:', +} diff --git a/frontend/src/templates/Field/Attachment/AttachmentField.tsx b/frontend/src/templates/Field/Attachment/AttachmentField.tsx index 543cd3d8dd..c3588063b5 100644 --- a/frontend/src/templates/Field/Attachment/AttachmentField.tsx +++ b/frontend/src/templates/Field/Attachment/AttachmentField.tsx @@ -121,6 +121,7 @@ export const AttachmentField = ({ title={`${schema.questionNumber}. ${schema.title}`} showDownload={showDownload} showRemove={!schema.disabled} + selectedLanguage={selectedLanguage} /> )} name={fieldName}