QuiiBz / next-international

Type-safe internationalization (i18n) for Next.js
https://next-international.vercel.app
MIT License
1.31k stars 61 forks source link

static site routing (ssg) #422

Open liqwtf opened 2 months ago

liqwtf commented 2 months ago

When navigating to another page using the next/link component it throws an error that the page is not included in the params of /[locale]/page

how do i solve this issue in static site generation (output: "export")

liqwtf commented 2 months ago

image

liqwtf commented 2 months ago

i also tried creating a custom Link component

import NextLink from "next/link";
import type { ComponentProps } from "react";
import { getCurrentLocale } from "./server";

export default function Link({
  href,
  children,
  ...rest
}: Readonly<{ href: string; className?: string; children: React.ReactNode }> &
  ComponentProps<typeof NextLink>) {
  const locale = getCurrentLocale();

  return (
    <NextLink href={`/${locale}${href}`} locale={locale} {...rest}>
      {children}
    </NextLink>
  );
}

but when pressed it just refreshes the page

even though in the dev tools it looks good with the href /en/settings