Skip to content

Commit 87f09c5

Browse files
dengzhaofunclaude
andauthored
feat(landing): add i18n + language switcher to TopNav (#163)
Nav links and CTA buttons were hardcoded Chinese strings in MarketingShell. Switch them to Paraglide messages so they follow the active locale, and add LanguageSwitcher to TopNav so users can toggle language from the landing page. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 24e929a commit 87f09c5

3 files changed

Lines changed: 34 additions & 13 deletions

File tree

apps/admin/messages/en.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3245,5 +3245,13 @@
32453245
"aria_more_actions": "More actions",
32463246
"aria_loading_chart": "Loading chart",
32473247
"members_more_actions": "More actions",
3248-
"invitations_more_actions": "More actions"
3248+
"invitations_more_actions": "More actions",
3249+
"nav_platform": "Platform",
3250+
"nav_modules": "Modules",
3251+
"nav_workflow": "Workflow",
3252+
"nav_developer": "Developer",
3253+
"nav_pricing": "Pricing",
3254+
"nav_docs": "Docs",
3255+
"auth_sign_in": "Sign in",
3256+
"auth_sign_up_cta": "Get started"
32493257
}

apps/admin/messages/zh.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3245,5 +3245,13 @@
32453245
"aria_more_actions": "更多操作",
32463246
"aria_loading_chart": "图表加载中",
32473247
"members_more_actions": "更多操作",
3248-
"invitations_more_actions": "更多操作"
3248+
"invitations_more_actions": "更多操作",
3249+
"nav_platform": "平台",
3250+
"nav_modules": "模块",
3251+
"nav_workflow": "工作流",
3252+
"nav_developer": "开发者",
3253+
"nav_pricing": "定价",
3254+
"nav_docs": "文档",
3255+
"auth_sign_in": "登录",
3256+
"auth_sign_up_cta": "免费开始"
32493257
}

apps/admin/src/components/landing/MarketingShell.tsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { Link } from "@tanstack/react-router";
22
import { ArrowRight, Github } from "lucide-react"
33

44
import { ConsentSettingsButton } from "#/components/consent/ConsentLayer"
5+
import { LanguageSwitcher } from "#/components/LanguageSwitcher"
56
import ThemeToggle from "#/components/ThemeToggle"
67
import { Button } from "#/components/ui/button"
8+
import * as m from "#/paraglide/messages.js"
79
import { getLocale } from "#/paraglide/runtime.js"
810

911
const t = (zh: string, en: string) => (getLocale() === "zh" ? zh : en)
@@ -35,14 +37,16 @@ export function SectionTitle({ children }: { children: React.ReactNode }) {
3537
/* Nav + Footer */
3638
/* -------------------------------------------------------------------------- */
3739

38-
const NAV_LINKS: Array<{ label: string; href: string; type: "anchor" | "route" }> = [
39-
{ label: "平台", href: "/#platform", type: "anchor" },
40-
{ label: "模块", href: "/#modules", type: "anchor" },
41-
{ label: "工作流", href: "/#workflow", type: "anchor" },
42-
{ label: "开发者", href: "/#developer", type: "anchor" },
43-
{ label: "定价", href: "/pricing", type: "route" },
44-
{ label: "文档", href: "/docs", type: "route" },
45-
]
40+
function getNavLinks() {
41+
return [
42+
{ label: m.nav_platform(), href: "/#platform", type: "anchor" as const },
43+
{ label: m.nav_modules(), href: "/#modules", type: "anchor" as const },
44+
{ label: m.nav_workflow(), href: "/#workflow", type: "anchor" as const },
45+
{ label: m.nav_developer(), href: "/#developer", type: "anchor" as const },
46+
{ label: m.nav_pricing(), href: "/pricing", type: "route" as const },
47+
{ label: m.nav_docs(), href: "/docs", type: "route" as const },
48+
]
49+
}
4650

4751
function TopNav() {
4852
return (
@@ -55,18 +59,19 @@ function TopNav() {
5559
<span>ApolloKit</span>
5660
</Link>
5761
<nav className="hidden items-center gap-6 text-sm text-muted-foreground md:flex">
58-
{NAV_LINKS.map((l) => (
62+
{getNavLinks().map((l) => (
5963
<a key={l.href} href={l.href} className="hover:text-foreground">
6064
{l.label}
6165
</a>
6266
))}
6367
</nav>
6468
<div className="ml-auto flex items-center gap-2">
69+
<LanguageSwitcher />
6570
<ThemeToggle />
6671
<Button
6772
render={
6873
<Link to="/auth/$authView" params={{ authView: "sign-in" }}>
69-
登录
74+
{m.auth_sign_in()}
7075
</Link>
7176
}
7277
variant="ghost"
@@ -76,7 +81,7 @@ function TopNav() {
7681
<Button
7782
render={
7883
<Link to="/auth/$authView" params={{ authView: "sign-up" }}>
79-
免费开始
84+
{m.auth_sign_up_cta()}
8085
<ArrowRight className="ml-1 size-3.5" />
8186
</Link>
8287
}

0 commit comments

Comments
 (0)