diff --git a/apps/landing/README.md b/apps/landing/README.md index aae0f6779..08e3fb5c2 100644 --- a/apps/landing/README.md +++ b/apps/landing/README.md @@ -56,16 +56,15 @@ the existing components layout. For home, showcase and components overview, add page.ko.tsx beside page.tsx and register its pathname in src/i18n/pages.ts (home uses /). Translate the component overview's Description.mdx as Description.ko.mdx beside it. Reuse the interactive -components. Introduce matching keys in src/i18n/messages/en.json and ko.json, -and load catalogs in src/i18n/request.ts, merging English defaults with Korean -overrides per namespace. In SiteLayout, pass getMessages({locale}) to -NextIntlClientProvider. Client components use useTranslations; server components -use getTranslations({locale}) from next-intl/server with an explicit locale. -These catalogs are introduced by the first TSX/shared-UI translation contribution; -the current provider has no translated UI messages. Keep state identifiers and +components. Shared UI copy lives in src/i18n/messages/en.json and ko.json, one +namespace per component; add matching keys to both. src/i18n/request.ts merges +the English defaults with the Korean overrides per namespace, and SiteLayout +passes getMessages({locale}) to NextIntlClientProvider. Client components use +useTranslations; server components use getTranslations({locale}) from +next-intl/server with an explicit locale. Keep state identifiers and component/API names unchanged. -Shared navigation, search labels and footer belong to their own issue. Search +The shared header, sidebars, table of contents and search use these catalogs. Search indexes are built by script.js: Korean MDX replaces its English entry, and other entries stay English. Use Link and usePathname from @/i18n/navigation for internal navigation; use next/link for static assets such as /storybook/index.html. diff --git a/apps/landing/src/app/(detail)/components/LeftMenu.tsx b/apps/landing/src/app/(detail)/components/LeftMenu.tsx index 3439df299..5fbad57b1 100644 --- a/apps/landing/src/app/(detail)/components/LeftMenu.tsx +++ b/apps/landing/src/app/(detail)/components/LeftMenu.tsx @@ -1,11 +1,14 @@ +'use client' import { VStack } from '@devup-ui/react' +import { useTranslations } from 'next-intl' import { MenuItem } from '../docs/MenuItem' export function LeftMenu() { + const t = useTranslations('ComponentsMenu') return ( - Overview + {t('overview')} - Form + {t('form')} - Layout + {t('layout')} - Theme + {t('theme')} ) diff --git a/apps/landing/src/app/(detail)/docs/LeftMenu.tsx b/apps/landing/src/app/(detail)/docs/LeftMenu.tsx index 67873d607..db5adc836 100644 --- a/apps/landing/src/app/(detail)/docs/LeftMenu.tsx +++ b/apps/landing/src/app/(detail)/docs/LeftMenu.tsx @@ -1,48 +1,54 @@ +'use client' import { VStack } from '@devup-ui/react' +import { useTranslations } from 'next-intl' import { MenuItem } from './MenuItem' export function LeftMenu() { + const t = useTranslations('DocsMenu') return ( - Overview - Quick Start - Installation + {t('overview')} + {t('quickStart')} + {t('installation')} - Core Concepts + {t('coreConcepts')} - Features - Supported Syntax & Limitations - Build Errors + {t('features')} + {t('limitations')} + {t('buildErrors')} - Migration + {t('migration')} - Figma and Theme Integration + {t('figmaAndThemeIntegration')} @@ -144,31 +150,31 @@ export function LeftMenu() { subMenu={[ { to: '/docs/devup/devup-json', - children: 'What is devup?', + children: t('whatIsDevup'), }, { to: '/docs/devup/colors', - children: 'Colors', + children: t('colors'), }, { to: '/docs/devup/typography', - children: 'Typography', + children: t('typography'), }, { to: '/docs/devup/length', - children: 'Length', + children: t('length'), }, { to: '/docs/devup/shadow', - children: 'Shadow', + children: t('shadow'), }, { to: '/docs/devup/breakpoints', - children: 'Breakpoints', + children: t('breakpoints'), }, { to: '/docs/devup/figma-plugin', - children: 'Figma Plugin', + children: t('figmaPlugin'), }, ]} > diff --git a/apps/landing/src/app/(detail)/docs/RightIndex.tsx b/apps/landing/src/app/(detail)/docs/RightIndex.tsx index d129162ac..53c04045c 100644 --- a/apps/landing/src/app/(detail)/docs/RightIndex.tsx +++ b/apps/landing/src/app/(detail)/docs/RightIndex.tsx @@ -1,6 +1,6 @@ 'use client' import { Box, css, Flex, Text, VStack } from '@devup-ui/react' -import { useLocale } from 'next-intl' +import { useLocale, useTranslations } from 'next-intl' import { useEffect, useState } from 'react' import { Link, usePathname } from '@/i18n/navigation' @@ -42,6 +42,7 @@ function IndexMenu({ export function RightIndex() { const pathname = usePathname() const locale = useLocale() + const t = useTranslations('RightIndex') const isDocs = pathname.startsWith('/docs/') const isComponents = pathname.startsWith('/components/') const editUrl = isDocs @@ -100,7 +101,7 @@ export function RightIndex() { - Contents + {t('contents')} {menus.map((menu) => ( @@ -130,7 +131,7 @@ export function RightIndex() { textAlign="right" typography="small" > - Edit this page + {t('editThisPage')} Docs + {t('docs')} @@ -132,7 +135,7 @@ export function Header() { })} href="/components/overview" > - Components + {t('components')} @@ -142,7 +145,7 @@ export function Header() { })} href="/showcase" > - Showcase + {t('showcase')} @@ -152,7 +155,7 @@ export function Header() { })} href="/team" > - Team + {t('team')} @@ -199,7 +202,7 @@ export function Header() { > - + diff --git a/apps/landing/src/components/SearchModal/SearchContent.tsx b/apps/landing/src/components/SearchModal/SearchContent.tsx index aafd3de64..ed2f97fc9 100644 --- a/apps/landing/src/components/SearchModal/SearchContent.tsx +++ b/apps/landing/src/components/SearchModal/SearchContent.tsx @@ -1,6 +1,6 @@ 'use client' import { Box, Center, css, Flex, Text, VStack } from '@devup-ui/react' -import { useLocale } from 'next-intl' +import { useLocale, useTranslations } from 'next-intl' import { Fragment, useEffect, useState } from 'react' import { Link } from '@/i18n/navigation' @@ -47,6 +47,7 @@ function getHighlightedParts(text: string, query: string) { export function SearchContent() { const query = useQueryParam('query') const locale = useLocale() + const t = useTranslations('Search') const [data, setData] = useState() useEffect(() => { if (!query) return @@ -131,13 +132,13 @@ export function SearchContent() { textAlign="center" typography="caption" > - No recent searches + {t('noResults')} )} ) : ( -

Loading...

+

{t('loading')}

) return ( diff --git a/apps/landing/src/components/layout/SiteLayout.tsx b/apps/landing/src/components/layout/SiteLayout.tsx index ceb0ab313..51358fad6 100644 --- a/apps/landing/src/components/layout/SiteLayout.tsx +++ b/apps/landing/src/components/layout/SiteLayout.tsx @@ -1,8 +1,8 @@ import { Box, css, globalCss, ThemeScript } from '@devup-ui/react' import { resetCss } from '@devup-ui/reset-css' import ReactLenis from 'lenis/react' -import { NextIntlClientProvider } from 'next-intl' -import { setRequestLocale } from 'next-intl/server' +import { type Locale, NextIntlClientProvider } from 'next-intl' +import { getMessages, setRequestLocale } from 'next-intl/server' import { AnchorScroll } from '@/components/AnchorScroll' import { Footer } from '@/components/Footer' @@ -115,14 +115,15 @@ globalCss({ }, }) -export function SiteLayout({ +export async function SiteLayout({ children, locale = 'en', }: Readonly<{ children: React.ReactNode - locale?: 'en' | 'ko' + locale?: Locale }>) { setRequestLocale(locale) + const messages = await getMessages({ locale }) return ( @@ -170,12 +171,12 @@ export function SiteLayout({ - + -
+
{children}