refactor: simplify internationalization messages and remove unused content
- Update English and Chinese message files to remove unnecessary translations - Remove root page redirect component - Update home page to use new 'HomePage' translation key - Modify marketing links by commenting out docs link - Adjust locale selector width for better UI consistency
This commit is contained in:
parent
579885393b
commit
6646471e00
@ -1,46 +1,5 @@
|
||||
{
|
||||
"Error": {
|
||||
"description": "<p>We've unfortunately encountered an error.</p><p>You can try to <retry>reload the page</retry> you were visiting.</p>",
|
||||
"title": "Something went wrong!"
|
||||
},
|
||||
"IndexPage": {
|
||||
"description": "This is a basic example that demonstrates the usage of <code>next-intl</code> with the Next.js App Router. Try changing the locale in the top right corner and see how the content changes.",
|
||||
"HomePage": {
|
||||
"title": "next-intl example"
|
||||
},
|
||||
"LocaleLayout": {
|
||||
"title": "next-intl example"
|
||||
},
|
||||
"LocaleSwitcher": {
|
||||
"label": "Change language",
|
||||
"locale": "{locale, select, en {🇺🇸 English} zh {🇨🇳 中文} other {Unknown}}"
|
||||
},
|
||||
"Manifest": {
|
||||
"name": "next-intl example"
|
||||
},
|
||||
"Navigation": {
|
||||
"home": "Home",
|
||||
"pathnames": "Pathnames"
|
||||
},
|
||||
"NotFoundPage": {
|
||||
"description": "Please double-check the browser address bar or use the navigation to go to a known page.",
|
||||
"title": "Page not found"
|
||||
},
|
||||
"PageLayout": {
|
||||
"links": {
|
||||
"docs": {
|
||||
"description": "Learn more about next-intl in the official docs.",
|
||||
"href": "https://next-intl.dev",
|
||||
"title": "Docs"
|
||||
},
|
||||
"source": {
|
||||
"description": "Browse the source code of this example on GitHub.",
|
||||
"href": "https://github.com/amannn/next-intl/tree/main/examples/example-app-router",
|
||||
"title": "Source code"
|
||||
}
|
||||
}
|
||||
},
|
||||
"PathnamesPage": {
|
||||
"description": "<p>The pathnames are internationalized too.</p><p>If you're using the default language English, you'll see <code>/en/pathnames</code> in the browser address bar on this page.</p><p>If you change the locale to German, the URL is localized accordingly (<code>/de/pfadnamen</code>).</p>",
|
||||
"title": "Pathnames"
|
||||
}
|
||||
}
|
||||
|
@ -1,46 +1,5 @@
|
||||
{
|
||||
"Error": {
|
||||
"description": "<p>很抱歉,我们遇到了一个错误。</p><p>您可以尝试<retry>重新加载</retry>您正在访问的页面。</p>",
|
||||
"title": "出错了!"
|
||||
},
|
||||
"IndexPage": {
|
||||
"description": "这是一个基础示例,展示了如何在 Next.js App Router 中使用 <code>next-intl</code>。尝试在右上角更改语言,看看内容如何变化。",
|
||||
"HomePage": {
|
||||
"title": "next-intl 示例"
|
||||
},
|
||||
"LocaleLayout": {
|
||||
"title": "next-intl 示例"
|
||||
},
|
||||
"LocaleSwitcher": {
|
||||
"label": "更改语言",
|
||||
"locale": "{locale, select, en {🇺🇸 英语} zh {🇨🇳 中文} other {未知}}"
|
||||
},
|
||||
"Manifest": {
|
||||
"name": "next-intl 示例"
|
||||
},
|
||||
"Navigation": {
|
||||
"home": "首页",
|
||||
"pathnames": "路径名称"
|
||||
},
|
||||
"NotFoundPage": {
|
||||
"description": "请检查浏览器地址栏或使用导航前往已知页面。",
|
||||
"title": "页面未找到"
|
||||
},
|
||||
"PageLayout": {
|
||||
"links": {
|
||||
"docs": {
|
||||
"description": "在官方文档中了解更多关于 next-intl 的信息。",
|
||||
"href": "https://next-intl.dev",
|
||||
"title": "文档"
|
||||
},
|
||||
"source": {
|
||||
"description": "在 GitHub 上浏览此示例的源代码。",
|
||||
"href": "https://github.com/amannn/next-intl/tree/main/examples/example-app-router",
|
||||
"title": "源代码"
|
||||
}
|
||||
}
|
||||
},
|
||||
"PathnamesPage": {
|
||||
"description": "<p>路径名称也是国际化的。</p><p>如果您使用默认语言英语,您将在此页面的浏览器地址栏中看到 <code>/en/pathnames</code>。</p><p>如果您将语言更改为中文,URL 将相应地本地化(例如 <code>/cn/路径名称</code>)。</p>",
|
||||
"title": "路径名称"
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ export default async function HomePage(props: HomePageProps) {
|
||||
setRequestLocale(locale);
|
||||
|
||||
// Use getTranslations instead of useTranslations for async server components
|
||||
const t = await getTranslations('IndexPage');
|
||||
const t = await getTranslations('HomePage');
|
||||
|
||||
return (
|
||||
<>
|
||||
@ -36,7 +36,6 @@ export default async function HomePage(props: HomePageProps) {
|
||||
|
||||
<div className="text-center">
|
||||
<h1>{t('title')}</h1>
|
||||
{/* <Link href="/about">{t('about')}</Link> */}
|
||||
</div>
|
||||
|
||||
<HeroSection />
|
||||
|
@ -1,9 +0,0 @@
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
/**
|
||||
* This page only renders when the app is built statically (output: 'export')
|
||||
* and the `redirect` function is used to redirect to the default locale.
|
||||
*/
|
||||
export default function RootPage() {
|
||||
redirect("/en");
|
||||
}
|
@ -14,7 +14,6 @@ import {
|
||||
routing,
|
||||
} from "@/i18n/routing";
|
||||
import { useLocaleStore } from "@/stores/locale-store";
|
||||
import { Globe, GlobeIcon } from "lucide-react";
|
||||
import { useLocale } from "next-intl";
|
||||
import { useParams } from "next/navigation";
|
||||
import { useEffect, useTransition } from "react";
|
||||
@ -48,7 +47,8 @@ export default function LocaleSelector() {
|
||||
value={currentLocale}
|
||||
onValueChange={onSelectChange}
|
||||
>
|
||||
<SelectTrigger className="w-fit">
|
||||
{/* w-[120px] is better than w-fit */}
|
||||
<SelectTrigger className="w-[120px]">
|
||||
<SelectValue placeholder="🌐" />
|
||||
</SelectTrigger>
|
||||
<SelectContent>
|
||||
|
@ -32,11 +32,11 @@ export const MENU_LINKS = [
|
||||
href: Routes.Blog,
|
||||
external: false
|
||||
},
|
||||
{
|
||||
title: 'Docs',
|
||||
href: Routes.Docs,
|
||||
external: false
|
||||
},
|
||||
// {
|
||||
// title: 'Docs',
|
||||
// href: Routes.Docs,
|
||||
// external: false
|
||||
// },
|
||||
{
|
||||
title: 'AI',
|
||||
items: [
|
||||
|
Loading…
Reference in New Issue
Block a user