Skip to content

Commit 59545a4

Browse files
authored
Merge pull request #34 from CreateThrive/feature/internationalize-error-messages
Feature: Internationalized error messages
2 parents 63181a7 + 065fbd9 commit 59545a4

File tree

23 files changed

+330
-77
lines changed

23 files changed

+330
-77
lines changed

src/components/DatePicker/__snapshots__/DatePicker.test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ exports[`<DatePickerStyled /> rendering should render without crashing 1`] = `
9797
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
9898
"Users.search": "Search:",
9999
"Users.users": "Users",
100+
"auth/email-already-exists": "Email already in use",
101+
"auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
102+
"auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
103+
"auth/invalid-email": "Email is invalid",
104+
"auth/too-many-requests": "Too many attempts made, try again later",
105+
"auth/user-disabled": "User disabled",
106+
"auth/wrong-password": "Invalid credentials",
107+
"storage/quota-exceeded": "Internal server error, get in touch with your administrator",
108+
"storage/unauthenticated": "Unauthenticated, please authenticate and try again",
109+
"storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
110+
"utils.default": "Unknown error, get in touch with your administrator",
111+
"utils.invalidEmail": "Invalid email",
112+
"utils.safePassword": "Safe password",
113+
"utils.unsafePassword": "Unsafe password",
100114
},
101115
"onError": [Function],
102116
"textComponent": Symbol(react.fragment),

src/components/Layout/__snapshots__/Layout.test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ exports[`<Layout /> rendering should render without crashing 1`] = `
9797
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
9898
"Users.search": "Search:",
9999
"Users.users": "Users",
100+
"auth/email-already-exists": "Email already in use",
101+
"auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
102+
"auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
103+
"auth/invalid-email": "Email is invalid",
104+
"auth/too-many-requests": "Too many attempts made, try again later",
105+
"auth/user-disabled": "User disabled",
106+
"auth/wrong-password": "Invalid credentials",
107+
"storage/quota-exceeded": "Internal server error, get in touch with your administrator",
108+
"storage/unauthenticated": "Unauthenticated, please authenticate and try again",
109+
"storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
110+
"utils.default": "Unknown error, get in touch with your administrator",
111+
"utils.invalidEmail": "Invalid email",
112+
"utils.safePassword": "Safe password",
113+
"utils.unsafePassword": "Unsafe password",
100114
},
101115
"onError": [Function],
102116
"textComponent": Symbol(react.fragment),

src/components/Navigation/Aside/__snapshots__/Aside.test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,20 @@ Object {
9898
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
9999
"Users.search": "Search:",
100100
"Users.users": "Users",
101+
"auth/email-already-exists": "Email already in use",
102+
"auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
103+
"auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
104+
"auth/invalid-email": "Email is invalid",
105+
"auth/too-many-requests": "Too many attempts made, try again later",
106+
"auth/user-disabled": "User disabled",
107+
"auth/wrong-password": "Invalid credentials",
108+
"storage/quota-exceeded": "Internal server error, get in touch with your administrator",
109+
"storage/unauthenticated": "Unauthenticated, please authenticate and try again",
110+
"storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
111+
"utils.default": "Unknown error, get in touch with your administrator",
112+
"utils.invalidEmail": "Invalid email",
113+
"utils.safePassword": "Safe password",
114+
"utils.unsafePassword": "Unsafe password",
101115
},
102116
"onError": [Function],
103117
"textComponent": Symbol(react.fragment),

src/components/Navigation/NavBar/__snapshots__/NavBar.test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ exports[`<NavBar /> rendering should render without crashing 1`] = `
9797
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
9898
"Users.search": "Search:",
9999
"Users.users": "Users",
100+
"auth/email-already-exists": "Email already in use",
101+
"auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
102+
"auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
103+
"auth/invalid-email": "Email is invalid",
104+
"auth/too-many-requests": "Too many attempts made, try again later",
105+
"auth/user-disabled": "User disabled",
106+
"auth/wrong-password": "Invalid credentials",
107+
"storage/quota-exceeded": "Internal server error, get in touch with your administrator",
108+
"storage/unauthenticated": "Unauthenticated, please authenticate and try again",
109+
"storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
110+
"utils.default": "Unknown error, get in touch with your administrator",
111+
"utils.invalidEmail": "Invalid email",
112+
"utils.safePassword": "Safe password",
113+
"utils.unsafePassword": "Unsafe password",
100114
},
101115
"onError": [Function],
102116
"textComponent": Symbol(react.fragment),

src/components/UserForm/__snapshots__/UserForm.test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,20 @@ exports[`<UserForm /> rendering should render without crashing 1`] = `
9797
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
9898
"Users.search": "Search:",
9999
"Users.users": "Users",
100+
"auth/email-already-exists": "Email already in use",
101+
"auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
102+
"auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
103+
"auth/invalid-email": "Email is invalid",
104+
"auth/too-many-requests": "Too many attempts made, try again later",
105+
"auth/user-disabled": "User disabled",
106+
"auth/wrong-password": "Invalid credentials",
107+
"storage/quota-exceeded": "Internal server error, get in touch with your administrator",
108+
"storage/unauthenticated": "Unauthenticated, please authenticate and try again",
109+
"storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
110+
"utils.default": "Unknown error, get in touch with your administrator",
111+
"utils.invalidEmail": "Invalid email",
112+
"utils.safePassword": "Safe password",
113+
"utils.unsafePassword": "Unsafe password",
100114
},
101115
"onError": [Function],
102116
"textComponent": Symbol(react.fragment),

src/languages/en.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,19 @@
6666
"UserForm.pickFile": "Pick a file",
6767
"UserForm.submit": "Submit",
6868
"UserForm.goBack": "Go Back",
69-
"UserForm.userPreview": "User Preview"
69+
"UserForm.userPreview": "User Preview",
70+
"auth/email-already-exists": "Email already in use",
71+
"auth/invalid-email": "Email is invalid",
72+
"auth/wrong-password": "Invalid credentials",
73+
"auth/user-disabled": "User disabled",
74+
"auth/too-many-requests": "Too many attempts made, try again later",
75+
"auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
76+
"auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
77+
"storage/quota-exceeded": "Internal server error, get in touch with your administrator",
78+
"storage/unauthenticated": "Unauthenticated, please authenticate and try again",
79+
"storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
80+
"utils.default": "Unknown error, get in touch with your administrator",
81+
"utils.safePassword": "Safe password",
82+
"utils.unsafePassword": "Unsafe password",
83+
"utils.invalidEmail": "Invalid email"
7084
}

src/languages/es.json

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,19 @@
6666
"UserForm.pickFile": "Elige un archivo",
6767
"UserForm.submit": "Enviar",
6868
"UserForm.goBack": "Regresar",
69-
"UserForm.userPreview": "Vista previa del usuario"
69+
"UserForm.userPreview": "Vista previa del usuario",
70+
"auth/email-already-exists": "Email ya esta siendo usado",
71+
"auth/invalid-email": "El Email inválido",
72+
"auth/wrong-password": "Credenciales inválidas",
73+
"auth/user-disabled": "Usuario deshabilitado",
74+
"auth/too-many-requests": "Demasiados intentos, intententelo más tarde",
75+
"auth/expired-action-code": "El link de invitación expiró, contáctese con su administrador",
76+
"auth/invalid-action-code": "El link de invitación expiró, contáctese con su administrador",
77+
"storage/quota-exceeded": "Error interno del servidor, contáctese con su administrador",
78+
"storage/unauthenticated": "Sin autenticación, por favor autentíquese e intente de nuevo",
79+
"storage/unauthorized": "Sin autorización, no se encuentra autorizado para realizar esta acción",
80+
"utils.default": "Error desconocido, contáctese con su administrador",
81+
"utils.safePassword": "Contraseña segura",
82+
"utils.unsafePassword": "Contraseña insegura",
83+
"utils.invalidEmail": "Email inválido"
7084
}

src/pages/Home/__snapshots__/Home.test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ exports[`<Home /> rendering should render without crashing 1`] = `
7676
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
7777
"Users.search": "Search:",
7878
"Users.users": "Users",
79+
"auth/email-already-exists": "Email already in use",
80+
"auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
81+
"auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
82+
"auth/invalid-email": "Email is invalid",
83+
"auth/too-many-requests": "Too many attempts made, try again later",
84+
"auth/user-disabled": "User disabled",
85+
"auth/wrong-password": "Invalid credentials",
86+
"storage/quota-exceeded": "Internal server error, get in touch with your administrator",
87+
"storage/unauthenticated": "Unauthenticated, please authenticate and try again",
88+
"storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
89+
"utils.default": "Unknown error, get in touch with your administrator",
90+
"utils.invalidEmail": "Invalid email",
91+
"utils.safePassword": "Safe password",
92+
"utils.unsafePassword": "Unsafe password",
7993
}
8094
}
8195
onError={[Function]}

src/pages/Login/__snapshots__/Login.test.js.snap

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,20 @@ exports[`<Login /> rendering should render without crashing 1`] = `
7676
"Users.permDelete": "This will permanently delete the user. Action can not be undone.",
7777
"Users.search": "Search:",
7878
"Users.users": "Users",
79+
"auth/email-already-exists": "Email already in use",
80+
"auth/expired-action-code": "The invitation link has expired, get in touch with your administrator",
81+
"auth/invalid-action-code": "The invitation link has expired, get in touch with your administrator",
82+
"auth/invalid-email": "Email is invalid",
83+
"auth/too-many-requests": "Too many attempts made, try again later",
84+
"auth/user-disabled": "User disabled",
85+
"auth/wrong-password": "Invalid credentials",
86+
"storage/quota-exceeded": "Internal server error, get in touch with your administrator",
87+
"storage/unauthenticated": "Unauthenticated, please authenticate and try again",
88+
"storage/unauthorized": "Unauthorized, you are not authorized to perform this action",
89+
"utils.default": "Unknown error, get in touch with your administrator",
90+
"utils.invalidEmail": "Invalid email",
91+
"utils.safePassword": "Safe password",
92+
"utils.unsafePassword": "Unsafe password",
7993
}
8094
}
8195
onError={[Function]}

src/pages/Login/index.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@ import paths from '../Router/paths';
1010
import classes from './Login.module.scss';
1111

1212
const Login = () => {
13-
const { error, isAuth, loading } = useSelector(
13+
const { error, isAuth, loading, locale } = useSelector(
1414
state => ({
1515
error: state.auth.error,
1616
isAuth: !!state.auth.userData.id,
17-
loading: state.auth.loading
17+
loading: state.auth.loading,
18+
locale: state.preferences.locale
1819
}),
1920
shallowEqual
2021
);
@@ -61,7 +62,7 @@ const Login = () => {
6162
const modifierLoading = loading && 'is-loading';
6263

6364
const inputs = isEmailLink
64-
? inputValidations(authData.email, authData.password)
65+
? inputValidations(authData.email, authData.password, locale)
6566
: {
6667
email: {
6768
modifier: null,

0 commit comments

Comments
 (0)