Skip to content

Commit

Permalink
Merge pull request Expensify#52435 from Krishna2323/krishna2323/issue…
Browse files Browse the repository at this point in the history
…/52216

fix: Web - Chat - Error message not translated when changing language
  • Loading branch information
techievivek authored Nov 19, 2024
2 parents cc53f0e + a434709 commit f77087f
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 f77087f

Please sign in to comment.