File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
examples/example-app-router/src/app/[locale] Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
import clsx from 'clsx' ;
2
2
import { Inter } from 'next/font/google' ;
3
- import { getTranslations , unstable_setRequestLocale } from 'next-intl/server' ;
3
+ import { NextIntlClientProvider } from 'next-intl' ;
4
+ import {
5
+ getMessages ,
6
+ getTranslations ,
7
+ unstable_setRequestLocale
8
+ } from 'next-intl/server' ;
4
9
import { ReactNode } from 'react' ;
5
10
import Navigation from '@/components/Navigation' ;
6
11
import { locales } from '@/config' ;
@@ -33,11 +38,17 @@ export default async function LocaleLayout({
33
38
// Enable static rendering
34
39
unstable_setRequestLocale ( locale ) ;
35
40
41
+ // Providing all messages to the client
42
+ // side is the easiest way to get started
43
+ const messages = await getMessages ( ) ;
44
+
36
45
return (
37
46
< html className = "h-full" lang = { locale } >
38
47
< body className = { clsx ( inter . className , 'flex h-full flex-col' ) } >
39
- < Navigation />
40
- { children }
48
+ < NextIntlClientProvider messages = { messages } >
49
+ < Navigation />
50
+ { children }
51
+ </ NextIntlClientProvider >
41
52
</ body >
42
53
</ html >
43
54
) ;
You can’t perform that action at this time.
0 commit comments