From a4347094bca298c97c795406d843c5734d398664 Mon Sep 17 00:00:00 2001 From: krishna2323 Date: Wed, 13 Nov 2024 04:13:00 +0530 Subject: [PATCH] fix: Web - Chat - Error message not translated when changing language Signed-off-by: krishna2323 --- src/components/PDFView/PDFPasswordForm.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/components/PDFView/PDFPasswordForm.tsx b/src/components/PDFView/PDFPasswordForm.tsx index 4b6491addbef..d37bd4d0f87b 100644 --- a/src/components/PDFView/PDFPasswordForm.tsx +++ b/src/components/PDFView/PDFPasswordForm.tsx @@ -11,6 +11,7 @@ import useThemeStyles from '@hooks/useThemeStyles'; import * as Browser from '@libs/Browser'; import shouldDelayFocus from '@libs/shouldDelayFocus'; import CONST from '@src/CONST'; +import type {TranslationPaths} from '@src/languages/types'; import PDFInfoMessage from './PDFInfoMessage'; type PDFPasswordFormProps = { @@ -39,7 +40,7 @@ function PDFPasswordForm({isFocused, isPasswordInvalid = false, shouldShowLoadin const {translate} = useLocalize(); const [password, setPassword] = useState(''); - const [validationErrorText, setValidationErrorText] = useState(''); + const [validationErrorText, setValidationErrorText] = useState(''); const [shouldShowForm, setShouldShowForm] = useState(false); const textInputRef = useRef(null); @@ -50,7 +51,7 @@ function PDFPasswordForm({isFocused, isPasswordInvalid = false, shouldShowLoadin return translate('attachmentView.passwordIncorrect'); } if (validationErrorText) { - return validationErrorText; + return translate(validationErrorText); } return ''; }, [isPasswordInvalid, validationErrorText, translate]); @@ -90,7 +91,7 @@ function PDFPasswordForm({isFocused, isPasswordInvalid = false, shouldShowLoadin return true; } if (!password) { - setValidationErrorText(translate('attachmentView.passwordRequired')); + setValidationErrorText('attachmentView.passwordRequired'); } return false; };