Skip to content

Commit cf2e414

Browse files
author
Guillermo Machado
committed
fix: add localized labels
1 parent 899985e commit cf2e414

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

src/app/update-password.tsx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,25 @@ import { KeyboardAvoidingView } from 'react-native-keyboard-controller';
88
import { z } from 'zod';
99

1010
import { useUpdatePassword } from '@/api/auth/use-update-password';
11+
import { translate } from '@/core';
1112
import { Button, ControlledInput, FocusAwareStatusBar, Text, View } from '@/ui';
1213

1314
type FormValues = { password: string; passwordConfirmation: string };
14-
const SIX = 6;
15+
const MIN_CHARS = 6;
1516

1617
const schema = z
1718
.object({
18-
password: z
19-
.string()
20-
.min(SIX, 'Password must be at least 6 characters long'),
19+
password: z.string().min(
20+
MIN_CHARS,
21+
translate('updatePassword.error.shortPassword', {
22+
minChars: MIN_CHARS,
23+
}),
24+
),
2125
passwordConfirmation: z.string(),
2226
})
2327
.refine((data) => data.password === data.passwordConfirmation, {
24-
message: 'Passwords must match',
25-
path: ['confirmPassword'],
28+
message: translate('updatePassword.error.passwordsMustMatch'),
29+
path: ['passwordConfirmation'],
2630
});
2731

2832
export default function UpdatePassword() {

src/translations/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@
108108
"confirmPasswordLabel": "Confirm Password",
109109
"confirmPasswordPlaceholder": "Re-enter new password",
110110
"description": "Enter a new password for your account.",
111+
"error": {
112+
"passwordsMustMatch": "Passwords must match",
113+
"shortPassword": "Password must be at least {{minChars}} characters"
114+
},
111115
"errorMessage": "An error occurred while updating your password. Please try again.",
112116
"passwordLabel": "New Password",
113117
"passwordPlaceholder": "Enter new password",

0 commit comments

Comments
 (0)