Skip to content

Commit 4e06d8e

Browse files
ericyangpanclaude
andcommitted
refactor(pages): use tComponent + tShared translation pattern
- Update ai-coding-stack page - Update articles page - Update curated-collections page - Update docs page - Update manifesto page - Update open-source-rank page - Update comparison pages (clis, extensions, ides, models) - Update models page and opengraph-image Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 36316c3 commit 4e06d8e

File tree

12 files changed

+41
-29
lines changed

12 files changed

+41
-29
lines changed

src/app/[locale]/ai-coding-stack/page.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ import type { LocalePageProps } from '@/types/locale'
1010
export async function generateMetadata({ params }: LocalePageProps) {
1111
const { locale } = await params
1212
const tPage = await getTranslations({ locale, namespace: 'pages.stacksOverview' })
13+
const tShared = await getTranslations({ locale, namespace: 'shared' })
1314

14-
const title = buildTitle({ title: tPage('title') })
15+
const title = buildTitle({ title: tShared('terms.aiCodingStack') })
1516
const description = tPage('subtitle')
1617

1718
return generateStaticPageMetadata({
@@ -28,23 +29,24 @@ export async function generateMetadata({ params }: LocalePageProps) {
2829
export default async function AICodingStackPage({ params }: LocalePageProps) {
2930
const { locale } = await params
3031
const tPage = await getTranslations({ locale, namespace: 'pages.stacksOverview' })
32+
const tShared = await getTranslations({ locale, namespace: 'shared' })
3133

3234
return (
3335
<>
3436
<Header />
3537

3638
<main className="max-w-8xl mx-auto px-[var(--spacing-md)] py-[var(--spacing-lg)]">
37-
<PageHeader title={tPage('title')} subtitle={tPage('subtitle')} />
39+
<PageHeader title={tShared('terms.aiCodingStack')} subtitle={tPage('subtitle')} />
3840

3941
{/* Stacks Grid */}
4042
<div className="grid grid-cols-1 md:grid-cols-3 gap-[var(--spacing-md)]">
4143
{[
42-
{ key: 'ides', path: 'ides' },
43-
{ key: 'clis', path: 'clis' },
44-
{ key: 'extensions', path: 'extensions' },
45-
{ key: 'models', path: 'models' },
46-
{ key: 'modelProviders', path: 'model-providers' },
47-
{ key: 'vendors', path: 'vendors' },
44+
{ key: 'ides', path: 'ides', category: 'ides' as const },
45+
{ key: 'clis', path: 'clis', category: 'clis' as const },
46+
{ key: 'extensions', path: 'extensions', category: 'extensions' as const },
47+
{ key: 'models', path: 'models', category: 'models' as const },
48+
{ key: 'modelProviders', path: 'model-providers', category: 'modelProviders' as const },
49+
{ key: 'vendors', path: 'vendors', category: 'vendors' as const },
4850
].map(stack => (
4951
<Link
5052
key={stack.key}
@@ -53,7 +55,7 @@ export default async function AICodingStackPage({ params }: LocalePageProps) {
5355
>
5456
<div className="flex justify-between items-start mb-[var(--spacing-md)]">
5557
<h3 className="text-2xl font-semibold tracking-tight">
56-
{tPage(`${stack.key}.title`)}
58+
{tShared(`categories.plural.${stack.category}`)}
5759
</h3>
5860
<span className="text-2xl text-[var(--color-text-muted)] group-hover:text-[var(--color-text)] group-hover:translate-x-1 transition-all">
5961

src/app/[locale]/articles/page.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,11 @@ import { buildTitle, generateStaticPageMetadata } from '@/lib/metadata'
1010
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) {
1111
const { locale } = await params
1212
const tPage = await getTranslations({ locale, namespace: 'pages.articles' })
13+
const tShared = await getTranslations({ locale, namespace: 'shared' })
1314

14-
const title = buildTitle({ title: `${tPage('title')} - AI Coding Insights & Tutorials` })
15+
const title = buildTitle({
16+
title: `${tShared('terms.articles')} - AI Coding Insights & Tutorials`,
17+
})
1518
const description = tPage('subtitle')
1619

1720
return generateStaticPageMetadata({
@@ -31,13 +34,14 @@ type Props = {
3134
export default async function ArticlesPage({ params }: Props) {
3235
const { locale } = await params
3336
const tPage = await getTranslations({ locale, namespace: 'pages.articles' })
37+
const tShared = await getTranslations({ locale, namespace: 'shared' })
3438
const articles = getArticles(locale)
3539
return (
3640
<>
3741
<Header />
3842

3943
<div className="max-w-8xl mx-auto px-[var(--spacing-md)] py-[var(--spacing-lg)]">
40-
<PageHeader title={tPage('title')} subtitle={tPage('subtitle')} />
44+
<PageHeader title={tShared('terms.articles')} subtitle={tPage('subtitle')} />
4145

4246
{/* Articles Grid */}
4347
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-[var(--spacing-md)]">

src/app/[locale]/clis/comparison/page.client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function CLIComparisonPageClient({ locale: _locale }: Props) {
2424
const columns: ComparisonColumn[] = [
2525
{
2626
key: 'vendor',
27-
label: tShared('terms.vendor'),
27+
label: tShared('categories.singular.vendor'),
2828
},
2929
{
3030
key: 'license',

src/app/[locale]/curated-collections/page.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@ import type { LocalePageProps } from '@/types/locale'
1212
export async function generateMetadata({ params }: LocalePageProps) {
1313
const { locale } = await params
1414
const tPage = await getTranslations({ locale, namespace: 'pages.curatedCollections' })
15+
const tShared = await getTranslations({ locale, namespace: 'shared' })
1516

16-
const title = buildTitle({ title: `${tPage('title')} - AI Coding Specs, Protocols & Tools` })
17+
const title = buildTitle({
18+
title: `${tShared('terms.curatedCollections')} - AI Coding Specs, Protocols & Tools`,
19+
})
1720
const description = tPage('subtitle')
1821

1922
return generateStaticPageMetadata({
@@ -30,6 +33,7 @@ export async function generateMetadata({ params }: LocalePageProps) {
3033
export default async function CuratedCollectionsPage({ params }: LocalePageProps) {
3134
const { locale } = await params
3235
const tPage = await getTranslations({ locale, namespace: 'pages.curatedCollections' })
36+
const tShared = await getTranslations({ locale, namespace: 'shared' })
3337
const collections = getCollections(locale)
3438
const sectionIds = getCollectionSectionIds()
3539

@@ -38,7 +42,7 @@ export default async function CuratedCollectionsPage({ params }: LocalePageProps
3842
<Header />
3943

4044
<div className="max-w-8xl mx-auto px-[var(--spacing-md)] py-[var(--spacing-lg)]">
41-
<PageHeader title={tPage('title')} subtitle={tPage('subtitle')} />
45+
<PageHeader title={tShared('terms.curatedCollections')} subtitle={tPage('subtitle')} />
4246

4347
{/* Main Content with Sidebar */}
4448
<div className="flex gap-[var(--spacing-lg)]">

src/app/[locale]/docs/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ type Props = {
1313
export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) {
1414
const { locale } = await params
1515
const tPage = await getTranslations({ locale, namespace: 'pages.docs' })
16+
const tShared = await getTranslations({ locale, namespace: 'shared' })
1617

17-
const title = buildTitle({ title: tPage('title') })
18+
const title = buildTitle({ title: tShared('terms.documentation') })
1819
const description = tPage('subtitle')
1920

2021
return generateStaticPageMetadata({

src/app/[locale]/extensions/comparison/page.client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function ExtensionComparisonPageClient({ locale: _locale }: Props
2323
const columns: ComparisonColumn[] = [
2424
{
2525
key: 'vendor',
26-
label: tShared('terms.vendor'),
26+
label: tShared('categories.singular.vendor'),
2727
},
2828
{
2929
key: 'license',

src/app/[locale]/ides/comparison/page.client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function IDEComparisonPageClient({ locale: _locale }: Props) {
2424
const columns: ComparisonColumn[] = [
2525
{
2626
key: 'vendor',
27-
label: tShared('terms.vendor'),
27+
label: tShared('categories.singular.vendor'),
2828
},
2929
{
3030
key: 'license',

src/app/[locale]/manifesto/page.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import type { LocalePageProps } from '@/types/locale'
1111
export async function generateMetadata({ params }: LocalePageProps) {
1212
const { locale } = await params
1313
const tPage = await getTranslations({ locale, namespace: 'pages.manifesto' })
14+
const tShared = await getTranslations({ locale, namespace: 'shared' })
1415

1516
return generateStaticPageMetadata({
1617
locale: locale as Locale,
1718
basePath: 'manifesto',
18-
title: buildTitle({ title: tPage('title') }),
19+
title: buildTitle({ title: tShared('terms.manifesto') }),
1920
description: tPage('subtitle'),
2021
keywords: 'AI Coding Manifesto, AI development philosophy, AI coding principles',
2122
ogType: 'website',
@@ -25,14 +26,15 @@ export async function generateMetadata({ params }: LocalePageProps) {
2526
export default async function ManifestoPage({ params }: LocalePageProps) {
2627
const { locale } = await params
2728
const tPage = await getTranslations({ locale, namespace: 'pages.manifesto' })
29+
const tShared = await getTranslations({ locale, namespace: 'shared' })
2830
const ManifestoContent = await getManifestoComponent(locale)
2931

3032
return (
3133
<>
3234
<Header />
3335

3436
<main className="max-w-6xl mx-auto px-[var(--spacing-md)] pt-[var(--spacing-lg)]">
35-
<PageHeader title={tPage('title')} subtitle={tPage('slogan')} />
37+
<PageHeader title={tShared('terms.manifesto')} subtitle={tPage('slogan')} />
3638

3739
{/* Manifesto Content */}
3840
<section className="prose prose-neutral dark:prose-invert max-w-none mb-[var(--spacing-xl)]">
@@ -47,7 +49,7 @@ export default async function ManifestoPage({ params }: LocalePageProps) {
4749
<div className="flex items-center justify-between">
4850
<div>
4951
<h2 className="text-2xl font-semibold tracking-[-0.02em] mb-[var(--spacing-xs)]">
50-
{tPage('exploreStack.title')}
52+
{tShared('terms.aiCodingStack')}
5153
</h2>
5254
<p className="text-sm text-[var(--color-text-secondary)]">
5355
{tPage('exploreStack.subtitle')}

src/app/[locale]/models/compare/[models]/opengraph-image.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ import { ImageResponse } from 'next/og'
22
import { OGImageTemplate } from '@/components/og/OGImageTemplate'
33
import { getModel } from '@/lib/data/fetchers'
44

5-
export const runtime = 'edge'
6-
75
export const size = {
86
width: 1200,
97
height: 630,

src/app/[locale]/models/comparison/page.client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export default function ModelComparisonPageClient({ locale: _locale }: Props) {
141141
const columns: ComparisonColumn[] = [
142142
{
143143
key: 'vendor',
144-
label: tShared('terms.vendor'),
144+
label: tShared('categories.singular.vendor'),
145145
},
146146
{
147147
key: 'links',

0 commit comments

Comments
 (0)