Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Web - Chat - Error message not translated when changing language #52435

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading