mirror of
https://github.com/hanzoai/next.js.git
synced 2026-10-30 14:46:38 +00:00
### What? 1. Rename [`app-dir-i18n-routing`](https://github.com/vercel/next.js/tree/canary/examples/app-dir-i18n-routing) example `i18n-routing`. 2. Rename [`i18n-routing`](https://github.com/vercel/next.js/tree/canary/examples/i18n-routing) example `i18n-routing-pages`. 3. Update the docs mentions i18n-routing examples. 4. Update the test includes i18n-routing examples. ### Why? The default has already been App Router anyways and a lot of examples have migrated over. x-ref: https://github.com/vercel/next.js/pull/72642#issuecomment-2474415343 ### How? Change them as in [reproduction-template](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template) and [reproduction-template-pages](https://github.com/vercel/next.js/tree/canary/examples/reproduction-template-pages) examples. ### Improving Documentation - [x] Run `pnpm prettier-fix` to fix formatting issues before opening the PR. - [x] Read the Docs Contribution Guide to ensure your contribution follows the docs guidelines: https://nextjs.org/docs/community/contribution-guide ### Adding or Updating Examples - [x] The "examples guidelines" are followed from our contributing doc https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md - [x] Make sure the linting passes by running `pnpm build && pnpm lint`. See https://github.com/vercel/next.js/blob/canary/contributing/repository/linting.md Co-authored-by: Delba de Oliveira <[email protected]>
50 lines
1.1 KiB
TypeScript
50 lines
1.1 KiB
TypeScript
import type { GetServerSideProps, InferGetServerSidePropsType } from "next";
|
|
|
|
import Link from "next/link";
|
|
import { useRouter } from "next/router";
|
|
import LocaleSwitcher from "../components/locale-switcher";
|
|
|
|
type GsspPageProps = InferGetServerSidePropsType<typeof getServerSideProps>;
|
|
|
|
export default function GsspPage(props: GsspPageProps) {
|
|
const router = useRouter();
|
|
const { defaultLocale } = router;
|
|
|
|
return (
|
|
<div>
|
|
<h1>getServerSideProps page</h1>
|
|
<p>Current locale: {props.locale}</p>
|
|
<p>Default locale: {defaultLocale}</p>
|
|
<p>Configured locales: {JSON.stringify(props.locales)}</p>
|
|
|
|
<LocaleSwitcher />
|
|
|
|
<Link href="/gsp">To getStaticProps page</Link>
|
|
<br />
|
|
|
|
<Link href="/gsp/first">To dynamic getStaticProps page</Link>
|
|
<br />
|
|
|
|
<Link href="/">To index page</Link>
|
|
<br />
|
|
</div>
|
|
);
|
|
}
|
|
|
|
type Props = {
|
|
locale?: string;
|
|
locales?: string[];
|
|
};
|
|
|
|
export const getServerSideProps: GetServerSideProps<Props> = async ({
|
|
locale,
|
|
locales,
|
|
}) => {
|
|
return {
|
|
props: {
|
|
locale,
|
|
locales,
|
|
},
|
|
};
|
|
};
|