Skip to content

Commit 1f4849c

Browse files
committed
adjust loginform error translation handling, remove extra translation
1 parent c2a24f6 commit 1f4849c

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

client/modules/User/components/LoginForm.jsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ function LoginForm() {
2424

2525
useSyncFormTranslations(formRef, i18n.language);
2626

27-
const translateSubmitError = (error) => {
28-
const errorMessages = {
29-
'Invalid credentials': t('LoginForm.Errors.invalidCredentials'),
30-
'Invalid username or password.': t('LoginForm.Errors.invalidCredentials'),
31-
'Network error': t('LoginForm.Errors.networkError')
32-
// Add more mappings as needed
33-
};
34-
return errorMessages[error] || error; // Fallback to the original error if no translation is found
35-
};
36-
3727
return (
3828
<Form
3929
fields={['email', 'password']}
@@ -112,8 +102,7 @@ function LoginForm() {
112102
</Field>
113103
{submitError && !modifiedSinceLastSubmit && (
114104
<span className="form-error">
115-
{' '}
116-
{translateSubmitError(submitError)}
105+
{t('LoginForm.Errors.invalidCredentials')}
117106
</span>
118107
)}
119108
<Button type="submit" disabled={submitting}>

translations/locales/be/translations.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@
6969
"PasswordARIA": "পাসওয়ার্ড",
7070
"Submit": "লগ ইন করুন",
7171
"Errors": {
72-
"invalidCredentials": "অবৈধ ইমেল বা পাসওয়ার্ড।",
73-
"networkError": "নেটওয়ার্ক ত্রুটি। অনুগ্রহ করে পরে আবার চেষ্টা করুন।"
72+
"invalidCredentials": "অবৈধ ইমেল বা পাসওয়ার্ড।"
7473
}
7574
},
7675
"LoginView": {

translations/locales/en-US/translations.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@
6969
"PasswordARIA": "Password",
7070
"Submit": "Log In",
7171
"Errors": {
72-
"invalidCredentials": "Invalid email or password.",
73-
"networkError": "Network error. Please try again later."
72+
"invalidCredentials": "Invalid email or password."
7473
}
7574
},
7675
"LoginView": {

translations/locales/hi/translations.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@
6969
"PasswordARIA": "पासवर्ड",
7070
"Submit": "लॉग इन",
7171
"Errors": {
72-
"invalidCredentials": "अमान्य ईमेल या पासवर्ड।",
73-
"networkError": "नेटवर्क त्रुटि। कृपया बाद में पुनः प्रयास करें।"
72+
"invalidCredentials": "अमान्य ईमेल या पासवर्ड।"
7473
}
7574
},
7675
"LoginView": {

0 commit comments

Comments
 (0)