-
-
Notifications
You must be signed in to change notification settings - Fork 261
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wording fixes and streamline examples
- Loading branch information
Showing
13 changed files
with
82 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 2 additions & 7 deletions
9
examples/example-app-router-migration/src/app/[locale]/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import {ReactNode} from 'react'; | ||
|
||
type Props = { | ||
children: ReactNode; | ||
}; | ||
|
||
// Since we have a `not-found.tsx` page on the root, a layout file | ||
// is required, even if it's just passing children through. | ||
export default function RootLayout({children}: Props) { | ||
return children; | ||
} |
17 changes: 17 additions & 0 deletions
17
examples/example-app-router-migration/src/app/not-found.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use client'; | ||
|
||
import Error from 'next/error'; | ||
|
||
// Render the default Next.js 404 page when a route | ||
// is requested that doesn't match the middleware and | ||
// therefore doesn't have a locale associated with it. | ||
|
||
export default function NotFound() { | ||
return ( | ||
<html lang="en"> | ||
<body> | ||
<Error statusCode={404} /> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import {notFound} from 'next/navigation'; | ||
import {getRequestConfig} from 'next-intl/server'; | ||
import {locales} from './navigation'; | ||
|
||
export default getRequestConfig(async ({locale}) => ({ | ||
messages: (await import(`../messages/${locale}.json`)).default | ||
})); | ||
export default getRequestConfig(async ({locale}) => { | ||
// Validate that the incoming `locale` parameter is valid | ||
if (!locales.includes(locale as any)) notFound(); | ||
|
||
return { | ||
messages: (await import(`../messages/${locale}.json`)).default | ||
}; | ||
}); |
15 changes: 3 additions & 12 deletions
15
examples/example-app-router-next-auth/src/app/[locale]/layout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
examples/example-app-router-next-auth/src/app/not-found.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
'use client'; | ||
|
||
import Error from 'next/error'; | ||
|
||
// Render the default Next.js 404 page when a route | ||
// is requested that doesn't match the middleware and | ||
// therefore doesn't have a locale associated with it. | ||
|
||
export default function NotFound() { | ||
return ( | ||
<html lang="en"> | ||
<body> | ||
<Error statusCode={404} /> | ||
</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,12 @@ | ||
import {notFound} from 'next/navigation'; | ||
import {getRequestConfig} from 'next-intl/server'; | ||
import {locales} from './navigation'; | ||
|
||
export default getRequestConfig(async ({locale}) => ({ | ||
messages: (await import(`../messages/${locale}.json`)).default | ||
})); | ||
export default getRequestConfig(async ({locale}) => { | ||
// Validate that the incoming `locale` parameter is valid | ||
if (!locales.includes(locale as any)) notFound(); | ||
|
||
return { | ||
messages: (await import(`../messages/${locale}.json`)).default | ||
}; | ||
}); |
4 changes: 0 additions & 4 deletions
4
examples/example-app-router-playground/src/app/[locale]/[...rest]/page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
import {notFound} from 'next/navigation'; | ||
|
||
export default function CatchAll() { | ||
// `not-found` currently only renders when triggered by the `notFound` function | ||
// https://beta.nextjs.org/docs/api-reference/file-conventions/not-found | ||
notFound(); | ||
|
||
return null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters