Skip to content

Commit

Permalink
fix: Web - Chat - Error message not translated when changing language
Browse files Browse the repository at this point in the history
Signed-off-by: krishna2323 <belivethatkg@gmail.com>
  • Loading branch information
Krishna2323 committed Nov 12, 2024
1 parent 3023d60 commit a434709
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/components/PDFView/PDFPasswordForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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<TranslationPaths | null | ''>('');
const [shouldShowForm, setShouldShowForm] = useState(false);
const textInputRef = useRef<BaseTextInputRef>(null);

Expand All @@ -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]);
Expand Down Expand Up @@ -90,7 +91,7 @@ function PDFPasswordForm({isFocused, isPasswordInvalid = false, shouldShowLoadin
return true;
}
if (!password) {
setValidationErrorText(translate('attachmentView.passwordRequired'));
setValidationErrorText('attachmentView.passwordRequired');
}
return false;
};
Expand Down

0 comments on commit a434709

Please sign in to comment.