Add translations
This commit is contained in:
parent
ab6a6ad5df
commit
498a85b9f2
@ -82,7 +82,9 @@
|
|||||||
"loginBtn": "Login",
|
"loginBtn": "Login",
|
||||||
"loginGoogle": "Login with Google",
|
"loginGoogle": "Login with Google",
|
||||||
"noAccount": "Don't have an account yet?",
|
"noAccount": "Don't have an account yet?",
|
||||||
"register": "Register"
|
"register": "Register",
|
||||||
|
"emailFormat": "Invalid email format",
|
||||||
|
"passwordMin": "Password must be at least 8 characters long"
|
||||||
},
|
},
|
||||||
"forgotPasswordEmail": {
|
"forgotPasswordEmail": {
|
||||||
"enter": "Enter email",
|
"enter": "Enter email",
|
||||||
@ -104,5 +106,17 @@
|
|||||||
"incorrect": "Incorrect code",
|
"incorrect": "Incorrect code",
|
||||||
"serverError": "Error on the server side",
|
"serverError": "Error on the server side",
|
||||||
"errorOccured": "An unexpected error occurred"
|
"errorOccured": "An unexpected error occurred"
|
||||||
|
},
|
||||||
|
"resetCode": {
|
||||||
|
"enterPassword": "Enter new password",
|
||||||
|
"passInfo": "Password must contain at least 8 characters, 1 capital letter and a number",
|
||||||
|
"enterPass": "Enter password",
|
||||||
|
"repeatPassword": "Repeat password",
|
||||||
|
"repeatPass": "Repeat new password",
|
||||||
|
"save": "Save",
|
||||||
|
"noMatch": "Passwords do not match",
|
||||||
|
"serverError": "Error on the server side",
|
||||||
|
"noPassword": "Weak password, please avoid obvious passwords",
|
||||||
|
"errorOccured": "An unexpected error occurred"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,9 @@
|
|||||||
"loginBtn": "Кирүү",
|
"loginBtn": "Кирүү",
|
||||||
"loginGoogle": "Google аркылуу кируңуз",
|
"loginGoogle": "Google аркылуу кируңуз",
|
||||||
"noAccount": "Аккаунт жок?",
|
"noAccount": "Аккаунт жок?",
|
||||||
"register": "Каттоо"
|
"register": "Каттоо",
|
||||||
|
"emailFormat": "Электрондук почта форматы жараксыз",
|
||||||
|
"passwordMin": "Сырсөз кеминде 8 белгиден турушу керек"
|
||||||
},
|
},
|
||||||
"forgotPasswordEmail": {
|
"forgotPasswordEmail": {
|
||||||
"enter": "Электрондук почтаны киргизиңиз",
|
"enter": "Электрондук почтаны киргизиңиз",
|
||||||
@ -104,5 +106,17 @@
|
|||||||
"incorrect": "Код туура эмес",
|
"incorrect": "Код туура эмес",
|
||||||
"serverError": "Сервер тараптагы ката",
|
"serverError": "Сервер тараптагы ката",
|
||||||
"errorOccured": "Күтүлбөгөн ката кетти"
|
"errorOccured": "Күтүлбөгөн ката кетти"
|
||||||
|
},
|
||||||
|
"resetCode": {
|
||||||
|
"enterPassword": "Жаңы сырсөздү киргизиңиз",
|
||||||
|
"passInfo": "Сырсөз кеминде 8 белгиден, 1 баш тамгадан жана сандан турушу керек",
|
||||||
|
"enterPass": "Сырсөздү киргизиңиз",
|
||||||
|
"repeatPassword": "Паролду кайталоо",
|
||||||
|
"repeatPass": "Жаңы сырсөздү кайталоо",
|
||||||
|
"save": "Сактоо",
|
||||||
|
"noMatch": "Сырсөздөр дал келбейт",
|
||||||
|
"serverError": "Сервер тараптагы ката",
|
||||||
|
"noPassword": "Начар сырсөз, ачык сырсөздөрдү колдонбоңуз",
|
||||||
|
"errorOccured": "Күтүлбөгөн ката кетти"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,9 @@
|
|||||||
"loginBtn": "Войти",
|
"loginBtn": "Войти",
|
||||||
"loginGoogle": "Войти через Google",
|
"loginGoogle": "Войти через Google",
|
||||||
"noAccount": "Еще нет аккаунта?",
|
"noAccount": "Еще нет аккаунта?",
|
||||||
"register": "Зарегистрируйтесь"
|
"register": "Зарегистрируйтесь",
|
||||||
|
"emailFormat": "Неверный формат email",
|
||||||
|
"passwordMin": "Пароль должен содержать минимум 8 символов"
|
||||||
},
|
},
|
||||||
"forgotPasswordEmail": {
|
"forgotPasswordEmail": {
|
||||||
"enter": "Введите email",
|
"enter": "Введите email",
|
||||||
@ -95,5 +97,17 @@
|
|||||||
"incorrect": "Неверный код",
|
"incorrect": "Неверный код",
|
||||||
"serverError": "Ошибка на стороне сервера",
|
"serverError": "Ошибка на стороне сервера",
|
||||||
"errorOccured": "Произошла непредвиденная ошибка"
|
"errorOccured": "Произошла непредвиденная ошибка"
|
||||||
|
},
|
||||||
|
"resetCode": {
|
||||||
|
"enterPassword": "Введите новый пароль",
|
||||||
|
"passInfo": "Пароль должен содерждать минимум 8 символов, 1 заглавная буква и цифра",
|
||||||
|
"enterPass": "Введите пароль",
|
||||||
|
"repeatPassword": "Повторите пароль",
|
||||||
|
"repeatPass": "Повторите новый пароль",
|
||||||
|
"save": "Сохранить",
|
||||||
|
"noMatch": "Пароли не совпадают",
|
||||||
|
"serverError": "Ошибка на стороне сервера",
|
||||||
|
"noPassword": "Слабый пароль, прошу избегайте очевидных паролей",
|
||||||
|
"errorOccured": "Произошла непредвиденная ошибка"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import key from "./icons/key.svg";
|
import key from "./icons/key.svg";
|
||||||
import ResetCodeForm from "@/widgets/forms/ResetCodeForm";
|
import ResetCodeForm from "@/widgets/forms/ResetCodeForm";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const ResetCode = () => {
|
const ResetCode = () => {
|
||||||
|
const t = useTranslations("resetCode");
|
||||||
return (
|
return (
|
||||||
<div className="h-full min-h-[800px] flex justify-center w-full ">
|
<div className="h-full min-h-[800px] flex justify-center w-full ">
|
||||||
<div className="flex flex-col items-center gap-6">
|
<div className="flex flex-col items-center gap-6">
|
||||||
@ -12,12 +14,9 @@ const ResetCode = () => {
|
|||||||
|
|
||||||
<div className="mb-2 flex flex-col items-center gap-2 text-center">
|
<div className="mb-2 flex flex-col items-center gap-2 text-center">
|
||||||
<h2 className="text-[24px] font-bold leading-8 text-gray-900">
|
<h2 className="text-[24px] font-bold leading-8 text-gray-900">
|
||||||
Введите новый пароль
|
{t("enterPassword")}
|
||||||
</h2>
|
</h2>
|
||||||
<p className="leading-6 text-gray-500">
|
<p className="leading-6 text-gray-500">{t("passInfo")}</p>
|
||||||
Пароль должен содерждать минимум 8 символов, 1 заглавная буква и
|
|
||||||
цифра
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ResetCodeForm />
|
<ResetCodeForm />
|
||||||
|
@ -14,11 +14,10 @@ import Image from "next/image";
|
|||||||
import eye_off from "./icons/eye-off.svg";
|
import eye_off from "./icons/eye-off.svg";
|
||||||
import eye_on from "./icons/eye-on.svg";
|
import eye_on from "./icons/eye-on.svg";
|
||||||
import alert from "./icons/alert-circle.svg";
|
import alert from "./icons/alert-circle.svg";
|
||||||
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
const ResetCodeForm = () => {
|
const ResetCodeForm = () => {
|
||||||
const [passwordWarning, setPasswordWarning] = useState<string>("");
|
const t = useTranslations("resetCode");
|
||||||
const [passwordConfirmWarning, setPasswordConfirmWarning] =
|
|
||||||
useState<string>("");
|
|
||||||
const [error, setError] = useState<string>("");
|
const [error, setError] = useState<string>("");
|
||||||
const [loader, setLoader] = useState<boolean>(false);
|
const [loader, setLoader] = useState<boolean>(false);
|
||||||
const [showPasswordOne, setShowPasswordOne] = useState(false);
|
const [showPasswordOne, setShowPasswordOne] = useState(false);
|
||||||
@ -28,15 +27,11 @@ const ResetCodeForm = () => {
|
|||||||
|
|
||||||
const resetCodeFormScheme = z
|
const resetCodeFormScheme = z
|
||||||
.object({
|
.object({
|
||||||
new_password1: z
|
new_password1: z.string().min(8, t("passInfo")),
|
||||||
.string()
|
new_password2: z.string().min(8, t("passInfo")),
|
||||||
.min(8, "Пароль должен содержать минимум 8 символов"),
|
|
||||||
new_password2: z
|
|
||||||
.string()
|
|
||||||
.min(8, "Пароль должен содержать минимум 8 символов"),
|
|
||||||
})
|
})
|
||||||
.refine((data) => data.new_password1 === data.new_password2, {
|
.refine((data) => data.new_password1 === data.new_password2, {
|
||||||
message: "Пароли не совпадают",
|
message: t("noMatch"),
|
||||||
path: ["new_password2"],
|
path: ["new_password2"],
|
||||||
});
|
});
|
||||||
type FormFields = z.infer<typeof resetCodeFormScheme>;
|
type FormFields = z.infer<typeof resetCodeFormScheme>;
|
||||||
@ -81,12 +76,12 @@ const ResetCodeForm = () => {
|
|||||||
if (
|
if (
|
||||||
[500, 501, 502, 503, 504].includes(error.response?.status as number)
|
[500, 501, 502, 503, 504].includes(error.response?.status as number)
|
||||||
) {
|
) {
|
||||||
setError("Ошибка на стороне сервера");
|
setError(t("serverError"));
|
||||||
} else if ([400, 404].includes(error.response?.status as number)) {
|
} else if ([400, 404].includes(error.response?.status as number)) {
|
||||||
setError("Слабый пароль, прошу избегайте очевидных паролей");
|
setError(t("noPassword"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
setError("Произошла непредвиденная ошибка");
|
setError(t("errorOccured"));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
setLoader(false);
|
setLoader(false);
|
||||||
@ -98,7 +93,7 @@ const ResetCodeForm = () => {
|
|||||||
<div className="flex flex-col gap-8">
|
<div className="flex flex-col gap-8">
|
||||||
<div>
|
<div>
|
||||||
<label className="text-[14px] leading-5 text-gray-700">
|
<label className="text-[14px] leading-5 text-gray-700">
|
||||||
Введите пароль
|
{t("enterPass")}
|
||||||
</label>
|
</label>
|
||||||
<div
|
<div
|
||||||
className={`flex items-center border border-gray-300 rounded-lg shadow-sm bg-white${
|
className={`flex items-center border border-gray-300 rounded-lg shadow-sm bg-white${
|
||||||
@ -106,7 +101,7 @@ const ResetCodeForm = () => {
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
placeholder="Введите новый пароль"
|
placeholder={t("enterPassword")}
|
||||||
className="w-full text-[16px] leading-6 text-gray-900 px-[10px] py-[14px]"
|
className="w-full text-[16px] leading-6 text-gray-900 px-[10px] py-[14px]"
|
||||||
type={showPasswordOne ? "text" : "password"}
|
type={showPasswordOne ? "text" : "password"}
|
||||||
{...register("new_password1", { required: true })}
|
{...register("new_password1", { required: true })}
|
||||||
@ -128,7 +123,7 @@ const ResetCodeForm = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label className="text-[14px] leading-5 text-gray-700">
|
<label className="text-[14px] leading-5 text-gray-700">
|
||||||
Повторите пароль
|
{t("repeatPassword")}
|
||||||
</label>
|
</label>
|
||||||
<div
|
<div
|
||||||
className={`flex items-center border border-gray-300 rounded-lg shadow-sm bg-white${
|
className={`flex items-center border border-gray-300 rounded-lg shadow-sm bg-white${
|
||||||
@ -136,7 +131,7 @@ const ResetCodeForm = () => {
|
|||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
placeholder="Повторите новый пароль"
|
placeholder={t("repeatPass")}
|
||||||
className="w-full text-[16px] leading-6 text-gray-900 px-[10px] py-[14px]"
|
className="w-full text-[16px] leading-6 text-gray-900 px-[10px] py-[14px]"
|
||||||
type={showPasswordTwo ? "text" : "password"}
|
type={showPasswordTwo ? "text" : "password"}
|
||||||
{...register("new_password2", { required: true })}
|
{...register("new_password2", { required: true })}
|
||||||
@ -165,7 +160,7 @@ const ResetCodeForm = () => {
|
|||||||
className="mt-8 h-[44px] w-full rounded-md shadow-sm bg-light-blue font-bold leading-6 text-white"
|
className="mt-8 h-[44px] w-full rounded-md shadow-sm bg-light-blue font-bold leading-6 text-white"
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
{loader ? <Loader /> : "Сохранить"}
|
{loader ? <Loader /> : t("save")}
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
);
|
);
|
||||||
|
@ -21,8 +21,8 @@ const SignInForm = ({}) => {
|
|||||||
const [error, setError] = React.useState<string>("");
|
const [error, setError] = React.useState<string>("");
|
||||||
|
|
||||||
const signInFormScheme = z.object({
|
const signInFormScheme = z.object({
|
||||||
email: z.string().email("Неверный формат email"),
|
email: z.string().email(t("emailFormat")),
|
||||||
password: z.string().min(8, "Пароль должен содержать минимум 8 символов"),
|
password: z.string().min(8, t("passwordMin")),
|
||||||
});
|
});
|
||||||
|
|
||||||
type FormFields = z.infer<typeof signInFormScheme>;
|
type FormFields = z.infer<typeof signInFormScheme>;
|
||||||
|
Loading…
Reference in New Issue
Block a user