mirror of
https://github.com/beilunyang/moemail.git
synced 2026-09-08 08:46:36 +08:00
feat: add internationalization support with next-intl
This commit is contained in:
@@ -2,9 +2,13 @@
|
||||
|
||||
import { Button } from "@/components/ui/button"
|
||||
import { useRouter } from "next/navigation"
|
||||
import { useTranslations, useLocale } from "next-intl"
|
||||
import { useConfig } from "@/hooks/use-config"
|
||||
|
||||
export function NoPermissionDialog() {
|
||||
const router = useRouter()
|
||||
const locale = useLocale()
|
||||
const t = useTranslations("emails.noPermission")
|
||||
const { config } = useConfig()
|
||||
|
||||
return (
|
||||
@@ -12,18 +16,18 @@ export function NoPermissionDialog() {
|
||||
<div className="fixed left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%] w-[90%] max-w-md">
|
||||
<div className="bg-background border-2 border-primary/20 rounded-lg p-6 md:p-12 shadow-lg">
|
||||
<div className="text-center space-y-4">
|
||||
<h1 className="text-xl md:text-2xl font-bold">权限不足</h1>
|
||||
<p className="text-sm md:text-base text-muted-foreground">你没有权限访问此页面,请联系网站管理员</p>
|
||||
<h1 className="text-xl md:text-2xl font-bold">{t("title")}</h1>
|
||||
<p className="text-sm md:text-base text-muted-foreground">{t("description")}</p>
|
||||
{
|
||||
config?.adminContact && (
|
||||
<p className="text-sm md:text-base text-muted-foreground">管理员联系方式:{config.adminContact}</p>
|
||||
<p className="text-sm md:text-base text-muted-foreground">{t("adminContact")}:{config.adminContact}</p>
|
||||
)
|
||||
}
|
||||
<Button
|
||||
onClick={() => router.push("/")}
|
||||
onClick={() => router.push(`/${locale}`)}
|
||||
className="mt-4 w-full md:w-auto"
|
||||
>
|
||||
返回首页
|
||||
{t("backToHome")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user