feat: 支持多语言能力

This commit is contained in:
2026-01-24 10:10:52 +08:00
parent 77c048b6a2
commit e2280b12e2
23 changed files with 2373 additions and 374 deletions

View File

@@ -0,0 +1,39 @@
import type { Metadata } from "next";
import { headers } from "next/headers";
export async function generateMetadata(): Promise<Metadata> {
const headersList = await headers();
const acceptLanguage = headersList.get("accept-language") || "";
const lang = acceptLanguage.includes("zh") ? "zh" : "en";
const titles = {
en: "Image Compression - Optimize Images for Web & Mobile",
zh: "图片压缩 - 为网页和移动端优化图片",
};
const descriptions = {
en: "Optimize images for web and mobile without quality loss. Support for batch processing and format conversion including PNG, JPEG, WebP.",
zh: "为网页和移动端优化图片,不影响质量。支持批量处理和格式转换,包括 PNG、JPEG、WebP。",
};
return {
title: titles[lang],
description: descriptions[lang],
openGraph: {
title: titles[lang],
description: descriptions[lang],
},
twitter: {
title: titles[lang],
description: descriptions[lang],
},
};
}
export default function ImageCompressLayout({
children,
}: {
children: React.ReactNode;
}) {
return children;
}