Skip to content

Commit 2e60781

Browse files
committed
Make i18n static
1 parent 9b9f848 commit 2e60781

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/app/(frontend)/[locale]/page.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { draftMode } from 'next/headers'
44
import RefreshRouteOnSave from '@/components/admin/RefreshRouteOnSave'
55
import { MainPageImage, Media } from '@/payload-types'
66
import { RichText } from '@payloadcms/richtext-lexical/react'
7-
import { getTranslations } from 'next-intl/server'
7+
import { getTranslations, setRequestLocale } from 'next-intl/server'
88
import headersConverter from '@/lib/utils/converter'
99
import { Metadata } from 'next'
1010

@@ -192,6 +192,7 @@ export const dynamic = 'error'
192192
export default async function MainPage({ params }: Props) {
193193
const payload = await getPayload({ config })
194194
const { locale } = await params
195+
setRequestLocale(locale)
195196
const t = await getTranslations({ locale, namespace: 'NavBar' })
196197

197198
const { isEnabled } = await draftMode()
@@ -215,7 +216,7 @@ export default async function MainPage({ params }: Props) {
215216
return (
216217
<div
217218
id="welcome"
218-
className="header-screen flex flex-col lg:flex-row [&_figcaption]:flex [&_figcaption]:items-center [&_figcaption]:justify-center [&_figure]:pb-0! justify-stretch items-center grow lg:px-10 mb-20 lg:mb-0"
219+
className="header-screen flex flex-col lg:flex-row [&_figcaption]:flex [&_figcaption]:items-center [&_figcaption]:justify-center [&_figure]:pb-0! [&>div]:px-0! justify-stretch items-center grow lg:px-10 mb-20 lg:mb-0"
219220
key={image.id}
220221
style={{ backgroundColor: image.bgColor }}
221222
>

src/app/(frontend)/[locale]/projects/page.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Suspense } from 'react'
55
import { draftMode } from 'next/headers'
66
import RefreshRouteOnSave from '@/components/admin/RefreshRouteOnSave'
77
import { Metadata } from 'next'
8-
import { getTranslations } from 'next-intl/server'
8+
import { getTranslations, setRequestLocale } from 'next-intl/server'
99
import { Media } from '@/payload-types'
1010

1111
export const dynamic = 'error'
@@ -45,6 +45,8 @@ export async function generateMetadata({
4545
}): Promise<Metadata> {
4646
const { locale } = await params
4747

48+
setRequestLocale(locale)
49+
4850
const t = await getTranslations({ locale })
4951
const title = t('NavBar.projects')
5052

0 commit comments

Comments
 (0)