diff --git a/apps/dokploy/components/dashboard/organization/handle-organization.tsx b/apps/dokploy/components/dashboard/organization/handle-organization.tsx index 4ccb03cfa..1bf0cd99f 100644 --- a/apps/dokploy/components/dashboard/organization/handle-organization.tsx +++ b/apps/dokploy/components/dashboard/organization/handle-organization.tsx @@ -153,7 +153,7 @@ export function AddOrganization({ organizationId }: Props) { - {activeItem?.title} + {activeItem?.titleKey ? t(activeItem.titleKey) : ""} diff --git a/apps/dokploy/components/layouts/user-nav.tsx b/apps/dokploy/components/layouts/user-nav.tsx index 85cb96f30..ecb9e25b0 100644 --- a/apps/dokploy/components/layouts/user-nav.tsx +++ b/apps/dokploy/components/layouts/user-nav.tsx @@ -23,11 +23,13 @@ import { ChevronsUpDown } from "lucide-react"; import { useRouter } from "next/router"; import { ModeToggle } from "../ui/modeToggle"; import { SidebarMenuButton } from "../ui/sidebar"; +import { useTranslation } from "next-i18next"; const _AUTO_CHECK_UPDATES_INTERVAL_MINUTES = 7; export const UserNav = () => { const router = useRouter(); + const { t } = useTranslation("common"); const { data } = api.user.get.useQuery(); const { data: isCloud } = api.settings.isCloud.useQuery(); @@ -49,7 +51,9 @@ export const UserNav = () => { CN
- Account + + {t("common.account")} + {data?.user?.email}
@@ -63,7 +67,7 @@ export const UserNav = () => { >
- My Account + {t("common.account.mine")} {data?.user?.email} @@ -78,7 +82,7 @@ export const UserNav = () => { router.push("/dashboard/settings/profile"); }} > - Profile + {t("common.side.profile")} { router.push("/dashboard/projects"); }} > - Projects + {t("common.side.projects")} {!isCloud ? ( <> @@ -96,7 +100,7 @@ export const UserNav = () => { router.push("/dashboard/monitoring"); }} > - Monitoring + {t("common.side.monitoring")} {(data?.role === "owner" || data?.canAccessToTraefikFiles) && ( { router.push("/dashboard/traefik"); }} > - Traefik + {t("common.side.traefik")} )} {(data?.role === "owner" || data?.canAccessToDocker) && ( @@ -117,7 +121,7 @@ export const UserNav = () => { }); }} > - Docker + {t("common.side.docker")} )} @@ -128,7 +132,7 @@ export const UserNav = () => { router.push("/dashboard/settings"); }} > - Settings + {t("common.side.settings")} )} @@ -141,7 +145,7 @@ export const UserNav = () => { router.push("/dashboard/settings/servers"); }} > - Servers + {t("common.side.remote-servers")} )} @@ -152,7 +156,7 @@ export const UserNav = () => { router.push("/dashboard/settings"); }} > - Settings + {t("common.side.settings")} )} @@ -165,7 +169,7 @@ export const UserNav = () => { router.push("/dashboard/settings/billing"); }} > - Billing + {t("common.side.billing")} )} @@ -181,7 +185,7 @@ export const UserNav = () => { // }); }} > - Log out + {t("common.account.logout")}
@@ -291,11 +295,11 @@ export default function Home({ IS_CLOUD }: Props) { name="password" render={({ field }) => ( - Password + {t("auth.password")} @@ -308,7 +312,7 @@ export default function Home({ IS_CLOUD }: Props) { type="submit" isLoading={isLoginLoading} > - Login + {t("auth.login")} @@ -322,7 +326,7 @@ export default function Home({ IS_CLOUD }: Props) { autoComplete="off" >
- + - Enter the 6-digit code from your authenticator app + {t("auth.twoFactorCodeDescription")}
@@ -361,14 +365,14 @@ export default function Home({ IS_CLOUD }: Props) { setTwoFactorCode(""); }} > - Back + {t("auth.back")}
@@ -379,24 +383,23 @@ export default function Home({ IS_CLOUD }: Props) { > - Enter Backup Code + {t("auth.enterBackupCode")} - Enter one of your backup codes to access your account + {t("auth.enterBackupCodeDescription")}
- + setBackupCode(e.target.value)} - placeholder="Enter your backup code" + placeholder={t("auth.backupCode.placeholder")} className="font-mono" /> - Enter one of the backup codes you received when setting up - 2FA + {t("auth.backupCodeDescription")}
@@ -410,14 +413,14 @@ export default function Home({ IS_CLOUD }: Props) { setBackupCode(""); }} > - Cancel + {t("auth.cancel")}
@@ -433,7 +436,7 @@ export default function Home({ IS_CLOUD }: Props) { className="hover:underline text-muted-foreground" href="/register" > - Create an account + {t("auth.createAccount")} )} @@ -444,7 +447,7 @@ export default function Home({ IS_CLOUD }: Props) { className="hover:underline text-muted-foreground" href="/send-reset-password" > - Lost your password? + {t("auth.forgetPassword")} ) : ( - Lost your password? + {t("auth.forgetPassword")} )} @@ -467,6 +470,9 @@ Home.getLayout = (page: ReactElement) => { return {page}; }; export async function getServerSideProps(context: GetServerSidePropsContext) { + const { req } = context; + const locale = getLocale(req.cookies); + if (IS_CLOUD) { try { const { user } = await validateRequest(context.req); @@ -511,6 +517,7 @@ export async function getServerSideProps(context: GetServerSidePropsContext) { return { props: { hasAdmin, + ...(await serverSideTranslations(locale, ["auth"])), }, }; } diff --git a/apps/dokploy/public/locales/en/auth.json b/apps/dokploy/public/locales/en/auth.json new file mode 100644 index 000000000..893352579 --- /dev/null +++ b/apps/dokploy/public/locales/en/auth.json @@ -0,0 +1,30 @@ +{ + "auth.signIn": "Sign In", + "auth.signInDescription": "Enter your email and password to sign in", + "auth.signInWithGoogle": "Sign in with Google", + "auth.signInWithGithub": "Sign in with GitHub", + "auth.email": "Email", + "auth.password": "Password", + "auth.password.placeholder": "Enter your password", + "auth.login": "Login", + "auth.forgetPassword": "Lost your password?", + "auth.createAccount": "Create an account", + "auth.twoFactorCode": "2FA Code", + "auth.twoFactorCodeDescription": "Enter the 6-digit code from your authenticator app", + "auth.lostAuthenticator": "Lost access to your authenticator app?", + "auth.back": "Back", + "auth.verify": "Verify", + "auth.enterBackupCode": "Enter Backup Code", + "auth.enterBackupCodeDescription": "Enter one of your backup codes to access your account", + "auth.backupCode": "Backup Code", + "auth.backupCode.placeholder": "Enter your backup code", + "auth.backupCodeDescription": "Enter one of the backup codes you received when setting up 2FA", + "auth.cancel": "Cancel", + "auth.invalidTwoFactorCode": "Please enter a valid 6-digit code", + "auth.twoFactorVerificationError": "An error occurred while verifying 2FA code", + "auth.invalidBackupCode": "Please enter a valid backup code", + "auth.backupCodeVerificationError": "An error occurred while verifying backup code", + "auth.githubSignInError": "An error occurred while signing in with GitHub", + "auth.googleSignInError": "An error occurred while signing in with Google", + "auth.unknownError": "Unknown error" +} diff --git a/apps/dokploy/public/locales/en/common.json b/apps/dokploy/public/locales/en/common.json index 11727ba77..4982b29fe 100644 --- a/apps/dokploy/public/locales/en/common.json +++ b/apps/dokploy/public/locales/en/common.json @@ -46,10 +46,15 @@ "common.side.organizations.createOrganizationDescription": "Create a new organization to manage your projects.", "common.side.organizations.updateOrganizationDescription": "Update the organization name and logo", "common.side.organizations.name": "Name", - "common.side.organizations.name.placeHolder": "Organization name", + "common.side.organizations.name.placeholder": "Organization name", "common.side.organizations.logoURL": "Logo URL", "common.side.organizations.createSuccess": "Organization created successfully", "common.side.organizations.updateSuccess": "Organization updated successfully", "common.side.organizations.createFailed": "Failed to create organization", - "common.side.organizations.updateFailed": "Failed to update organization" + "common.side.organizations.updateFailed": "Failed to update organization", + + "common.account": "Account", + "common.account.mine": "My Account", + "common.account.logout": "Logout", + "common.account.selectLanguage": "Select Language" } diff --git a/apps/dokploy/public/locales/zh-Hans/auth.json b/apps/dokploy/public/locales/zh-Hans/auth.json new file mode 100644 index 000000000..b3a498d56 --- /dev/null +++ b/apps/dokploy/public/locales/zh-Hans/auth.json @@ -0,0 +1,30 @@ +{ + "auth.signIn": "登录", + "auth.signInDescription": "请输入您的邮箱和密码登录", + "auth.signInWithGoogle": "使用 Google 登录", + "auth.signInWithGithub": "使用 GitHub 登录", + "auth.email": "邮箱", + "auth.password": "密码", + "auth.password.placeholder": "请输入密码", + "auth.login": "登录", + "auth.forgetPassword": "忘记密码?", + "auth.createAccount": "创建账号", + "auth.twoFactorCode": "两步认证", + "auth.twoFactorCodeDescription": "请输入您的认证器应用中的6位数字验证码", + "auth.lostAuthenticator": "无法访问认证器应用?", + "auth.back": "返回", + "auth.verify": "验证", + "auth.enterBackupCode": "输入备用码", + "auth.enterBackupCodeDescription": "输入备用码以访问您的账户", + "auth.backupCode": "备用码", + "auth.backupCode.placeholder": "请输入您的备用码", + "auth.backupCodeDescription": "输入您在设置两步认证时收到的备用码", + "auth.cancel": "取消", + "auth.invalidTwoFactorCode": "请输入有效的6位数字验证码", + "auth.twoFactorVerificationError": "验证两步认证码时发生错误", + "auth.invalidBackupCode": "请输入有效的备用码", + "auth.backupCodeVerificationError": "验证备用码时发生错误", + "auth.githubSignInError": "使用 GitHub 登录时发生错误", + "auth.googleSignInError": "使用 Google 登录时发生错误", + "auth.unknownError": "未知错误" +} diff --git a/apps/dokploy/public/locales/zh-Hans/common.json b/apps/dokploy/public/locales/zh-Hans/common.json index 174fb86d4..4a1f21b49 100644 --- a/apps/dokploy/public/locales/zh-Hans/common.json +++ b/apps/dokploy/public/locales/zh-Hans/common.json @@ -46,10 +46,15 @@ "common.side.organizations.createOrganizationDescription": "创建一个新组织来管理您的项目。", "common.side.organizations.updateOrganizationDescription": "更新组织名称和标志", "common.side.organizations.name": "名称", - "common.side.organizations.name.placeHolder": "请输入组织名称", + "common.side.organizations.name.placeholder": "请输入组织名称", "common.side.organizations.logoURL": "Logo 图片地址", "common.side.organizations.createSuccess": "组织创建成功", "common.side.organizations.updateSuccess": "组织更新成功", "common.side.organizations.createFailed": "创建组织失败", - "common.side.organizations.updateFailed": "更新组织失败" + "common.side.organizations.updateFailed": "更新组织失败", + + "common.account": "账户", + "common.account.mine": "我的账户", + "common.account.logout": "注销", + "common.account.selectLanguage": "选择语言" }