mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-04-25 08:46:22 +02:00
- Deleted the empty middleware file as it was temporarily disabled for client-side i18n implementation. - Updated `next`, `next-intl`, and `fumadocs` packages to their latest versions. - Cleaned up the `next.config.ts` by removing the eslint configuration. - Enhanced `tsconfig.json` with additional paths for `fumadocs-mdx`. - Adjusted imports in `layout.tsx` and `request.ts` for better structure and functionality.
23 lines
748 B
TypeScript
23 lines
748 B
TypeScript
import { getRequestConfig } from "next-intl/server";
|
|
import { routing } from "./routing";
|
|
|
|
/**
|
|
* Configuration for internationalization request handling
|
|
* This function is called for each request to determine the locale and load translations
|
|
*/
|
|
export default getRequestConfig(async ({ requestLocale }) => {
|
|
// This typically corresponds to the `[locale]` segment
|
|
let locale = await requestLocale;
|
|
|
|
// Ensure that the incoming `locale` is valid
|
|
if (!locale || !routing.locales.includes(locale as any)) {
|
|
locale = routing.defaultLocale;
|
|
}
|
|
|
|
return {
|
|
locale,
|
|
messages: (await import(`../messages/${locale}.json`)).default,
|
|
// Set a default timeZone to prevent hydration mismatches between server and client
|
|
timeZone: "UTC",
|
|
};
|
|
});
|