diff --git a/src/components/auth/join/form.tsx b/src/components/auth/join/form.tsx index 1b317a8..a24f35b 100644 --- a/src/components/auth/join/form.tsx +++ b/src/components/auth/join/form.tsx @@ -26,10 +26,13 @@ import { register } from "./action"; import { FormError } from "../error/form-error"; import { FormSuccess } from "../form-success"; import { Social } from "../social"; +import { useTranslations } from "@/lib/use-translations"; + export const RegisterForm = ({ className, ...props }: React.ComponentPropsWithoutRef<"div">) => { + const { t } = useTranslations(); const [error, setError] = useState(""); const [success, setSuccess] = useState(""); const [isPending, startTransition] = useTransition(); @@ -68,7 +71,7 @@ export const RegisterForm = ({
- Or continue with + {t.auth.orContinueWith}
@@ -82,7 +85,7 @@ export const RegisterForm = ({ @@ -98,7 +101,7 @@ export const RegisterForm = ({ @@ -115,7 +118,7 @@ export const RegisterForm = ({ @@ -127,18 +130,18 @@ export const RegisterForm = ({ -
- Already have an account? + {t.auth.alreadyHaveAccount}
diff --git a/src/components/auth/login/form.tsx b/src/components/auth/login/form.tsx index 7508aed..113edcc 100644 --- a/src/components/auth/login/form.tsx +++ b/src/components/auth/login/form.tsx @@ -29,15 +29,17 @@ import { login } from "./action"; import { FormError } from "../error/form-error"; import { FormSuccess } from "../form-success"; import { Social } from "../social"; +import { useTranslations } from "@/lib/use-translations"; export const LoginForm = ({ className, ...props }: React.ComponentPropsWithoutRef<"div">) => { + const { t } = useTranslations(); const searchParams = useSearchParams(); const callbackUrl = searchParams.get("callbackUrl"); const urlError = searchParams.get("error") === "OAuthAccountNotLinked" - ? "Email already in use with different provider!" + ? t.auth.errors.oauthAccountNotLinked : ""; const [showTwoFactor, setShowTwoFactor] = useState(false); @@ -72,7 +74,7 @@ export const LoginForm = ({ setShowTwoFactor(true); } }) - .catch(() => setError("Something went wrong")); + .catch(() => setError(t.auth.errors.somethingWentWrong)); }); }; @@ -93,7 +95,7 @@ export const LoginForm = ({
- Or continue with + {t.auth.orContinueWith}
@@ -108,8 +110,7 @@ export const LoginForm = ({ @@ -129,7 +130,7 @@ export const LoginForm = ({ id="email" type="email" disabled={isPending} - placeholder="Email" + placeholder={t.auth.email} /> @@ -147,14 +148,14 @@ export const LoginForm = ({ id="password" type="password" disabled={isPending} - placeholder="Password" + placeholder={t.auth.password} /> - Forgot password? + {t.auth.forgotPassword} @@ -167,13 +168,13 @@ export const LoginForm = ({ - +
- Don't have an account? + {t.auth.dontHaveAccount}
diff --git a/src/components/auth/password/form.tsx b/src/components/auth/password/form.tsx index 2c1a72c..b53e8a7 100644 --- a/src/components/auth/password/form.tsx +++ b/src/components/auth/password/form.tsx @@ -26,11 +26,13 @@ import { NewPasswordSchema } from "../validation"; import { newPassword } from "./action"; import { FormError } from "../error/form-error"; import { FormSuccess } from "../form-success"; +import { useTranslations } from "@/lib/use-translations"; export const NewPasswordForm = ({ className, ...props }: React.ComponentPropsWithoutRef<"div">) => { + const { t } = useTranslations(); const searchParams = useSearchParams(); const token = searchParams.get("token"); @@ -62,7 +64,7 @@ export const NewPasswordForm = ({
-

Enter a new password

+

{t.auth.enterNewPassword}

@@ -77,7 +79,7 @@ export const NewPasswordForm = ({ @@ -89,18 +91,18 @@ export const NewPasswordForm = ({ -
- Back to login + {t.auth.backToLogin}
diff --git a/src/components/auth/reset/form.tsx b/src/components/auth/reset/form.tsx index 2db6dd1..4879126 100644 --- a/src/components/auth/reset/form.tsx +++ b/src/components/auth/reset/form.tsx @@ -25,11 +25,13 @@ import { ResetSchema } from "../validation"; import { reset } from "./action"; import { FormError } from "../error/form-error"; import { FormSuccess } from "../form-success"; +import { useTranslations } from "@/lib/use-translations"; export const ResetForm = ({ className, ...props }: React.ComponentPropsWithoutRef<"div">) => { + const { t } = useTranslations(); const [error, setError] = useState(""); const [success, setSuccess] = useState(""); const [isPending, startTransition] = useTransition(); @@ -71,9 +73,8 @@ export const ResetForm = ({ @@ -84,18 +85,18 @@ export const ResetForm = ({ -
- Back to login + {t.auth.backToLogin}
diff --git a/src/components/internationalization/ar.json b/src/components/internationalization/ar.json index 59249bc..09b2d6c 100644 --- a/src/components/internationalization/ar.json +++ b/src/components/internationalization/ar.json @@ -59,7 +59,18 @@ "enterEmail": "أدخل بريدك الإلكتروني", "enterPassword": "أدخل كلمة المرور", "welcomeBack": "مرحباً بعودتك", - "createNewAccount": "إنشاء حساب جديد" + "createNewAccount": "إنشاء حساب جديد", + "name": "الاسم", + "newPassword": "كلمة مرور جديدة", + "enterNewPassword": "أدخل كلمة مرور جديدة", + "twoFactorCode": "رمز التحقق الثنائي", + "orContinueWith": "أو تابع باستخدام", + "backToLogin": "العودة لتسجيل الدخول", + "join": "انضم", + "errors": { + "oauthAccountNotLinked": "البريد الإلكتروني مستخدم بالفعل مع مزود مختلف!", + "somethingWentWrong": "حدث خطأ ما" + } }, "marketing": { "hero": { diff --git a/src/components/internationalization/en.json b/src/components/internationalization/en.json index aeac459..d968754 100644 --- a/src/components/internationalization/en.json +++ b/src/components/internationalization/en.json @@ -59,7 +59,18 @@ "enterEmail": "Enter your email", "enterPassword": "Enter your password", "welcomeBack": "Welcome back", - "createNewAccount": "Create a new account" + "createNewAccount": "Create a new account", + "name": "Name", + "newPassword": "New Password", + "enterNewPassword": "Enter a new password", + "twoFactorCode": "Two Factor Code", + "orContinueWith": "Or continue with", + "backToLogin": "Back to login", + "join": "Join", + "errors": { + "oauthAccountNotLinked": "Email already in use with different provider!", + "somethingWentWrong": "Something went wrong" + } }, "marketing": { "hero": { diff --git a/src/components/wizard/theme.tsx b/src/components/wizard/theme.tsx index 37e3510..0339b58 100644 --- a/src/components/wizard/theme.tsx +++ b/src/components/wizard/theme.tsx @@ -13,6 +13,7 @@ import { cn } from "@/lib/utils"; import { Icons } from "@/components/icons"; import { Sheet, SheetContent, SheetTrigger } from "@/components/ui/sheet"; import { useConfig } from "@/hooks/use-config"; +import { useTranslations } from "@/lib/use-translations"; // Make sure Customizer doesn't cause unnecessary re-renders import CustomizerUI from "./cutomizer"; const MemoizedCustomizer = React.memo(CustomizerUI); @@ -48,6 +49,7 @@ interface ThemeSelectorProps { const ThemeSelector: React.FC = () => { const [config] = useConfig(); + const { t } = useTranslations(); const getPrimaryButtonStyle = React.useMemo( () => ({ @@ -129,7 +131,7 @@ const ThemeSelector: React.FC = () => {
- Or continue with + {t.auth.orContinueWith}
@@ -137,7 +139,7 @@ const ThemeSelector: React.FC = () => {