@@ -137,7 +137,7 @@ You can access the locale information via the Next.js router. For example, using
...
@@ -137,7 +137,7 @@ You can access the locale information via the Next.js router. For example, using
When [pre-rendering](/docs/basic-features/pages#static-generation-recommended) pages with `getStaticProps` or `getServerSideProps`, the locale information is provided in [the context](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) provided to the function.
When [pre-rendering](/docs/basic-features/pages#static-generation-recommended) pages with `getStaticProps` or `getServerSideProps`, the locale information is provided in [the context](https://nextjs.org/docs/basic-features/data-fetching#getstaticprops-static-generation) provided to the function.
When leveraging `getStaticPaths`, the supported locales are provided in the context parameter of the function under `locales`.
When leveraging `getStaticPaths`, the configured locales are provided in the context parameter of the function under `locales` and the configured defaultLocale under `defaultLocale`.
@@ -56,6 +56,7 @@ The `context` parameter is an object containing the following keys:
...
@@ -56,6 +56,7 @@ The `context` parameter is an object containing the following keys:
-`previewData` contains the preview data set by `setPreviewData`. See the [Preview Mode documentation](/docs/advanced-features/preview-mode.md).
-`previewData` contains the preview data set by `setPreviewData`. See the [Preview Mode documentation](/docs/advanced-features/preview-mode.md).
-`locale` contains the active locale (if enabled).
-`locale` contains the active locale (if enabled).
-`locales` contains all supported locales (if enabled).
-`locales` contains all supported locales (if enabled).
-`defaultLocale` contains the configured default locale (if enabled).
`getStaticProps` should return an object with:
`getStaticProps` should return an object with:
...
@@ -547,6 +548,9 @@ The `context` parameter is an object containing the following keys:
...
@@ -547,6 +548,9 @@ The `context` parameter is an object containing the following keys:
-`preview`: `preview` is `true` if the page is in the preview mode and `false` otherwise. See the [Preview Mode documentation](/docs/advanced-features/preview-mode.md).
-`preview`: `preview` is `true` if the page is in the preview mode and `false` otherwise. See the [Preview Mode documentation](/docs/advanced-features/preview-mode.md).
-`previewData`: The preview data set by `setPreviewData`. See the [Preview Mode documentation](/docs/advanced-features/preview-mode.md).
-`previewData`: The preview data set by `setPreviewData`. See the [Preview Mode documentation](/docs/advanced-features/preview-mode.md).
-`resolvedUrl`: A normalized version of the request URL that strips the `_next/data` prefix for client transitions and includes original query values.
-`resolvedUrl`: A normalized version of the request URL that strips the `_next/data` prefix for client transitions and includes original query values.
-`locale` contains the active locale (if enabled).
-`locales` contains all supported locales (if enabled).
-`defaultLocale` contains the configured default locale (if enabled).
> **Note**: You can import modules in top-level scope for use in `getServerSideProps`.
> **Note**: You can import modules in top-level scope for use in `getServerSideProps`.
> Imports used in `getServerSideProps` will not be bundled for the client-side.
> Imports used in `getServerSideProps` will not be bundled for the client-side.