File tree Expand file tree Collapse file tree 3 files changed +21
-20
lines changed
examples/app-dir-i18n-routing Expand file tree Collapse file tree 3 files changed +21
-20
lines changed Original file line number Diff line number Diff line change 1
1
import { i18n , type Locale } from "../../i18n-config" ;
2
2
3
+ export const metadata = {
4
+ title : "i18n within app directory - Vercel Examples" ,
5
+ description : "How to do i18n in Next.js 13 within app directory" ,
6
+ } ;
7
+
3
8
export async function generateStaticParams ( ) {
4
9
return i18n . locales . map ( ( locale ) => ( { lang : locale } ) ) ;
5
10
}
6
11
7
- export default function Root ( {
8
- children,
9
- params,
10
- } : {
12
+ export default async function Root ( props : {
11
13
children : React . ReactNode ;
12
- params : { lang : Locale } ;
14
+ params : Promise < { lang : Locale } > ;
13
15
} ) {
16
+ const params = await props . params ;
17
+
18
+ const { children } = props ;
19
+
14
20
return (
15
21
< html lang = { params . lang } >
16
22
< body > { children } </ body >
17
23
</ html >
18
24
) ;
19
25
}
20
-
21
- export const metadata = {
22
- title : "i18n within app directory - Vercel Examples" ,
23
- description : "How to do i18n in Next.js 13 within app directory" ,
24
- } ;
Original file line number Diff line number Diff line change @@ -3,11 +3,11 @@ import { Locale } from "../../i18n-config";
3
3
import Counter from "./components/counter" ;
4
4
import LocaleSwitcher from "./components/locale-switcher" ;
5
5
6
- export default async function IndexPage ( {
7
- params : { lang } ,
8
- } : {
9
- params : { lang : Locale } ;
6
+ export default async function IndexPage ( props : {
7
+ params : Promise < { lang : Locale } > ;
10
8
} ) {
9
+ const { lang } = await props . params ;
10
+
11
11
const dictionary = await getDictionary ( lang ) ;
12
12
13
13
return (
Original file line number Diff line number Diff line change 1
1
{
2
2
"private" : true ,
3
3
"scripts" : {
4
- "dev" : " next" ,
4
+ "dev" : " next dev " ,
5
5
"build" : " next build" ,
6
6
"start" : " next start"
7
7
},
8
8
"dependencies" : {
9
- "@formatjs/intl-localematcher" : " 0.2.32 " ,
10
- "negotiator" : " 0.6.3 " ,
9
+ "@formatjs/intl-localematcher" : " 0.5.7 " ,
10
+ "negotiator" : " 1.0.0 " ,
11
11
"next" : " latest" ,
12
12
"react" : " ^18.2.0" ,
13
13
"react-dom" : " ^18.2.0" ,
14
14
"server-only" : " 0.0.1"
15
15
},
16
16
"devDependencies" : {
17
- "@types/negotiator" : " 0.6.1 " ,
18
- "@types/node" : " ^18.11.5 " ,
17
+ "@types/negotiator" : " 0.6.3 " ,
18
+ "@types/node" : " ^22.9.0 " ,
19
19
"@types/react" : " ^18.0.23" ,
20
20
"@types/react-dom" : " ^18.0.7" ,
21
- "typescript" : " ^4.8.4 "
21
+ "typescript" : " ^5.6.3 "
22
22
}
23
23
}
You can’t perform that action at this time.
0 commit comments