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

@@ -1,38 +1,55 @@
"use client";
import Link from "next/link";
import { Sparkles, Github, Twitter } from "lucide-react";
import { useTranslation } from "@/lib/i18n";
const footerLinks = {
product: [
{ name: "Features", href: "/features" },
{ name: "Pricing", href: "/pricing" },
{ name: "API", href: "/api" },
{ name: "Documentation", href: "/docs" },
],
tools: [
{ name: "Video to Frames", href: "/tools/video-frames" },
{ name: "Image Compression", href: "/tools/image-compress" },
{ name: "Audio Compression", href: "/tools/audio-compress" },
{ name: "AI Tools", href: "/tools/ai-tools" },
],
company: [
{ name: "About", href: "/about" },
{ name: "Blog", href: "/blog" },
{ name: "Careers", href: "/careers" },
{ name: "Contact", href: "/contact" },
],
legal: [
{ name: "Privacy", href: "/privacy" },
{ name: "Terms", href: "/terms" },
{ name: "Cookie Policy", href: "/cookies" },
],
};
function useFooterLinks() {
const { t } = useTranslation();
return {
product: [
{ name: t("common.features"), href: "/features" },
{ name: t("nav.pricing"), href: "/pricing" },
{ name: "API", href: "/api" },
{ name: t("nav.docs"), href: "/docs" },
],
tools: [
{ name: t("sidebar.videoToFrames"), href: "/tools/video-frames" },
{ name: t("sidebar.imageCompression"), href: "/tools/image-compress" },
{ name: t("sidebar.audioCompression"), href: "/tools/audio-compress" },
{ name: t("home.tools.aiTools.title"), href: "/tools/ai-tools" },
],
company: [
{ name: t("nav.about"), href: "/about" },
{ name: "Blog", href: "/blog" },
{ name: "Careers", href: "/careers" },
{ name: "Contact", href: "/contact" },
],
legal: [
{ name: "Privacy", href: "/privacy" },
{ name: "Terms", href: "/terms" },
{ name: "Cookie Policy", href: "/cookies" },
],
};
}
const socialLinks = [
{ name: "Twitter", icon: Twitter, href: "https://twitter.com" },
{ name: "GitHub", icon: Github, href: "https://github.com" },
];
const sectionTitles: Record<string, string> = {
product: "Product",
tools: "Tools",
company: "Company",
legal: "Legal",
};
export function Footer() {
const { t } = useTranslation();
const footerLinks = useFooterLinks();
return (
<footer className="border-t border-border/40 bg-background/50">
<div className="container py-12 md:py-16">
@@ -43,16 +60,16 @@ export function Footer() {
<div className="flex h-8 w-8 items-center justify-center rounded-lg bg-primary">
<Sparkles className="h-5 w-5 text-primary-foreground" />
</div>
<span className="text-xl font-bold">Mini Game AI</span>
<span className="text-xl font-bold">{t("common.appName")}</span>
</Link>
<p className="mt-4 text-sm text-muted-foreground">
AI-powered tools for mini game developers. Process media files with ease.
{t("footer.tagline")}
</p>
</div>
{/* Product */}
<div>
<h3 className="mb-4 text-sm font-semibold">Product</h3>
<h3 className="mb-4 text-sm font-semibold">{sectionTitles.product}</h3>
<ul className="space-y-3 text-sm">
{footerLinks.product.map((link) => (
<li key={link.name}>
@@ -69,7 +86,7 @@ export function Footer() {
{/* Tools */}
<div>
<h3 className="mb-4 text-sm font-semibold">Tools</h3>
<h3 className="mb-4 text-sm font-semibold">{sectionTitles.tools}</h3>
<ul className="space-y-3 text-sm">
{footerLinks.tools.map((link) => (
<li key={link.name}>
@@ -86,7 +103,7 @@ export function Footer() {
{/* Company */}
<div>
<h3 className="mb-4 text-sm font-semibold">Company</h3>
<h3 className="mb-4 text-sm font-semibold">{sectionTitles.company}</h3>
<ul className="space-y-3 text-sm">
{footerLinks.company.map((link) => (
<li key={link.name}>
@@ -103,7 +120,7 @@ export function Footer() {
{/* Legal */}
<div>
<h3 className="mb-4 text-sm font-semibold">Legal</h3>
<h3 className="mb-4 text-sm font-semibold">{sectionTitles.legal}</h3>
<ul className="space-y-3 text-sm">
{footerLinks.legal.map((link) => (
<li key={link.name}>
@@ -122,7 +139,7 @@ export function Footer() {
{/* Bottom section */}
<div className="mt-12 flex flex-col items-center justify-between border-t border-border/40 pt-8 md:flex-row">
<p className="text-sm text-muted-foreground">
© {new Date().getFullYear()} Mini Game AI. All rights reserved.
© {new Date().getFullYear()} {t("common.appName")}. All rights reserved.
</p>
<div className="mt-4 flex space-x-6 md:mt-0">
{socialLinks.map((link) => {