import Link from 'next/link' import { useRouter } from 'next/router' export default function Page(props) { const router = useRouter() if (router.isFallback) return 'Loading...' return ( <>

gsp page

{JSON.stringify(props)}

{router.locale}

{router.defaultLocale}

{JSON.stringify(router.locales)}

{JSON.stringify(router.query)}

{router.pathname}

{router.asPath}

to /
) } export const getStaticProps = ({ params, locale, locales, defaultLocale }) => { // ensure getStaticProps isn't called without params if (!params || !params.slug) { throw new Error(`missing params ${JSON.stringify(params)}`) } if (params && params.slug === 'mixed-not-found-redirect') { return { notFound: true, redirect: { destination: '/another', permanent: false, }, } } return { props: { params, locale, locales, defaultLocale, }, } } export const getStaticPaths = ({ locales, defaultLocale }) => { // make sure locales were provided correctly if (!locales || locales.length !== 7) { throw new Error( 'locales missing in getStaticPaths!! got: ' + JSON.stringify(locales) ) } if (!defaultLocale) { throw new Error('missing defaultLocale in getStaticPaths') } const paths = [ // the default locale will be used since one isn't defined here { params: { slug: 'first' } }, { params: { slug: 'second' } }, ] for (const locale of locales) { paths.push({ params: { slug: 'always' }, locale }) } return { paths, fallback: true, } }