mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-10-13 18:36:37 +08:00
feat(frontend): 控制台 next-intl 中英双语
接入无 URL 前缀的 zh-CN/en,顶栏与外观设置可切换语言;选择写入 cookie 后刷新生效。
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
|
||||
import {
|
||||
@@ -22,6 +23,8 @@ type PendingLeave =
|
||||
| { kind: 'history'; restoreDelta: number };
|
||||
|
||||
export function UnsavedChanges({ dirty }: { dirty: boolean }) {
|
||||
const t = useTranslations('waf.editor');
|
||||
const tCommon = useTranslations('common');
|
||||
const [pendingLeave, setPendingLeave] = useState<PendingLeave | null>(null);
|
||||
const dirtyRef = useRef(dirty);
|
||||
const allowLeaveRef = useRef(false);
|
||||
@@ -180,15 +183,13 @@ export function UnsavedChanges({ dirty }: { dirty: boolean }) {
|
||||
>
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>未保存的更改</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
存在未保存的更改,确定离开吗?
|
||||
</AlertDialogDescription>
|
||||
<AlertDialogTitle>{t('leaveTitle')}</AlertDialogTitle>
|
||||
<AlertDialogDescription>{t('leaveDesc')}</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>取消</AlertDialogCancel>
|
||||
<AlertDialogCancel>{tCommon('cancel')}</AlertDialogCancel>
|
||||
<AlertDialogAction onClick={handleConfirmLeave}>
|
||||
确定离开
|
||||
{t('leaveConfirm')}
|
||||
</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
|
||||
Reference in New Issue
Block a user