Skip to content

Let's use AI to Earn!

ai工具名字更新和报错

I5bijibne475fe6ebe2ef
diff --git a/src/app/[lng]/cgmaterial/cgmaterialPageCore.tsx b/src/app/[lng]/cgmaterial/cgmaterialPageCore.tsx
index dcc20576..6ce3c350 100644
--- a/src/app/[lng]/cgmaterial/cgmaterialPageCore.tsx
+++ b/src/app/[lng]/cgmaterial/cgmaterialPageCore.tsx
@@ -24,11 +24,13 @@ import { PlatType } from "@/app/config/platConfig";
import { PublishStatus } from "@/api/plat/types/publish.types";
import { useTransClient } from "@/app/i18n/client";
import { PubType } from "@/app/config/publishConfig";
+import { useParams } from "next/navigation";
const { TextArea } = Input;
export default function CgMaterialPageCore() {
const { t } = useTransClient('cgmaterial');
+ const { lng } = useParams();
// 草稿箱组相关
const [groupList, setGroupList] = useState<any[]>([]);
@@ -821,6 +823,11 @@ export default function CgMaterialPageCore() {
// 获取平台显示名称
function getPlatformName(type: string) {
+ if (lng === 'en') {
+ return type;
+ }
+
+ // 中文显示名称
const platformNames: Record<string, string> = {
'tiktok': 'TikTok',
'youtube': 'YouTube',
diff --git a/src/app/i18n/locales/en/home.json b/src/app/i18n/locales/en/home.json
index bf9f6f20..29a8b22c 100644
--- a/src/app/i18n/locales/en/home.json
+++ b/src/app/i18n/locales/en/home.json
@@ -131,6 +131,8 @@
"wechat": "WeChat Group",
"community": "Creator Community"
},
+ "wechatPopup": "Scan QR code to follow WeChat Official Account",
+ "communityPopup": "Scan QR code to join community group",
"stats": {
"downloads": {
"number": "200K+",
diff --git a/src/app/i18n/locales/en/route.json b/src/app/i18n/locales/en/route.json
index f8010aae..da856110 100644
--- a/src/app/i18n/locales/en/route.json
+++ b/src/app/i18n/locales/en/route.json
@@ -4,5 +4,6 @@
"publish": "Publish",
"hotContent": "Hot Content",
"hotContentNew": "Hot Content New",
+ "aiTools": "AI Tools",
"navigation": "Navigation"
}
\ No newline at end of file
diff --git a/src/app/i18n/locales/zh-CN/home.json b/src/app/i18n/locales/zh-CN/home.json
index 6218589b..8ed8bb47 100644
--- a/src/app/i18n/locales/zh-CN/home.json
+++ b/src/app/i18n/locales/zh-CN/home.json
@@ -131,6 +131,8 @@
"wechat": "微信群组",
"community": "创作者交流群"
},
+ "wechatPopup": "扫码关注微信公众号",
+ "communityPopup": "扫码加入社区群",
"stats": {
"downloads": {
"number": "20万+",
diff --git a/src/app/i18n/locales/zh-CN/route.json b/src/app/i18n/locales/zh-CN/route.json
index ad8874cb..444a59ad 100644
--- a/src/app/i18n/locales/zh-CN/route.json
+++ b/src/app/i18n/locales/zh-CN/route.json
@@ -4,5 +4,6 @@
"publish": "发布",
"hotContent": "热门内容",
"hotContentNew": "热门内容新",
+ "aiTools": "AI工具",
"navigation": "导航"
}
\ No newline at end of file
diff --git a/src/app/layout/layoutNav.tsx b/src/app/layout/layoutNav.tsx
index a55132aa..c40c4206 100644
--- a/src/app/layout/layoutNav.tsx
+++ b/src/app/layout/layoutNav.tsx
@@ -166,6 +166,8 @@ function NavPC() {
const [activeNav, setActiveNav] = useState("");
const timer = useRef<NodeJS.Timeout>();
const route = useSelectedLayoutSegments();
+ const { t } = useTransClient("route");
+
let currRouter = "/";
if (route.length === 1) {
currRouter = route[0];
@@ -192,7 +194,7 @@ function NavPC() {
onMouseLeave={() => {
timer.current = setTimeout(() => {
setActiveNav("");
- }, 100);
+ }, 300);
}}
>
{getNameTag(v1, 0)}
@@ -213,10 +215,13 @@ function NavPE() {
const router = useRouter();
const { t } = useTransClient("route");
- const translatedMenuItems = peRouterData?.map((item) => ({
- ...item,
- // @ts-ignore
- label: t(item.key as string),
+ const translatedMenuItems = routerData.map((item) => ({
+ key: item.path || item.name,
+ label: t(item.translationKey),
+ children: item.children?.map((child) => ({
+ key: child.path || child.name,
+ label: t(child.translationKey),
+ })),
}));
return (
@@ -240,7 +245,6 @@ function NavPE() {
}}
style={{ width: "100%" }}
mode="inline"
- // @ts-ignore
items={translatedMenuItems}
/>
</Drawer>
diff --git a/src/app/layout/routerData.ts b/src/app/layout/routerData.ts
index 452002e6..ed665660 100644
--- a/src/app/layout/routerData.ts
+++ b/src/app/layout/routerData.ts
@@ -34,7 +34,7 @@ export const routerData: IRouterDataItem[] = [
},
{
name: "AI工具",
- translationKey: "AI Tools",
+ translationKey: "aiTools",
path: "/material/ai-generate",
},
];
diff --git a/src/components/notification/NotificationPanel.tsx b/src/components/notification/NotificationPanel.tsx
index d552b1f7..5f918620 100644
--- a/src/components/notification/NotificationPanel.tsx
+++ b/src/components/notification/NotificationPanel.tsx
@@ -22,6 +22,7 @@ import { PubType } from "@/app/config/publishConfig";
import { getAppDownloadConfig, getTasksRequiringApp } from "@/app/config/appDownloadConfig";
import DownloadAppModal from "@/components/common/DownloadAppModal";
import styles from "./NotificationPanel.module.scss";
+import { useParams } from "next/navigation";
interface NotificationPanelProps {
visible: boolean;
@@ -260,6 +261,13 @@ const NotificationPanel: React.FC<NotificationPanelProps> = ({ visible, onClose
// 获取平台显示名称
const getPlatformName = (type: string) => {
+ const { lng } = useParams();
+
+ if (lng === 'en') {
+ return type;
+ }
+
+ // 中文显示名称
const platformNames: Record<string, string> = {
'tiktok': 'TikTok',
'youtube': 'YouTube',