refactor: i18n
@ -1,10 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import NetworkChartLoading from "@/app/[locale]/(main)/ClientComponents/NetworkChartLoading";
|
import NetworkChartLoading from "@/app/(main)/ClientComponents/NetworkChartLoading";
|
||||||
import {
|
import { NezhaAPIMonitor, ServerMonitorChart } from "@/app/types/nezha-api";
|
||||||
NezhaAPIMonitor,
|
|
||||||
ServerMonitorChart,
|
|
||||||
} from "@/app/[locale]/types/nezha-api";
|
|
||||||
import { BackIcon } from "@/components/Icon";
|
import { BackIcon } from "@/components/Icon";
|
||||||
import {
|
import {
|
||||||
Card,
|
Card,
|
||||||
@ -108,8 +105,6 @@ export const NetworkChart = React.memo(function NetworkChart({
|
|||||||
formattedData: ResultItem[];
|
formattedData: ResultItem[];
|
||||||
}) {
|
}) {
|
||||||
const t = useTranslations("NetworkChart");
|
const t = useTranslations("NetworkChart");
|
||||||
const router = useRouter();
|
|
||||||
const locale = useLocale();
|
|
||||||
|
|
||||||
const defaultChart = "All";
|
const defaultChart = "All";
|
||||||
|
|
@ -1,13 +1,7 @@
|
|||||||
import { BackIcon } from "@/components/Icon";
|
|
||||||
import { Loader } from "@/components/loading/Loader";
|
import { Loader } from "@/components/loading/Loader";
|
||||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||||
import { useLocale } from "next-intl";
|
|
||||||
import { useRouter } from "next/navigation";
|
|
||||||
|
|
||||||
export default function NetworkChartLoading() {
|
export default function NetworkChartLoading() {
|
||||||
const router = useRouter();
|
|
||||||
const locale = useLocale();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card>
|
<Card>
|
||||||
<CardHeader className="flex flex-col items-stretch space-y-0 border-b p-0 sm:flex-row">
|
<CardHeader className="flex flex-col items-stretch space-y-0 border-b p-0 sm:flex-row">
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ServerDetailChartLoading } from "@/app/[locale]/(main)/ClientComponents/ServerDetailLoading";
|
import { ServerDetailChartLoading } from "@/app/(main)/ClientComponents/ServerDetailLoading";
|
||||||
import { NezhaAPISafe, ServerApi } from "@/app/[locale]/types/nezha-api";
|
import { NezhaAPISafe, ServerApi } from "@/app/types/nezha-api";
|
||||||
import AnimatedCircularProgressBar from "@/components/ui/animated-circular-progress-bar";
|
import AnimatedCircularProgressBar from "@/components/ui/animated-circular-progress-bar";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import { ChartConfig, ChartContainer } from "@/components/ui/chart";
|
import { ChartConfig, ChartContainer } from "@/components/ui/chart";
|
@ -1,7 +1,7 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ServerDetailLoading } from "@/app/[locale]/(main)/ClientComponents/ServerDetailLoading";
|
import { ServerDetailLoading } from "@/app/(main)/ClientComponents/ServerDetailLoading";
|
||||||
import { NezhaAPISafe, ServerApi } from "@/app/[locale]/types/nezha-api";
|
import { NezhaAPISafe, ServerApi } from "@/app/types/nezha-api";
|
||||||
import { BackIcon } from "@/components/Icon";
|
import { BackIcon } from "@/components/Icon";
|
||||||
import ServerFlag from "@/components/ServerFlag";
|
import ServerFlag from "@/components/ServerFlag";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@ -21,7 +21,6 @@ export default function ServerDetailClient({
|
|||||||
}) {
|
}) {
|
||||||
const t = useTranslations("ServerDetailClient");
|
const t = useTranslations("ServerDetailClient");
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const locale = useLocale();
|
|
||||||
|
|
||||||
const [hasHistory, setHasHistory] = useState(false);
|
const [hasHistory, setHasHistory] = useState(false);
|
||||||
|
|
||||||
@ -43,7 +42,7 @@ export default function ServerDetailClient({
|
|||||||
if (hasHistory) {
|
if (hasHistory) {
|
||||||
router.back();
|
router.back();
|
||||||
} else {
|
} else {
|
||||||
router.push(`/${locale}/`);
|
router.push(`/`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -52,6 +51,7 @@ export default function ServerDetailClient({
|
|||||||
nezhaFetcher,
|
nezhaFetcher,
|
||||||
);
|
);
|
||||||
const fallbackData = allFallbackData?.result?.find(
|
const fallbackData = allFallbackData?.result?.find(
|
||||||
|
// @ts-ignore
|
||||||
(item) => item.id === server_id,
|
(item) => item.id === server_id,
|
||||||
);
|
);
|
||||||
|
|
@ -20,13 +20,12 @@ export function ServerDetailChartLoading() {
|
|||||||
|
|
||||||
export function ServerDetailLoading() {
|
export function ServerDetailLoading() {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const locale = useLocale();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div
|
<div
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
router.push(`/${locale}/`);
|
router.push(`/`);
|
||||||
}}
|
}}
|
||||||
className="flex flex-none cursor-pointer font-semibold leading-none items-center break-all tracking-tight gap-0.5 text-xl"
|
className="flex flex-none cursor-pointer font-semibold leading-none items-center break-all tracking-tight gap-0.5 text-xl"
|
||||||
>
|
>
|
@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ServerApi } from "@/app/[locale]/types/nezha-api";
|
import { ServerApi } from "@/app/types/nezha-api";
|
||||||
import ServerCard from "@/components/ServerCard";
|
import ServerCard from "@/components/ServerCard";
|
||||||
import Switch from "@/components/Switch";
|
import Switch from "@/components/Switch";
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
@ -1,6 +1,6 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { ServerApi } from "@/app/[locale]/types/nezha-api";
|
import { ServerApi } from "@/app/types/nezha-api";
|
||||||
import { Loader } from "@/components/loading/Loader";
|
import { Loader } from "@/components/loading/Loader";
|
||||||
import { Card, CardContent } from "@/components/ui/card";
|
import { Card, CardContent } from "@/components/ui/card";
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
@ -1,8 +1,8 @@
|
|||||||
"use client";
|
"use client";
|
||||||
|
|
||||||
import { NetworkChartClient } from "@/app/[locale]/(main)/ClientComponents/NetworkChart";
|
import { NetworkChartClient } from "@/app/(main)/ClientComponents/NetworkChart";
|
||||||
import ServerDetailChartClient from "@/app/[locale]/(main)/ClientComponents/ServerDetailChartClient";
|
import ServerDetailChartClient from "@/app/(main)/ClientComponents/ServerDetailChartClient";
|
||||||
import ServerDetailClient from "@/app/[locale]/(main)/ClientComponents/ServerDetailClient";
|
import ServerDetailClient from "@/app/(main)/ClientComponents/ServerDetailClient";
|
||||||
import TabSwitch from "@/components/TabSwitch";
|
import TabSwitch from "@/components/TabSwitch";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
@ -19,7 +19,6 @@ function Header() {
|
|||||||
const customDescription = getEnv("NEXT_PUBLIC_CustomDescription");
|
const customDescription = getEnv("NEXT_PUBLIC_CustomDescription");
|
||||||
|
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const locale = useLocale();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto w-full max-w-5xl">
|
<div className="mx-auto w-full max-w-5xl">
|
||||||
@ -27,7 +26,7 @@ function Header() {
|
|||||||
<section
|
<section
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
sessionStorage.removeItem("selectedTag");
|
sessionStorage.removeItem("selectedTag");
|
||||||
router.push(`/${locale}/`);
|
router.push(`/`);
|
||||||
}}
|
}}
|
||||||
className="flex cursor-pointer items-center text-base font-medium"
|
className="flex cursor-pointer items-center text-base font-medium"
|
||||||
>
|
>
|
@ -1,5 +1,5 @@
|
|||||||
import Footer from "@/app/[locale]/(main)/footer";
|
import Footer from "@/app/(main)/footer";
|
||||||
import Header from "@/app/[locale]/(main)/header";
|
import Header from "@/app/(main)/header";
|
||||||
import { auth } from "@/auth";
|
import { auth } from "@/auth";
|
||||||
import { SignIn } from "@/components/SignIn";
|
import { SignIn } from "@/components/SignIn";
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 2.5 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
@ -1,4 +1,3 @@
|
|||||||
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
|
||||||
import { auth } from "@/auth";
|
import { auth } from "@/auth";
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
import { GetServerDetail } from "@/lib/serverFetch";
|
import { GetServerDetail } from "@/lib/serverFetch";
|
||||||
|
Before Width: | Height: | Size: 2.2 KiB After Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 263 B After Width: | Height: | Size: 263 B |
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
@ -1,12 +1,11 @@
|
|||||||
// @auto-i18n-check. Please do not delete the line.
|
// @auto-i18n-check. Please do not delete the line.
|
||||||
import { locales } from "@/i18n-metadata";
|
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import "@/styles/globals.css";
|
import "@/styles/globals.css";
|
||||||
import type { Metadata } from "next";
|
import type { Metadata } from "next";
|
||||||
import { Viewport } from "next";
|
import { Viewport } from "next";
|
||||||
import { NextIntlClientProvider, useMessages } from "next-intl";
|
import { NextIntlClientProvider } from "next-intl";
|
||||||
import { unstable_setRequestLocale } from "next-intl/server";
|
import { getLocale, getMessages } from "next-intl/server";
|
||||||
import { PublicEnvScript } from "next-runtime-env";
|
import { PublicEnvScript } from "next-runtime-env";
|
||||||
import { ThemeProvider } from "next-themes";
|
import { ThemeProvider } from "next-themes";
|
||||||
import { Inter as FontSans } from "next/font/google";
|
import { Inter as FontSans } from "next/font/google";
|
||||||
@ -38,20 +37,13 @@ export const viewport: Viewport = {
|
|||||||
userScalable: false,
|
userScalable: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
export async function generateStaticParams() {
|
export default async function LocaleLayout({
|
||||||
return locales.map((locale) => ({ locale }));
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function LocaleLayout({
|
|
||||||
children,
|
children,
|
||||||
params: { locale },
|
|
||||||
}: {
|
}: {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
params: { locale: string };
|
|
||||||
}) {
|
}) {
|
||||||
unstable_setRequestLocale(locale);
|
const locale = await getLocale();
|
||||||
|
const messages = await getMessages();
|
||||||
const messages = useMessages();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang={locale} suppressHydrationWarning>
|
<html lang={locale} suppressHydrationWarning>
|
||||||
@ -74,7 +66,7 @@ export default function LocaleLayout({
|
|||||||
enableSystem
|
enableSystem
|
||||||
disableTransitionOnChange
|
disableTransitionOnChange
|
||||||
>
|
>
|
||||||
<NextIntlClientProvider locale={locale} messages={messages}>
|
<NextIntlClientProvider messages={messages}>
|
||||||
{children}
|
{children}
|
||||||
</NextIntlClientProvider>
|
</NextIntlClientProvider>
|
||||||
</ThemeProvider>
|
</ThemeProvider>
|
@ -1,10 +0,0 @@
|
|||||||
{
|
|
||||||
"defaultLang": "en",
|
|
||||||
"translatorServerName": "azure",
|
|
||||||
"needLangs": ["en", "zh", "zh-t", "ja"],
|
|
||||||
"brandWords": [],
|
|
||||||
"unMoveToLocaleDirFiles": [],
|
|
||||||
"enableStaticRendering": false,
|
|
||||||
"enableSubPageRedirectToLocale": false,
|
|
||||||
"disableDefaultLangRedirect": true
|
|
||||||
}
|
|
@ -7,45 +7,18 @@ import {
|
|||||||
DropdownMenuItem,
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu";
|
} from "@/components/ui/dropdown-menu";
|
||||||
|
import { localeItems } from "@/i18n-metadata";
|
||||||
|
import { setUserLocale } from "@/i18n/locale";
|
||||||
import { useLocale } from "next-intl";
|
import { useLocale } from "next-intl";
|
||||||
import { usePathname, useRouter } from "next/navigation";
|
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
|
|
||||||
import { localeItems } from "../i18n-metadata";
|
|
||||||
|
|
||||||
export function LanguageSwitcher() {
|
export function LanguageSwitcher() {
|
||||||
const locale = useLocale();
|
const locale = useLocale();
|
||||||
const router = useRouter();
|
|
||||||
const pathname = usePathname();
|
|
||||||
|
|
||||||
const handleChange = (code: string) => {
|
function onChange(value: string) {
|
||||||
const newLocale = code;
|
const locale = value;
|
||||||
|
setUserLocale(locale);
|
||||||
const rootPath = "/";
|
|
||||||
const currentLocalePath = `/${locale}`;
|
|
||||||
const newLocalePath = `/${newLocale}`;
|
|
||||||
|
|
||||||
// Function to construct new path with locale prefix
|
|
||||||
const constructLocalePath = (path: string, newLocale: string) => {
|
|
||||||
if (path.startsWith(currentLocalePath)) {
|
|
||||||
return path.replace(currentLocalePath, `/${newLocale}`);
|
|
||||||
} else {
|
|
||||||
return `/${newLocale}${path}`;
|
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
if (pathname === rootPath || !pathname) {
|
|
||||||
router.push(newLocalePath);
|
|
||||||
} else if (
|
|
||||||
pathname === currentLocalePath ||
|
|
||||||
pathname === `${currentLocalePath}/`
|
|
||||||
) {
|
|
||||||
router.push(newLocalePath);
|
|
||||||
} else {
|
|
||||||
const newPath = constructLocalePath(pathname, newLocale);
|
|
||||||
router.push(newPath);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
@ -57,10 +30,7 @@ export function LanguageSwitcher() {
|
|||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent align="end">
|
<DropdownMenuContent align="end">
|
||||||
{localeItems.map((item) => (
|
{localeItems.map((item) => (
|
||||||
<DropdownMenuItem
|
<DropdownMenuItem key={item.code} onClick={() => onChange(item.code)}>
|
||||||
key={item.code}
|
|
||||||
onClick={() => handleChange(item.code)}
|
|
||||||
>
|
|
||||||
{item.name}
|
{item.name}
|
||||||
</DropdownMenuItem>
|
</DropdownMenuItem>
|
||||||
))}
|
))}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
import { NezhaAPISafe } from "@/app/types/nezha-api";
|
||||||
import ServerCardPopover from "@/components/ServerCardPopover";
|
|
||||||
import ServerFlag from "@/components/ServerFlag";
|
import ServerFlag from "@/components/ServerFlag";
|
||||||
import ServerUsageBar from "@/components/ServerUsageBar";
|
import ServerUsageBar from "@/components/ServerUsageBar";
|
||||||
import { Badge } from "@/components/ui/badge";
|
import { Badge } from "@/components/ui/badge";
|
||||||
@ -29,10 +28,8 @@ export default function ServerCard({
|
|||||||
|
|
||||||
const showNetTransfer = getEnv("NEXT_PUBLIC_ShowNetTransfer") === "true";
|
const showNetTransfer = getEnv("NEXT_PUBLIC_ShowNetTransfer") === "true";
|
||||||
|
|
||||||
const locale = useLocale();
|
|
||||||
|
|
||||||
return online ? (
|
return online ? (
|
||||||
<Link href={`/${locale}/${id}`} prefetch={true}>
|
<Link href={`/${id}`} prefetch={true}>
|
||||||
<Card
|
<Card
|
||||||
className={
|
className={
|
||||||
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 lg:flex-row cursor-pointer"
|
"flex flex-col items-center justify-start gap-3 p-3 md:px-5 lg:flex-row cursor-pointer"
|
||||||
@ -99,7 +96,7 @@ export default function ServerCard({
|
|||||||
{showNetTransfer && (
|
{showNetTransfer && (
|
||||||
<section
|
<section
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
router.push(`/${locale}/network/${id}`);
|
router.push(`/${id}`);
|
||||||
}}
|
}}
|
||||||
className={"flex items-center justify-between gap-1"}
|
className={"flex items-center justify-between gap-1"}
|
||||||
>
|
>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
import { NezhaAPISafe } from "@/app/types/nezha-api";
|
||||||
import { cn, formatBytes } from "@/lib/utils";
|
import { cn, formatBytes } from "@/lib/utils";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import ServerListClient from "@/app/[locale]/(main)/ClientComponents/ServerListClient";
|
import ServerListClient from "@/app/(main)/ClientComponents/ServerListClient";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
|
|
||||||
export default async function ServerList() {
|
export default async function ServerList() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import ServerOverviewClient from "@/app/[locale]/(main)/ClientComponents/ServerOverviewClient";
|
import ServerOverviewClient from "@/app/(main)/ClientComponents/ServerOverviewClient";
|
||||||
|
|
||||||
export default async function ServerOverview() {
|
export default async function ServerOverview() {
|
||||||
return <ServerOverviewClient />;
|
return <ServerOverviewClient />;
|
||||||
|
14
i18n.ts
@ -1,14 +0,0 @@
|
|||||||
// @auto-i18n-check. Please do not delete the line.
|
|
||||||
import { getRequestConfig } from "next-intl/server";
|
|
||||||
import { notFound } from "next/navigation";
|
|
||||||
|
|
||||||
import { locales } from "./i18n-metadata";
|
|
||||||
|
|
||||||
export default getRequestConfig(async ({ locale }) => {
|
|
||||||
// Validate that the incoming `locale` parameter is valid
|
|
||||||
if (!locales.includes(locale as any)) notFound();
|
|
||||||
|
|
||||||
return {
|
|
||||||
messages: (await import(`./messages/${locale}.json`)).default,
|
|
||||||
};
|
|
||||||
});
|
|
14
i18n/locale.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
"use server";
|
||||||
|
|
||||||
|
import getEnv from "@/lib/env-entry";
|
||||||
|
import { cookies } from "next/headers";
|
||||||
|
|
||||||
|
const COOKIE_NAME = "NEXT_LOCALE";
|
||||||
|
|
||||||
|
export async function getUserLocale() {
|
||||||
|
return cookies().get(COOKIE_NAME)?.value || (getEnv("DefaultLocale") ?? "en");
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function setUserLocale(locale: string) {
|
||||||
|
cookies().set(COOKIE_NAME, locale);
|
||||||
|
}
|
11
i18n/request.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import { getUserLocale } from "@/i18n/locale";
|
||||||
|
import { getRequestConfig } from "next-intl/server";
|
||||||
|
|
||||||
|
export default getRequestConfig(async () => {
|
||||||
|
const locale = await getUserLocale();
|
||||||
|
|
||||||
|
return {
|
||||||
|
locale,
|
||||||
|
messages: (await import(`../messages/${locale}.json`)).default,
|
||||||
|
};
|
||||||
|
});
|
@ -1,7 +1,7 @@
|
|||||||
"use server";
|
"use server";
|
||||||
|
|
||||||
import { NezhaAPI, ServerApi } from "@/app/[locale]/types/nezha-api";
|
import { NezhaAPI, ServerApi } from "@/app/types/nezha-api";
|
||||||
import { MakeOptional } from "@/app/[locale]/types/utils";
|
import { MakeOptional } from "@/app/types/utils";
|
||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
import { unstable_noStore as noStore } from "next/cache";
|
import { unstable_noStore as noStore } from "next/cache";
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NezhaAPISafe } from "@/app/[locale]/types/nezha-api";
|
import { NezhaAPISafe } from "@/app/types/nezha-api";
|
||||||
import { type ClassValue, clsx } from "clsx";
|
import { type ClassValue, clsx } from "clsx";
|
||||||
import { twMerge } from "tailwind-merge";
|
import { twMerge } from "tailwind-merge";
|
||||||
|
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
// @auto-i18n-check. Please do not delete the line.
|
|
||||||
import createMiddleware from "next-intl/middleware";
|
|
||||||
|
|
||||||
import { defaultLocale, locales } from "./i18n-metadata";
|
|
||||||
|
|
||||||
// export { auth as middleware } from "@/auth"
|
|
||||||
|
|
||||||
export default createMiddleware({
|
|
||||||
// A list of all locales that are supported
|
|
||||||
locales: locales,
|
|
||||||
|
|
||||||
// Used when no locale matches
|
|
||||||
defaultLocale: defaultLocale,
|
|
||||||
|
|
||||||
// 'always': This is the default, The home page will also be redirected to the default language, such as www.abc.com to www.abc.com/en
|
|
||||||
// 'as-needed': The default page is not redirected. For example, if you open www.abc.com, it is still www.abc.com
|
|
||||||
localePrefix: "always",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const config = {
|
|
||||||
// Match only internationalized pathnames
|
|
||||||
matcher: ["/", "/(en|zh|zh-t|ja)/:path*"],
|
|
||||||
};
|
|
@ -21,7 +21,7 @@ const withPWA = withPWAInit({
|
|||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
output: "standalone",
|
// output: "standalone",
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
logging: {
|
logging: {
|
||||||
fetches: {
|
fetches: {
|
||||||
|