Skip to content

Commit 0391cc8

Browse files
authored
feat: Support Next.js 12 (amannn#61)
1 parent 41e2731 commit 0391cc8

9 files changed

Lines changed: 309 additions & 9 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
> A minimal, but complete solution for managing translations, date, time and number formatting in Next.js apps.
1111
12-
![Gzipped size](https://badgen.net/bundlephobia/minzip/next-intl) ![Tree shaking supported](https://badgen.net/bundlephobia/tree-shaking/next-intl) ![Build passing](https://img.shields.io/github/workflow/status/amannn/next-intl/main)
12+
![Gzipped size](https://badgen.net/bundlephobia/minzip/next-intl) ![Tree shaking supported](https://badgen.net/bundlephobia/tree-shaking/next-intl) [<img src="https://img.shields.io/npm/dw/next-intl.svg" />](https://www.npmjs.com/package/next-intl)
1313

1414
This library complements the [internationalized routing](https://nextjs.org/docs/advanced-features/i18n-routing) capabilities of Next.js by managing translations and providing them to components.
1515

media/logo.sketch

1.34 KB
Binary file not shown.

packages/example/next-env.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/types/global" />
3+
/// <reference types="next/image-types/global" />
4+
5+
// NOTE: This file should not be edited
6+
// see https://nextjs.org/docs/basic-features/typescript for more information.

packages/example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
},
1212
"dependencies": {
1313
"date-fns": "^2.16.1",
14-
"next": "^11.0.0",
14+
"next": "^12.0.1",
1515
"next-intl": "^2.0.5",
1616
"react": "^17.0.0",
1717
"react-dom": "^17.0.0"

packages/example/src/pages/_app.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export default function App({Component, pageProps}: AppProps) {
2626
// Also an explicit time zone is helpful to ensure dates render the
2727
// same way on the client as on the server, which might be located
2828
// in a different time zone.
29-
timeZone="Austria/Vienna"
29+
timeZone="UTC"
3030
>
3131
<Component {...pageProps} />
3232
</NextIntlProvider>

packages/example/src/pages/about.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export default function About() {
1414
return (
1515
<PageLayout title={t('title')}>
1616
<p>
17-
{t('description', {
17+
{t.rich('description', {
1818
locale,
1919
code: (children) => <Code>{children}</Code>
2020
})}
2121
</p>
2222
<p>
23-
{t('lastUpdated', {
23+
{t.rich('lastUpdated', {
2424
lastUpdated,
2525
lastUpdatedRelative: intl.formatRelativeTime(lastUpdated)
2626
})}

packages/example/src/pages/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default function Index() {
1111
return (
1212
<PageLayout title={t('title')}>
1313
<p>
14-
{t('description', {
14+
{t.rich('description', {
1515
locale,
1616
code: (children) => <Code>{children}</Code>
1717
})}

packages/next-intl/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
"use-intl": "^2.0.5"
4141
},
4242
"peerDependencies": {
43-
"next": "^10.0.0 || ^11.0.0",
43+
"next": "^10.0.0 || ^11.0.0 || ^12.0.0",
4444
"react": "^16.8.0 || ^17.0.0"
4545
},
4646
"devDependencies": {

yarn.lock

Lines changed: 298 additions & 2 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)