diff --git a/app/[locale]/(main)/page.tsx b/app/[locale]/(main)/page.tsx index 1f4cdb6..4de86cc 100644 --- a/app/[locale]/(main)/page.tsx +++ b/app/[locale]/(main)/page.tsx @@ -1,7 +1,13 @@ +import { unstable_setRequestLocale } from "next-intl/server"; import ServerList from "../../../components/ServerList"; import ServerOverview from "../../../components/ServerOverview"; -export default function Home() { +export default function Home({ + params: { locale }, +}: { + params: { locale: string }; +}) { + unstable_setRequestLocale(locale); return (
diff --git a/app/[locale]/layout.tsx b/app/[locale]/layout.tsx index 9bfb02c..2410b08 100644 --- a/app/[locale]/layout.tsx +++ b/app/[locale]/layout.tsx @@ -11,6 +11,8 @@ import { Inter as FontSans } from "next/font/google"; import { ThemeProvider } from "next-themes"; import { Viewport } from "next"; import { cn } from "@/lib/utils"; +import { locales } from "@/i18n-metadata"; +import { unstable_setRequestLocale } from "next-intl/server"; const fontSans = FontSans({ subsets: ["latin"], @@ -35,6 +37,12 @@ export const viewport: Viewport = { userScalable: false, }; +export const dynamic = "force-static"; + +export async function generateStaticParams() { + return locales.map((locale) => ({ locale })); +} + export default function LocaleLayout({ children, params: { locale }, @@ -42,6 +50,8 @@ export default function LocaleLayout({ children: React.ReactNode; params: { locale: string }; }) { + unstable_setRequestLocale(locale); + const messages = useMessages(); return ( diff --git a/next.config.mjs b/next.config.mjs index 5234c22..397de22 100644 --- a/next.config.mjs +++ b/next.config.mjs @@ -1,3 +1,9 @@ +import withBundleAnalyzer from "@next/bundle-analyzer"; + +const bundleAnalyzer = withBundleAnalyzer({ + enabled: process.env.ANALYZE === "true", +}); + import createNextIntlPlugin from "next-intl/plugin"; const withNextIntl = createNextIntlPlugin(); import withPWAInit from "@ducanh2912/next-pwa"; @@ -16,5 +22,10 @@ const withPWA = withPWAInit({ const nextConfig = { output: "standalone", reactStrictMode: true, + logging: { + fetches: { + fullUrl: true, + }, + }, }; -export default withPWA(withNextIntl(nextConfig)); +export default bundleAnalyzer(withPWA(withNextIntl(nextConfig)));