'use client'; import { usePathname } from 'next/navigation'; import { Button } from '@/app/components/ui/button'; import Header from '@/app/components/Header'; import Footer from '@/app/components/Footer'; import Link from 'next/link'; import { FileX, Home, ArrowLeft } from 'lucide-react'; export default function NotFound() { const pathname = usePathname(); // 从路径中检测语言 const getLocaleFromPath = (path: string) => { if (path.startsWith('/zh-TW')) return 'zh-TW'; if (path.startsWith('/en')) return 'en'; return 'zh-CN'; }; const locale = getLocaleFromPath(pathname); // 根据语言设置翻译 - 与详情页面保持一致的结构 const translations = { 'zh-CN': { nav: { home: '首页', products: '产品与服务', news: '新闻资讯', support: '客户支持', about: '关于我们', contact: '联系我们', }, footer: { sections: [ { title: '目录', items: ['首页', '产品与服务', '新闻资讯', '客户支持', '关于我们'], }, { title: '热门产品', items: ['轻量云服务器', '站群服务器', 'EC2服务器', '高防服务器', 'S3云存储'], }, { title: '客户支持', items: ['技术支持', '在线客服', '帮助文档', '服务状态'], }, { title: '公司信息', items: ['关于我们', '联系我们', '隐私政策', '服务条款'], }, ], }, // 404页面特有的翻译 notFound: { title: '页面未找到', description: '抱歉,您访问的页面不存在或已被移除。', articleNotFound: '该文章可能没有对应的中文版本。', suggestion: '建议您:', checkUrl: '检查网址是否正确', backHome: '返回首页', backNews: '返回新闻列表', contactUs: '如果问题持续存在,请联系我们', brand: 'AwsLinker' } }, 'zh-TW': { nav: { home: '首頁', products: '產品與服務', news: '新聞資訊', support: '客戶支持', about: '關於我們', contact: '聯繫我們', }, footer: { sections: [ { title: '目錄', items: ['首頁', '產品與服務', '新聞資訊', '客戶支持', '關於我們'], }, { title: '熱門產品', items: ['輕量雲服務器', '站群服務器', 'EC2服務器', '高防服務器', 'S3雲存儲'], }, { title: '客戶支持', items: ['技術支持', '在線客服', '幫助文檔', '服務狀態'], }, { title: '公司信息', items: ['關於我們', '聯繫我們', '隱私政策', '服務條款'], }, ], }, // 404页面特有的翻译 notFound: { title: '頁面未找到', description: '抱歉,您訪問的頁面不存在或已被移除。', articleNotFound: '該文章可能沒有對應的繁體中文版本。', suggestion: '建議您:', checkUrl: '檢查網址是否正確', backHome: '返回首頁', backNews: '返回新聞列表', contactUs: '如果問題持續存在,請聯繫我們', brand: 'AwsLinker' } }, 'en': { nav: { home: 'Home', products: 'Products & Services', news: 'News', support: 'Support', about: 'About Us', contact: 'Contact Us', }, footer: { sections: [ { title: 'Directory', items: ['Home', 'Products & Services', 'News', 'Support', 'About Us'], }, { title: 'Popular Products', items: ['Lightweight Cloud Server', 'Station Group Server', 'EC2 Server', 'High-Defense Server', 'S3 Cloud Storage'], }, { title: 'Customer Support', items: ['Technical Support', 'Online Service', 'Documentation', 'Service Status'], }, { title: 'Company Info', items: ['About Us', 'Contact Us', 'Privacy Policy', 'Terms of Service'], }, ], }, // 404页面特有的翻译 notFound: { title: 'Page Not Found', description: 'Sorry, the page you are looking for does not exist or has been removed.', articleNotFound: 'This article may not be available in English.', suggestion: 'We suggest you:', checkUrl: 'Check if the URL is correct', backHome: 'Go to Homepage', backNews: 'Back to News', contactUs: 'Contact us if the problem persists', brand: 'DongYun Tech' } } }; const currentTranslations = translations[locale]; const t = currentTranslations.notFound; // 检查是否是文章页面 const isArticlePage = pathname.includes('/news/'); return (
{}} translations={currentTranslations} locale={locale} />

404

{t.title}

{t.description}

{isArticlePage && (

{t.articleNotFound}

)}

{t.suggestion}

{isArticlePage && ( )}

{t.contactUs}

); }