From ce6c80bdb126259354c370729d27985a9b636fc0 Mon Sep 17 00:00:00 2001
From: JOYCEQL <1449239013@qq.com>
Date: Thu, 2 Jan 2025 23:38:42 +0800
Subject: [PATCH] feat: dashboard i18n
---
apps/fronted/src/app/app/dashboard/layout.tsx | 3 ++
.../src/app/app/dashboard/resumes/page.tsx | 2 +-
.../src/app/app/dashboard/settings/page.tsx | 48 ++++++++++++-------
apps/fronted/src/i18n/locales/en.json | 28 +++++++++--
apps/fronted/src/i18n/locales/zh.json | 26 +++++++++-
5 files changed, 85 insertions(+), 22 deletions(-)
diff --git a/apps/fronted/src/app/app/dashboard/layout.tsx b/apps/fronted/src/app/app/dashboard/layout.tsx
index 41943b7..aa88560 100644
--- a/apps/fronted/src/app/app/dashboard/layout.tsx
+++ b/apps/fronted/src/app/app/dashboard/layout.tsx
@@ -6,6 +6,9 @@ import Document from "@/components/Document";
import Client from "./client";
type Props = {
children: ReactNode;
+ params: {
+ locale: string;
+ };
};
export async function generateMetadata({
params: { locale },
diff --git a/apps/fronted/src/app/app/dashboard/resumes/page.tsx b/apps/fronted/src/app/app/dashboard/resumes/page.tsx
index 1dba1cb..eeaf8f9 100644
--- a/apps/fronted/src/app/app/dashboard/resumes/page.tsx
+++ b/apps/fronted/src/app/app/dashboard/resumes/page.tsx
@@ -113,7 +113,7 @@ const ResumeWorkbench = () => {
size="sm"
className="ml-4 bg-gradient-to-r from-green-500 to-green-600 hover:from-green-600 hover:to-green-700 text-white"
onClick={() => {
- router.push("/dashboard/settings");
+ router.push("/app/dashboard/settings");
}}
>
diff --git a/apps/fronted/src/app/app/dashboard/settings/page.tsx b/apps/fronted/src/app/app/dashboard/settings/page.tsx
index b23e5a9..45c6ea6 100644
--- a/apps/fronted/src/app/app/dashboard/settings/page.tsx
+++ b/apps/fronted/src/app/app/dashboard/settings/page.tsx
@@ -23,6 +23,7 @@ import {
storeConfig,
verifyPermission,
} from "@/utils/fileSystem";
+import { useTranslations } from "next-intl";
const SettingsPage = () => {
const [directoryHandle, setDirectoryHandle] =
@@ -32,6 +33,8 @@ const SettingsPage = () => {
const { doubaoApiKey, doubaoModelId, setDoubaoApiKey, setDoubaoModelId } =
useAIConfigStore();
+ const t = useTranslations();
+
useEffect(() => {
const loadSavedConfig = async () => {
try {
@@ -92,7 +95,7 @@ const SettingsPage = () => {
- 系统设置
+ {t("dashboard.settings.title")}
@@ -108,11 +111,10 @@ const SettingsPage = () => {
- 文件同步配置
+ {t("dashboard.settings.syncDirectory.title")}
- 选择一个文件夹存储你的简历数据,所有简历将以 JSON
- 格式保存,确保数据安全。
+ {t("dashboard.settings.syncDirectory.description")}
@@ -122,7 +124,9 @@ const SettingsPage = () => {
{folderPath ? (
{
) : (
- 还没有配置同步文件夹哦~
+ {t(
+ "dashboard.settings.syncDirectory.noFolderConfigured"
+ )}
)}
@@ -148,10 +154,12 @@ const SettingsPage = () => {
className={cn(
"shrink-0",
!folderPath &&
- "bg-gradient-to-r from-indigo-500 to-purple-500 text-white hover:from-indigo-600 hover:to-purple-600"
+ "text-white hover:from-indigo-600 hover:to-purple-600"
)}
>
- {folderPath ? "更改文件夹" : "选择文件夹"}
+ {folderPath
+ ? t("dashboard.settings.syncDirectory.changeFolder")
+ : t("dashboard.settings.syncDirectory.selectFolder")}
@@ -169,10 +177,10 @@ const SettingsPage = () => {
- AI 模型配置
+ {t("dashboard.settings.aiConfig.title")}
- 配置豆包大模型,让 AI 助手为你的简历提供智能优化和建议。
+ {t("dashboard.settings.aiConfig.description")}
@@ -183,18 +191,22 @@ const SettingsPage = () => {
- 豆包 API 密钥
+ {t("dashboard.settings.aiConfig.apiKey.label")}
- 在豆包开放平台获取 API 密钥
+
+ {t("dashboard.settings.aiConfig.apiKey.description")}
+
@@ -204,18 +216,22 @@ const SettingsPage = () => {
- 豆包模型 ID
+ {t("dashboard.settings.aiConfig.modelId.label")}
- 在豆包开放平台获取模型 ID
+
+ {t("dashboard.settings.aiConfig.modelId.description")}
+
diff --git a/apps/fronted/src/i18n/locales/en.json b/apps/fronted/src/i18n/locales/en.json
index 38b658c..5ade5fa 100644
--- a/apps/fronted/src/i18n/locales/en.json
+++ b/apps/fronted/src/i18n/locales/en.json
@@ -33,7 +33,7 @@
}
},
"footer": {
- "copyright": "© 2024 Magic Resume. All rights reserved."
+ "copyright": " 2024 Magic Resume. All rights reserved."
}
},
"dashboard": {
@@ -44,13 +44,35 @@
"resumes": {
"synced": "Synced Files",
"view": "View",
- "myResume": "My Resumes",
+ "myResume": "Resumes",
"create": "Create Resume",
"newResume": "New Resume",
"newResumeDescription": "Create a new resume to get started."
},
"settings": {
- "title": "Settings"
+ "title": "Settings",
+ "syncDirectory": {
+ "title": "Sync Directory",
+ "description": "Choose a folder to sync and backup your resumes.",
+ "currentSyncFolder": "Current Sync Folder",
+ "noFolderConfigured": "No folder configured",
+ "changeFolder": "Change Folder",
+ "selectFolder": "Select Folder"
+ },
+ "aiConfig": {
+ "title": "AI Model Configuration",
+ "description": "Configure Doubao Large Model to provide intelligent optimization and suggestions for your resume.",
+ "apiKey": {
+ "label": "Doubao API Key",
+ "placeholder": "Please enter Doubao API Key",
+ "description": "Obtain API Key from Doubao Open Platform"
+ },
+ "modelId": {
+ "label": "Doubao Model ID",
+ "placeholder": "Please enter Doubao Model ID",
+ "description": "Obtain Model ID from Doubao Open Platform"
+ }
+ }
}
}
}
diff --git a/apps/fronted/src/i18n/locales/zh.json b/apps/fronted/src/i18n/locales/zh.json
index 869e649..444d571 100644
--- a/apps/fronted/src/i18n/locales/zh.json
+++ b/apps/fronted/src/i18n/locales/zh.json
@@ -33,7 +33,7 @@
}
},
"footer": {
- "copyright": "© 2024 Magic Resume. All rights reserved."
+ "copyright": " 2024 Magic Resume. All rights reserved."
}
},
"dashboard": {
@@ -50,7 +50,29 @@
"newResumeDescription": "创建一个新简历以开始。"
},
"settings": {
- "title": "设置"
+ "title": "设置",
+ "syncDirectory": {
+ "title": "同步目录",
+ "description": "选择一个文件夹来同步和备份您的简历。",
+ "currentSyncFolder": "当前同步文件夹",
+ "noFolderConfigured": "尚未配置同步文件夹",
+ "changeFolder": "更改文件夹",
+ "selectFolder": "选择文件夹"
+ },
+ "aiConfig": {
+ "title": "AI 模型配置",
+ "description": "配置豆包大模型,让 AI 助手为你的简历提供智能优化和建议。",
+ "apiKey": {
+ "label": "豆包 API 密钥",
+ "placeholder": "请输入豆包 API 密钥",
+ "description": "在豆包开放平台获取 API 密钥"
+ },
+ "modelId": {
+ "label": "豆包模型 ID",
+ "placeholder": "请输入豆包模型 ID",
+ "description": "在豆包开放平台获取模型 ID"
+ }
+ }
}
}
}