Skip to content

Commit

Permalink
feat: Support Next.js 12 (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn authored Oct 27, 2021
1 parent 41e2731 commit 0391cc8
Show file tree
Hide file tree
Showing 9 changed files with 309 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

> A minimal, but complete solution for managing translations, date, time and number formatting in Next.js apps.
![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)
![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)

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.

Expand Down
Binary file modified media/logo.sketch
Binary file not shown.
4 changes: 4 additions & 0 deletions packages/example/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
2 changes: 1 addition & 1 deletion packages/example/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"dependencies": {
"date-fns": "^2.16.1",
"next": "^11.0.0",
"next": "^12.0.1",
"next-intl": "^2.0.5",
"react": "^17.0.0",
"react-dom": "^17.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/example/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function App({Component, pageProps}: AppProps) {
// Also an explicit time zone is helpful to ensure dates render the
// same way on the client as on the server, which might be located
// in a different time zone.
timeZone="Austria/Vienna"
timeZone="UTC"
>
<Component {...pageProps} />
</NextIntlProvider>
Expand Down
4 changes: 2 additions & 2 deletions packages/example/src/pages/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export default function About() {
return (
<PageLayout title={t('title')}>
<p>
{t('description', {
{t.rich('description', {
locale,
code: (children) => <Code>{children}</Code>
})}
</p>
<p>
{t('lastUpdated', {
{t.rich('lastUpdated', {
lastUpdated,
lastUpdatedRelative: intl.formatRelativeTime(lastUpdated)
})}
Expand Down
2 changes: 1 addition & 1 deletion packages/example/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default function Index() {
return (
<PageLayout title={t('title')}>
<p>
{t('description', {
{t.rich('description', {
locale,
code: (children) => <Code>{children}</Code>
})}
Expand Down
2 changes: 1 addition & 1 deletion packages/next-intl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"use-intl": "^2.0.5"
},
"peerDependencies": {
"next": "^10.0.0 || ^11.0.0",
"next": "^10.0.0 || ^11.0.0 || ^12.0.0",
"react": "^16.8.0 || ^17.0.0"
},
"devDependencies": {
Expand Down
300 changes: 298 additions & 2 deletions yarn.lock

Large diffs are not rendered by default.

0 comments on commit 0391cc8

Please sign in to comment.