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: Login – Please enter an email or phone number is not is not displayed in Spanish. #45989

Merged
merged 1 commit into from
Jul 26, 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
13 changes: 7 additions & 6 deletions src/pages/signin/LoginForm/BaseLoginForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import * as CloseAccount from '@userActions/CloseAccount';
import * as Session from '@userActions/Session';
import CONFIG from '@src/CONFIG';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import ONYXKEYS from '@src/ONYXKEYS';
import type {CloseAccountForm} from '@src/types/form';
import type {Account, Credentials} from '@src/types/onyx';
Expand Down Expand Up @@ -59,7 +60,7 @@ function BaseLoginForm({account, credentials, closeAccount, blurOnSubmit = false
const {translate} = useLocalize();
const input = useRef<BaseTextInputRef | null>(null);
const [login, setLogin] = useState(() => Str.removeSMSDomain(credentials?.login ?? ''));
const [formError, setFormError] = useState<string | undefined>();
const [formError, setFormError] = useState<TranslationPaths | undefined>();
const prevIsVisible = usePrevious(isVisible);
const firstBlurred = useRef(false);
const isFocused = useIsFocused();
Expand All @@ -73,7 +74,7 @@ function BaseLoginForm({account, credentials, closeAccount, blurOnSubmit = false
(value: string) => {
const loginTrim = value.trim();
if (!loginTrim) {
setFormError(translate('common.pleaseEnterEmailOrPhoneNumber'));
setFormError('common.pleaseEnterEmailOrPhoneNumber');
return false;
}

Expand All @@ -82,17 +83,17 @@ function BaseLoginForm({account, credentials, closeAccount, blurOnSubmit = false

if (!Str.isValidEmail(loginTrim) && !parsedPhoneNumber.possible) {
if (ValidationUtils.isNumericWithSpecialChars(loginTrim)) {
setFormError(translate('common.error.phoneNumber'));
setFormError('common.error.phoneNumber');
} else {
setFormError(translate('loginForm.error.invalidFormatEmailLogin'));
setFormError('loginForm.error.invalidFormatEmailLogin');
}
return false;
}

setFormError(undefined);
return true;
},
[setFormError, translate],
[setFormError],
);

/**
Expand Down Expand Up @@ -268,7 +269,7 @@ function BaseLoginForm({account, credentials, closeAccount, blurOnSubmit = false
autoCapitalize="none"
autoCorrect={false}
inputMode={CONST.INPUT_MODE.EMAIL}
errorText={formError}
errorText={formError ? translate(formError) : undefined}
hasError={shouldShowServerError}
maxLength={CONST.LOGIN_CHARACTER_LIMIT}
/>
Expand Down
Loading