Skip to content

Commit db95243

Browse files
authored
docs: Update legacy example to use next-intl instead of use-intl (#1583)
Related to #1282
1 parent 6d94a9e commit db95243

File tree

6 files changed

+9
-15
lines changed

6 files changed

+9
-15
lines changed

docs/src/pages/docs/getting-started/pages-router.mdx

-6
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,3 @@ export async function getStaticProps() {
109109
</ul>
110110

111111
</Callout>
112-
113-
## Support for legacy Next.js versions
114-
115-
Next.js version 10, 11 and 12 are still supported. Note however that instead of installing `next-intl`, you'll have to import functionality like `useTranslations` from [`use-intl`](/docs/environments/core-library#react-apps).
116-
117-
See the [legacy example](https://github.com/amannn/next-intl/tree/main/examples/example-pages-router-legacy).

examples/example-pages-router-legacy/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"next": "^12.0.0",
1212
"react": "^17.0.0",
1313
"react-dom": "^17.0.0",
14-
"use-intl": "^3.0.0"
14+
"next-intl": "^3.0.0"
1515
},
1616
"devDependencies": {
1717
"eslint": "^9.11.1",
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
import Head from 'next/head';
22
import {useRouter} from 'next/router';
3-
import {IntlProvider} from 'use-intl';
3+
import {NextIntlClientProvider} from 'next-intl';
44

55
export default function App({Component, pageProps}) {
66
const router = useRouter();
77
const {messages, now, ...rest} = pageProps;
88

99
return (
10-
<IntlProvider
10+
<NextIntlClientProvider
1111
locale={router.locale}
1212
messages={messages}
1313
now={new Date(now)}
@@ -17,6 +17,6 @@ export default function App({Component, pageProps}) {
1717
<title>example-pages-router-legacy</title>
1818
</Head>
1919
<Component {...rest} />
20-
</IntlProvider>
20+
</NextIntlClientProvider>
2121
);
2222
}

examples/example-pages-router-legacy/src/pages/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {useFormatter, useNow, useTranslations} from 'use-intl';
1+
import {useFormatter, useNow, useTranslations} from 'next-intl';
22
import PageLayout from '../components/PageLayout';
33

44
export default function Index() {

packages/next-intl/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
"use-intl": "workspace:^"
116116
},
117117
"peerDependencies": {
118-
"next": "^13.0.0 || ^14.0.0 || ^15.0.0",
118+
"next": "^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0",
119119
"react": "^17.0.0 || ^18.0.0 || >=19.0.0-rc <19.0.0",
120120
"typescript": "^5.0.0"
121121
},

pnpm-lock.yaml

+3-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)