refactor(i18n/components): unify locale keys and update component references
This commit is contained in:
@@ -32,7 +32,7 @@ export const ClashInfoCard = () => {
|
||||
<Stack spacing={1.5}>
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.clashInfo.fields.coreVersion")}
|
||||
{t("home.cards.clashInfo.fields.coreVersion")}
|
||||
</Typography>
|
||||
<Typography variant="body2" fontWeight="medium">
|
||||
{clashVersion || "-"}
|
||||
@@ -41,7 +41,7 @@ export const ClashInfoCard = () => {
|
||||
<Divider />
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.clashInfo.fields.systemProxyAddress")}
|
||||
{t("home.cards.clashInfo.fields.systemProxyAddress")}
|
||||
</Typography>
|
||||
<Typography variant="body2" fontWeight="medium">
|
||||
{systemProxyAddress}
|
||||
@@ -50,7 +50,7 @@ export const ClashInfoCard = () => {
|
||||
<Divider />
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.clashInfo.fields.mixedPort")}
|
||||
{t("home.cards.clashInfo.fields.mixedPort")}
|
||||
</Typography>
|
||||
<Typography variant="body2" fontWeight="medium">
|
||||
{clashConfig.mixedPort || "-"}
|
||||
@@ -59,7 +59,7 @@ export const ClashInfoCard = () => {
|
||||
<Divider />
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.clashInfo.fields.uptime")}
|
||||
{t("home.cards.clashInfo.fields.uptime")}
|
||||
</Typography>
|
||||
<Typography variant="body2" fontWeight="medium">
|
||||
{formattedUptime}
|
||||
@@ -68,7 +68,7 @@ export const ClashInfoCard = () => {
|
||||
<Divider />
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.clashInfo.fields.rulesCount")}
|
||||
{t("home.cards.clashInfo.fields.rulesCount")}
|
||||
</Typography>
|
||||
<Typography variant="body2" fontWeight="medium">
|
||||
{rules.length}
|
||||
@@ -87,7 +87,7 @@ export const ClashInfoCard = () => {
|
||||
|
||||
return (
|
||||
<EnhancedCard
|
||||
title={t("home.clashInfo.title")}
|
||||
title={t("home.cards.clashInfo.title")}
|
||||
icon={<DeveloperBoardOutlined />}
|
||||
iconColor="warning"
|
||||
action={null}
|
||||
|
||||
@@ -21,16 +21,16 @@ const isClashMode = (mode: string): mode is ClashMode =>
|
||||
|
||||
const MODE_META: Record<ClashMode, { label: string; description: string }> = {
|
||||
rule: {
|
||||
label: "home.clashMode.labels.rule",
|
||||
description: "home.clashMode.descriptions.rule",
|
||||
label: "home.cards.clashMode.labels.rule",
|
||||
description: "home.cards.clashMode.descriptions.rule",
|
||||
},
|
||||
global: {
|
||||
label: "home.clashMode.labels.global",
|
||||
description: "home.clashMode.descriptions.global",
|
||||
label: "home.cards.clashMode.labels.global",
|
||||
description: "home.cards.clashMode.descriptions.global",
|
||||
},
|
||||
direct: {
|
||||
label: "home.clashMode.labels.direct",
|
||||
description: "home.clashMode.descriptions.direct",
|
||||
label: "home.cards.clashMode.labels.direct",
|
||||
description: "home.cards.clashMode.descriptions.direct",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -53,7 +53,7 @@ export const ClashModeCard = () => {
|
||||
if (currentModeKey) {
|
||||
return t(MODE_META[currentModeKey].description);
|
||||
}
|
||||
return t("home.clashMode.errors.communication");
|
||||
return t("home.cards.clashMode.errors.communication");
|
||||
}, [currentModeKey, t]);
|
||||
|
||||
// 模式图标映射
|
||||
|
||||
@@ -823,7 +823,7 @@ export const CurrentProxyCard = () => {
|
||||
|
||||
return (
|
||||
<EnhancedCard
|
||||
title={t("home.currentProxy.title")}
|
||||
title={t("home.cards.currentProxy.title")}
|
||||
icon={
|
||||
<Tooltip
|
||||
title={
|
||||
@@ -840,7 +840,7 @@ export const CurrentProxyCard = () => {
|
||||
iconColor={currentProxy ? "primary" : undefined}
|
||||
action={
|
||||
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
||||
<Tooltip title={t("home.currentProxy.actions.refreshDelay")}>
|
||||
<Tooltip title={t("home.cards.currentProxy.actions.refreshDelay")}>
|
||||
<span>
|
||||
<IconButton
|
||||
size="small"
|
||||
@@ -906,7 +906,7 @@ export const CurrentProxyCard = () => {
|
||||
{isGlobalMode && (
|
||||
<Chip
|
||||
size="small"
|
||||
label={t("home.currentProxy.labels.globalMode")}
|
||||
label={t("home.cards.currentProxy.labels.globalMode")}
|
||||
color="primary"
|
||||
sx={{ mr: 0.5 }}
|
||||
/>
|
||||
@@ -914,7 +914,7 @@ export const CurrentProxyCard = () => {
|
||||
{isDirectMode && (
|
||||
<Chip
|
||||
size="small"
|
||||
label={t("home.currentProxy.labels.directMode")}
|
||||
label={t("home.cards.currentProxy.labels.directMode")}
|
||||
color="success"
|
||||
sx={{ mr: 0.5 }}
|
||||
/>
|
||||
@@ -955,13 +955,13 @@ export const CurrentProxyCard = () => {
|
||||
sx={{ mb: 1.5 }}
|
||||
>
|
||||
<InputLabel id="proxy-group-select-label">
|
||||
{t("home.currentProxy.labels.group")}
|
||||
{t("home.cards.currentProxy.labels.group")}
|
||||
</InputLabel>
|
||||
<Select
|
||||
labelId="proxy-group-select-label"
|
||||
value={state.selection.group}
|
||||
onChange={handleGroupChange}
|
||||
label={t("home.currentProxy.labels.group")}
|
||||
label={t("home.cards.currentProxy.labels.group")}
|
||||
disabled={isGlobalMode || isDirectMode}
|
||||
>
|
||||
{state.proxyData.groups.map((group) => (
|
||||
@@ -975,13 +975,13 @@ export const CurrentProxyCard = () => {
|
||||
{/* 代理节点选择器 */}
|
||||
<FormControl fullWidth variant="outlined" size="small" sx={{ mb: 0 }}>
|
||||
<InputLabel id="proxy-select-label">
|
||||
{t("home.currentProxy.labels.proxy")}
|
||||
{t("home.cards.currentProxy.labels.proxy")}
|
||||
</InputLabel>
|
||||
<Select
|
||||
labelId="proxy-select-label"
|
||||
value={state.selection.proxy}
|
||||
onChange={handleProxyChange}
|
||||
label={t("home.currentProxy.labels.proxy")}
|
||||
label={t("home.cards.currentProxy.labels.proxy")}
|
||||
disabled={isDirectMode}
|
||||
renderValue={renderProxyValue}
|
||||
MenuProps={{
|
||||
@@ -1037,7 +1037,7 @@ export const CurrentProxyCard = () => {
|
||||
) : (
|
||||
<Box sx={{ textAlign: "center", py: 4 }}>
|
||||
<Typography variant="body1" color="text.secondary">
|
||||
{t("home.currentProxy.labels.noActiveNode")}
|
||||
{t("home.cards.currentProxy.labels.noActiveNode")}
|
||||
</Typography>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
@@ -851,7 +851,7 @@ export const EnhancedCanvasTrafficGraph = memo(
|
||||
|
||||
// 获取时间范围文本
|
||||
const getTimeRangeText = useCallback(() => {
|
||||
return t("home.traffic.patterns.minutes", { time: timeRange });
|
||||
return t("home.cards.traffic.patterns.minutes", { time: timeRange });
|
||||
}, [timeRange, t]);
|
||||
|
||||
return (
|
||||
@@ -934,7 +934,7 @@ export const EnhancedCanvasTrafficGraph = memo(
|
||||
textAlign: "right",
|
||||
}}
|
||||
>
|
||||
{t("home.traffic.legends.upload")}
|
||||
{t("home.cards.traffic.legends.upload")}
|
||||
</Box>
|
||||
<Box
|
||||
sx={{
|
||||
@@ -944,7 +944,7 @@ export const EnhancedCanvasTrafficGraph = memo(
|
||||
textAlign: "right",
|
||||
}}
|
||||
>
|
||||
{t("home.traffic.legends.download")}
|
||||
{t("home.cards.traffic.legends.download")}
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
|
||||
@@ -219,42 +219,42 @@ export const EnhancedTrafficStats = () => {
|
||||
() => [
|
||||
{
|
||||
icon: <ArrowUpwardRounded fontSize="small" />,
|
||||
title: t("home.traffic.metrics.uploadSpeed"),
|
||||
title: t("home.cards.traffic.metrics.uploadSpeed"),
|
||||
value: parsedData.up,
|
||||
unit: `${parsedData.upUnit}/s`,
|
||||
color: "secondary" as const,
|
||||
},
|
||||
{
|
||||
icon: <ArrowDownwardRounded fontSize="small" />,
|
||||
title: t("home.traffic.metrics.downloadSpeed"),
|
||||
title: t("home.cards.traffic.metrics.downloadSpeed"),
|
||||
value: parsedData.down,
|
||||
unit: `${parsedData.downUnit}/s`,
|
||||
color: "primary" as const,
|
||||
},
|
||||
{
|
||||
icon: <LinkRounded fontSize="small" />,
|
||||
title: t("home.traffic.metrics.activeConnections"),
|
||||
title: t("home.cards.traffic.metrics.activeConnections"),
|
||||
value: parsedData.connectionsCount,
|
||||
unit: "",
|
||||
color: "success" as const,
|
||||
},
|
||||
{
|
||||
icon: <CloudUploadRounded fontSize="small" />,
|
||||
title: t("home.traffic.metrics.uploaded"),
|
||||
title: t("home.cards.traffic.metrics.uploaded"),
|
||||
value: parsedData.uploadTotal,
|
||||
unit: parsedData.uploadTotalUnit,
|
||||
color: "secondary" as const,
|
||||
},
|
||||
{
|
||||
icon: <CloudDownloadRounded fontSize="small" />,
|
||||
title: t("home.traffic.metrics.downloaded"),
|
||||
title: t("home.cards.traffic.metrics.downloaded"),
|
||||
value: parsedData.downloadTotal,
|
||||
unit: parsedData.downloadTotalUnit,
|
||||
color: "primary" as const,
|
||||
},
|
||||
{
|
||||
icon: <MemoryRounded fontSize="small" />,
|
||||
title: t("home.traffic.metrics.memoryUsage"),
|
||||
title: t("home.cards.traffic.metrics.memoryUsage"),
|
||||
value: parsedData.inuse,
|
||||
unit: parsedData.inuseUnit,
|
||||
color: "error" as const,
|
||||
|
||||
@@ -112,7 +112,7 @@ const ProfileDetails = ({
|
||||
sx={{ display: "flex", alignItems: "center" }}
|
||||
>
|
||||
<span style={{ flexShrink: 0 }}>
|
||||
{t("home.profile.labels.from")}:{" "}
|
||||
{t("profiles.card.labels.from")}:{" "}
|
||||
</span>
|
||||
{current.home ? (
|
||||
<Link
|
||||
@@ -188,7 +188,7 @@ const ProfileDetails = ({
|
||||
sx={{ cursor: "pointer" }}
|
||||
onClick={onUpdateProfile}
|
||||
>
|
||||
{t("home.profile.labels.updateTime")}:{" "}
|
||||
{t("profiles.card.labels.updateTime")}:{" "}
|
||||
<Box component="span" fontWeight="medium">
|
||||
{dayjs(current.updated * 1000).format("YYYY-MM-DD HH:mm")}
|
||||
</Box>
|
||||
@@ -201,7 +201,7 @@ const ProfileDetails = ({
|
||||
<Stack direction="row" alignItems="center" spacing={1}>
|
||||
<SpeedOutlined fontSize="small" color="action" />
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.profile.labels.usedTotal")}:{" "}
|
||||
{t("profiles.card.labels.usedTotal")}:{" "}
|
||||
<Box component="span" fontWeight="medium">
|
||||
{parseTraffic(usedTraffic)} /{" "}
|
||||
{parseTraffic(current.extra.total)}
|
||||
@@ -213,7 +213,7 @@ const ProfileDetails = ({
|
||||
<Stack direction="row" alignItems="center" spacing={1}>
|
||||
<EventOutlined fontSize="small" color="action" />
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.profile.labels.expireTime")}:{" "}
|
||||
{t("profiles.card.labels.expireTime")}:{" "}
|
||||
<Box component="span" fontWeight="medium">
|
||||
{parseExpire(current.extra.expire)}
|
||||
</Box>
|
||||
@@ -268,10 +268,10 @@ const EmptyProfile = ({ onClick }: { onClick: () => void }) => {
|
||||
sx={{ fontSize: 60, color: "primary.main", mb: 2 }}
|
||||
/>
|
||||
<Typography variant="h6" gutterBottom>
|
||||
{t("home.profile.actions.import")} {t("home.profile.title")}
|
||||
{t("profiles.page.actions.import")} {t("profiles.page.title")}
|
||||
</Typography>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.profile.labels.clickToImport")}
|
||||
{t("profiles.card.labels.clickToImport")}
|
||||
</Typography>
|
||||
</Box>
|
||||
);
|
||||
@@ -312,7 +312,7 @@ export const HomeProfileCard = ({
|
||||
|
||||
// 卡片标题
|
||||
const cardTitle = useMemo(() => {
|
||||
if (!current) return t("home.profile.title");
|
||||
if (!current) return t("profiles.page.title");
|
||||
|
||||
if (!current.home) return current.name;
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ export const IpInfoCard = () => {
|
||||
setCountdown(IP_REFRESH_SECONDS);
|
||||
} catch (err) {
|
||||
setError(
|
||||
err instanceof Error ? err.message : t("home.ipInfo.errors.load"),
|
||||
err instanceof Error ? err.message : t("home.cards.ipInfo.errors.load"),
|
||||
);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
@@ -116,7 +116,7 @@ export const IpInfoCard = () => {
|
||||
if (loading) {
|
||||
return (
|
||||
<EnhancedCard
|
||||
title={t("home.ipInfo.title")}
|
||||
title={t("home.cards.ipInfo.title")}
|
||||
icon={<LocationOnOutlined />}
|
||||
iconColor="info"
|
||||
action={
|
||||
@@ -139,7 +139,7 @@ export const IpInfoCard = () => {
|
||||
if (error) {
|
||||
return (
|
||||
<EnhancedCard
|
||||
title={t("home.ipInfo.title")}
|
||||
title={t("home.cards.ipInfo.title")}
|
||||
icon={<LocationOnOutlined />}
|
||||
iconColor="info"
|
||||
action={
|
||||
@@ -172,7 +172,7 @@ export const IpInfoCard = () => {
|
||||
// 渲染正常数据
|
||||
return (
|
||||
<EnhancedCard
|
||||
title={t("home.ipInfo.title")}
|
||||
title={t("home.cards.ipInfo.title")}
|
||||
icon={<LocationOnOutlined />}
|
||||
iconColor="info"
|
||||
action={
|
||||
@@ -224,7 +224,7 @@ export const IpInfoCard = () => {
|
||||
maxWidth: "100%",
|
||||
}}
|
||||
>
|
||||
{ipInfo?.country || t("home.ipInfo.labels.unknown")}
|
||||
{ipInfo?.country || t("home.cards.ipInfo.labels.unknown")}
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
@@ -234,7 +234,7 @@ export const IpInfoCard = () => {
|
||||
color="text.secondary"
|
||||
sx={{ flexShrink: 0 }}
|
||||
>
|
||||
{t("home.ipInfo.labels.ip")}:
|
||||
{t("home.cards.ipInfo.labels.ip")}:
|
||||
</Typography>
|
||||
<Box
|
||||
sx={{
|
||||
@@ -268,24 +268,27 @@ export const IpInfoCard = () => {
|
||||
</Box>
|
||||
|
||||
<InfoItem
|
||||
label={t("home.ipInfo.labels.asn")}
|
||||
label={t("home.cards.ipInfo.labels.asn")}
|
||||
value={ipInfo?.asn ? `AS${ipInfo.asn}` : "N/A"}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* 右侧:组织、ISP和位置信息 */}
|
||||
<Box sx={{ width: "60%", overflow: "auto" }}>
|
||||
<InfoItem label={t("home.ipInfo.labels.isp")} value={ipInfo?.isp} />
|
||||
<InfoItem
|
||||
label={t("home.ipInfo.labels.org")}
|
||||
label={t("home.cards.ipInfo.labels.isp")}
|
||||
value={ipInfo?.isp}
|
||||
/>
|
||||
<InfoItem
|
||||
label={t("home.cards.ipInfo.labels.org")}
|
||||
value={ipInfo?.asn_organization}
|
||||
/>
|
||||
<InfoItem
|
||||
label={t("home.ipInfo.labels.location")}
|
||||
label={t("home.cards.ipInfo.labels.location")}
|
||||
value={[ipInfo?.city, ipInfo?.region].filter(Boolean).join(", ")}
|
||||
/>
|
||||
<InfoItem
|
||||
label={t("home.ipInfo.labels.timezone")}
|
||||
label={t("home.cards.ipInfo.labels.timezone")}
|
||||
value={ipInfo?.timezone}
|
||||
/>
|
||||
</Box>
|
||||
@@ -305,7 +308,7 @@ export const IpInfoCard = () => {
|
||||
}}
|
||||
>
|
||||
<Typography variant="caption">
|
||||
{t("home.ipInfo.labels.autoRefresh")}: {countdown}s
|
||||
{t("home.cards.ipInfo.labels.autoRefresh")}: {countdown}s
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="caption"
|
||||
|
||||
@@ -160,18 +160,18 @@ export const ProxyTunCard: FC = () => {
|
||||
if (activeTab === "system") {
|
||||
return {
|
||||
text: systemProxyActualState
|
||||
? t("home.proxyTunCard.status.systemProxyEnabled")
|
||||
: t("home.proxyTunCard.status.systemProxyDisabled"),
|
||||
tooltip: t("home.proxyTunCard.tooltips.systemProxy"),
|
||||
? t("home.cards.proxyTun.status.systemProxyEnabled")
|
||||
: t("home.cards.proxyTun.status.systemProxyDisabled"),
|
||||
tooltip: t("home.cards.proxyTun.tooltips.systemProxy"),
|
||||
};
|
||||
} else {
|
||||
return {
|
||||
text: !isTunModeAvailable
|
||||
? t("home.proxyTunCard.status.tunModeServiceRequired")
|
||||
? t("home.cards.proxyTun.status.tunModeServiceRequired")
|
||||
: enable_tun_mode
|
||||
? t("home.proxyTunCard.status.tunModeEnabled")
|
||||
: t("home.proxyTunCard.status.tunModeDisabled"),
|
||||
tooltip: t("home.proxyTunCard.tooltips.tunMode"),
|
||||
? t("home.cards.proxyTun.status.tunModeEnabled")
|
||||
: t("home.cards.proxyTun.status.tunModeDisabled"),
|
||||
tooltip: t("home.cards.proxyTun.tooltips.tunMode"),
|
||||
};
|
||||
}
|
||||
}, [
|
||||
|
||||
@@ -219,11 +219,11 @@ export const SystemInfoCard = () => {
|
||||
<>
|
||||
<AdminPanelSettingsOutlined
|
||||
sx={{ color: "primary.main", fontSize: 16 }}
|
||||
titleAccess={t("home.systemInfo.badges.adminMode")}
|
||||
titleAccess={t("home.cards.systemInfo.badges.adminMode")}
|
||||
/>
|
||||
<DnsOutlined
|
||||
sx={{ color: "success.main", fontSize: 16, ml: 0.5 }}
|
||||
titleAccess={t("home.systemInfo.badges.serviceMode")}
|
||||
titleAccess={t("home.cards.systemInfo.badges.serviceMode")}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
@@ -231,21 +231,21 @@ export const SystemInfoCard = () => {
|
||||
return (
|
||||
<AdminPanelSettingsOutlined
|
||||
sx={{ color: "primary.main", fontSize: 16 }}
|
||||
titleAccess={t("home.systemInfo.badges.adminMode")}
|
||||
titleAccess={t("home.cards.systemInfo.badges.adminMode")}
|
||||
/>
|
||||
);
|
||||
} else if (isSidecarMode) {
|
||||
return (
|
||||
<ExtensionOutlined
|
||||
sx={{ color: "info.main", fontSize: 16 }}
|
||||
titleAccess={t("home.systemInfo.badges.sidecarMode")}
|
||||
titleAccess={t("home.cards.systemInfo.badges.sidecarMode")}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
return (
|
||||
<DnsOutlined
|
||||
sx={{ color: "success.main", fontSize: 16 }}
|
||||
titleAccess={t("home.systemInfo.badges.serviceMode")}
|
||||
titleAccess={t("home.cards.systemInfo.badges.serviceMode")}
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -256,13 +256,13 @@ export const SystemInfoCard = () => {
|
||||
if (isAdminMode) {
|
||||
// 判断是否同时处于服务模式
|
||||
if (!isSidecarMode) {
|
||||
return t("home.systemInfo.badges.adminServiceMode");
|
||||
return t("home.cards.systemInfo.badges.adminServiceMode");
|
||||
}
|
||||
return t("home.systemInfo.badges.adminMode");
|
||||
return t("home.cards.systemInfo.badges.adminMode");
|
||||
} else if (isSidecarMode) {
|
||||
return t("home.systemInfo.badges.sidecarMode");
|
||||
return t("home.cards.systemInfo.badges.sidecarMode");
|
||||
} else {
|
||||
return t("home.systemInfo.badges.serviceMode");
|
||||
return t("home.cards.systemInfo.badges.serviceMode");
|
||||
}
|
||||
};
|
||||
|
||||
@@ -271,14 +271,14 @@ export const SystemInfoCard = () => {
|
||||
|
||||
return (
|
||||
<EnhancedCard
|
||||
title={t("home.systemInfo.title")}
|
||||
title={t("home.cards.systemInfo.title")}
|
||||
icon={<InfoOutlined />}
|
||||
iconColor="error"
|
||||
action={
|
||||
<IconButton
|
||||
size="small"
|
||||
onClick={goToSettings}
|
||||
title={t("home.systemInfo.actions.settings")}
|
||||
title={t("home.cards.systemInfo.actions.settings")}
|
||||
>
|
||||
<SettingsOutlined fontSize="small" />
|
||||
</IconButton>
|
||||
@@ -287,7 +287,7 @@ export const SystemInfoCard = () => {
|
||||
<Stack spacing={1.5}>
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.systemInfo.fields.osInfo")}
|
||||
{t("home.cards.systemInfo.fields.osInfo")}
|
||||
</Typography>
|
||||
<Typography variant="body2" fontWeight="medium">
|
||||
{systemState.osInfo}
|
||||
@@ -300,11 +300,13 @@ export const SystemInfoCard = () => {
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.systemInfo.fields.autoLaunch")}
|
||||
{t("home.cards.systemInfo.fields.autoLaunch")}
|
||||
</Typography>
|
||||
<Stack direction="row" spacing={1} alignItems="center">
|
||||
{isAdminMode && (
|
||||
<Tooltip title={t("home.systemInfo.tooltips.autoLaunchAdmin")}>
|
||||
<Tooltip
|
||||
title={t("home.cards.systemInfo.tooltips.autoLaunchAdmin")}
|
||||
>
|
||||
<WarningOutlined sx={{ color: "warning.main", fontSize: 20 }} />
|
||||
</Tooltip>
|
||||
)}
|
||||
@@ -329,7 +331,7 @@ export const SystemInfoCard = () => {
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.systemInfo.fields.runningMode")}
|
||||
{t("home.cards.systemInfo.fields.runningMode")}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="body2"
|
||||
@@ -344,7 +346,7 @@ export const SystemInfoCard = () => {
|
||||
<Divider />
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.systemInfo.fields.lastCheckUpdate")}
|
||||
{t("home.cards.systemInfo.fields.lastCheckUpdate")}
|
||||
</Typography>
|
||||
<Typography
|
||||
variant="body2"
|
||||
@@ -362,7 +364,7 @@ export const SystemInfoCard = () => {
|
||||
<Divider />
|
||||
<Stack direction="row" justifyContent="space-between">
|
||||
<Typography variant="body2" color="text.secondary">
|
||||
{t("home.systemInfo.fields.vergeVersion")}
|
||||
{t("home.cards.systemInfo.fields.vergeVersion")}
|
||||
</Typography>
|
||||
<Typography variant="body2" fontWeight="medium">
|
||||
v{appVersion}
|
||||
|
||||
@@ -173,7 +173,7 @@ export const TestCard = () => {
|
||||
|
||||
return (
|
||||
<EnhancedCard
|
||||
title={t("home.tests.title")}
|
||||
title={t("home.cards.tests.title")}
|
||||
icon={<NetworkCheck />}
|
||||
action={
|
||||
<Box sx={{ display: "flex", gap: 1 }}>
|
||||
|
||||
@@ -87,7 +87,7 @@ export const LayoutTraffic = () => {
|
||||
|
||||
<Box display="flex" flexDirection="column" gap={0.75}>
|
||||
<Box
|
||||
title={`${t("layout.traffic.labels.uploadSpeed")}`}
|
||||
title={`${t("home.cards.traffic.metrics.uploadSpeed")}`}
|
||||
{...boxStyle}
|
||||
sx={{
|
||||
...boxStyle.sx,
|
||||
@@ -105,7 +105,7 @@ export const LayoutTraffic = () => {
|
||||
</Box>
|
||||
|
||||
<Box
|
||||
title={`${t("layout.traffic.labels.downloadSpeed")}`}
|
||||
title={`${t("home.cards.traffic.metrics.downloadSpeed")}`}
|
||||
{...boxStyle}
|
||||
sx={{
|
||||
...boxStyle.sx,
|
||||
@@ -124,7 +124,7 @@ export const LayoutTraffic = () => {
|
||||
|
||||
{displayMemory && (
|
||||
<Box
|
||||
title={`${t("layout.traffic.labels.memoryUsage")} `}
|
||||
title={`${t("home.cards.traffic.metrics.memoryUsage")} `}
|
||||
{...boxStyle}
|
||||
sx={{
|
||||
cursor: "auto",
|
||||
|
||||
@@ -74,17 +74,17 @@ interface Props {
|
||||
const builtinProxyPolicies = ["DIRECT", "REJECT", "REJECT-DROP", "PASS"];
|
||||
|
||||
const PROXY_STRATEGY_LABEL_KEYS: Record<string, string> = {
|
||||
select: "proxies.strategies.select",
|
||||
"url-test": "proxies.strategies.url-test",
|
||||
fallback: "proxies.strategies.fallback",
|
||||
"load-balance": "proxies.strategies.load-balance",
|
||||
relay: "proxies.strategies.relay",
|
||||
select: "proxies.enums.strategies.select",
|
||||
"url-test": "proxies.enums.strategies.url-test",
|
||||
fallback: "proxies.enums.strategies.fallback",
|
||||
"load-balance": "proxies.enums.strategies.load-balance",
|
||||
relay: "proxies.enums.strategies.relay",
|
||||
};
|
||||
|
||||
const PROXY_POLICY_LABEL_KEYS: Record<string, string> =
|
||||
builtinProxyPolicies.reduce(
|
||||
(acc, policy) => {
|
||||
acc[policy] = `proxies.policies.${policy}`;
|
||||
acc[policy] = `proxies.enums.policies.${policy}`;
|
||||
return acc;
|
||||
},
|
||||
{} as Record<string, string>,
|
||||
|
||||
@@ -241,7 +241,7 @@ const rules: {
|
||||
];
|
||||
|
||||
const RULE_TYPE_LABEL_KEYS: Record<string, string> = Object.fromEntries(
|
||||
rules.map((rule) => [rule.name, `ruleEditor.ruleTypes.${rule.name}`]),
|
||||
rules.map((rule) => [rule.name, `rules.editor.ruleTypes.${rule.name}`]),
|
||||
);
|
||||
|
||||
const builtinProxyPolicies = ["DIRECT", "REJECT", "REJECT-DROP", "PASS"];
|
||||
@@ -475,10 +475,10 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
|
||||
const validateRule = () => {
|
||||
if ((ruleType.required ?? true) && !ruleContent) {
|
||||
throw new Error(t("ruleEditor.form.validation.conditionRequired"));
|
||||
throw new Error(t("rules.editor.form.validation.conditionRequired"));
|
||||
}
|
||||
if (ruleType.validator && !ruleType.validator(ruleContent)) {
|
||||
throw new Error(t("ruleEditor.form.validation.invalidRule"));
|
||||
throw new Error(t("rules.editor.form.validation.invalidRule"));
|
||||
}
|
||||
|
||||
const condition = (ruleType.required ?? true) ? ruleContent : "";
|
||||
@@ -503,7 +503,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
<DialogTitle>
|
||||
{
|
||||
<Box display="flex" justifyContent="space-between">
|
||||
{t("ruleEditor.title")}
|
||||
{t("rules.editor.title")}
|
||||
<Box>
|
||||
<Button
|
||||
variant="contained"
|
||||
@@ -533,7 +533,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
}}
|
||||
>
|
||||
<Item>
|
||||
<ListItemText primary={t("ruleEditor.form.labels.type")} />
|
||||
<ListItemText primary={t("rules.editor.form.labels.type")} />
|
||||
<Autocomplete
|
||||
size="small"
|
||||
sx={{ minWidth: "240px" }}
|
||||
@@ -559,7 +559,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
<Item
|
||||
sx={{ display: !(ruleType.required ?? true) ? "none" : "" }}
|
||||
>
|
||||
<ListItemText primary={t("ruleEditor.form.labels.content")} />
|
||||
<ListItemText primary={t("rules.editor.form.labels.content")} />
|
||||
|
||||
{ruleType.name === "RULE-SET" && (
|
||||
<Autocomplete
|
||||
@@ -597,7 +597,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
</Item>
|
||||
<Item>
|
||||
<ListItemText
|
||||
primary={t("ruleEditor.form.labels.proxyPolicy")}
|
||||
primary={t("rules.editor.form.labels.proxyPolicy")}
|
||||
/>
|
||||
<Autocomplete
|
||||
size="small"
|
||||
@@ -622,7 +622,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
{ruleType.noResolve && (
|
||||
<Item>
|
||||
<ListItemText
|
||||
primary={t("ruleEditor.form.toggles.noResolve")}
|
||||
primary={t("rules.editor.form.toggles.noResolve")}
|
||||
/>
|
||||
<Switch
|
||||
checked={noResolve}
|
||||
@@ -645,7 +645,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t("ruleEditor.form.actions.prependRule")}
|
||||
{t("rules.editor.form.actions.prependRule")}
|
||||
</Button>
|
||||
</Item>
|
||||
<Item>
|
||||
@@ -663,7 +663,7 @@ export const RulesEditorViewer = (props: Props) => {
|
||||
}
|
||||
}}
|
||||
>
|
||||
{t("ruleEditor.form.actions.appendRule")}
|
||||
{t("rules.editor.form.actions.appendRule")}
|
||||
</Button>
|
||||
</Item>
|
||||
</List>
|
||||
|
||||
@@ -66,11 +66,11 @@ export const ProviderButton = () => {
|
||||
await refreshProxy();
|
||||
await refreshProxyProviders();
|
||||
|
||||
showNotice.success("providers.notices.updateSuccess", {
|
||||
showNotice.success("proxies.page.provider.notices.updateSuccess", {
|
||||
name,
|
||||
});
|
||||
} catch (err) {
|
||||
showNotice.error("providers.notices.updateFailed", {
|
||||
showNotice.error("proxies.page.provider.notices.updateFailed", {
|
||||
name,
|
||||
message: String(err),
|
||||
});
|
||||
@@ -86,7 +86,7 @@ export const ProviderButton = () => {
|
||||
// 获取所有provider的名称
|
||||
const allProviders = Object.keys(proxyProviders || {});
|
||||
if (allProviders.length === 0) {
|
||||
showNotice.info("providers.notices.none");
|
||||
showNotice.info("proxies.page.provider.notices.none");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -116,9 +116,9 @@ export const ProviderButton = () => {
|
||||
await refreshProxy();
|
||||
await refreshProxyProviders();
|
||||
|
||||
showNotice.success("providers.notices.allUpdated");
|
||||
showNotice.success("proxies.page.provider.notices.allUpdated");
|
||||
} catch (err) {
|
||||
showNotice.error("providers.notices.genericError", {
|
||||
showNotice.error("proxies.page.provider.notices.genericError", {
|
||||
message: String(err),
|
||||
});
|
||||
} finally {
|
||||
|
||||
@@ -58,11 +58,11 @@ export const ProviderButton = () => {
|
||||
await refreshRules();
|
||||
await refreshRuleProviders();
|
||||
|
||||
showNotice.success("providers.notices.updateSuccess", {
|
||||
showNotice.success("rules.page.provider.notices.updateSuccess", {
|
||||
name,
|
||||
});
|
||||
} catch (err) {
|
||||
showNotice.error("providers.notices.updateFailed", {
|
||||
showNotice.error("rules.page.provider.notices.updateFailed", {
|
||||
name,
|
||||
message: String(err),
|
||||
});
|
||||
@@ -78,7 +78,7 @@ export const ProviderButton = () => {
|
||||
// 获取所有provider的名称
|
||||
const allProviders = Object.keys(ruleProviders || {});
|
||||
if (allProviders.length === 0) {
|
||||
showNotice.info("providers.notices.none");
|
||||
showNotice.info("rules.page.provider.notices.none");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -108,9 +108,9 @@ export const ProviderButton = () => {
|
||||
await refreshRules();
|
||||
await refreshRuleProviders();
|
||||
|
||||
showNotice.success("providers.notices.allUpdated");
|
||||
showNotice.success("rules.page.provider.notices.allUpdated");
|
||||
} catch (err) {
|
||||
showNotice.error("providers.notices.genericError", {
|
||||
showNotice.error("rules.page.provider.notices.genericError", {
|
||||
message: String(err),
|
||||
});
|
||||
} finally {
|
||||
|
||||
@@ -27,12 +27,12 @@ const VALID_CORE = [
|
||||
{
|
||||
name: "Mihomo",
|
||||
core: "verge-mihomo",
|
||||
chipKey: "system.labels.releaseVersion",
|
||||
chipKey: "settings.clash.variants.release",
|
||||
},
|
||||
{
|
||||
name: "Mihomo Alpha",
|
||||
core: "verge-mihomo-alpha",
|
||||
chipKey: "system.labels.alphaVersion",
|
||||
chipKey: "settings.clash.variants.alpha",
|
||||
},
|
||||
];
|
||||
|
||||
|
||||
@@ -66,13 +66,13 @@ export function NetworkInterfaceViewer({ ref }: { ref?: Ref<DialogRef> }) {
|
||||
address.V4 && (
|
||||
<AddressDisplay
|
||||
key={address.V4.ip}
|
||||
label={t("settings.networkInterface.labels.ipAddress")}
|
||||
label={t("settings.networkInterface.fields.ipAddress")}
|
||||
content={address.V4.ip}
|
||||
/>
|
||||
),
|
||||
)}
|
||||
<AddressDisplay
|
||||
label={t("settings.networkInterface.labels.macAddress")}
|
||||
label={t("settings.networkInterface.fields.macAddress")}
|
||||
content={item.mac_addr ?? ""}
|
||||
/>
|
||||
</>
|
||||
@@ -84,13 +84,13 @@ export function NetworkInterfaceViewer({ ref }: { ref?: Ref<DialogRef> }) {
|
||||
address.V6 && (
|
||||
<AddressDisplay
|
||||
key={address.V6.ip}
|
||||
label={t("settings.networkInterface.labels.ipAddress")}
|
||||
label={t("settings.networkInterface.fields.ipAddress")}
|
||||
content={address.V6.ip}
|
||||
/>
|
||||
),
|
||||
)}
|
||||
<AddressDisplay
|
||||
label={t("settings.networkInterface.labels.macAddress")}
|
||||
label={t("settings.networkInterface.fields.macAddress")}
|
||||
content={item.mac_addr ?? ""}
|
||||
/>
|
||||
</>
|
||||
|
||||
@@ -56,7 +56,7 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
/>
|
||||
|
||||
<SettingItem
|
||||
label={t("settings.system.labels.autoLaunch")}
|
||||
label={t("settings.system.fields.autoLaunch")}
|
||||
extra={
|
||||
isAdminMode && (
|
||||
<Tooltip title={t("settings.system.tooltips.autoLaunchAdmin")}>
|
||||
@@ -97,7 +97,7 @@ const SettingSystem = ({ onError }: Props) => {
|
||||
</SettingItem>
|
||||
|
||||
<SettingItem
|
||||
label={t("settings.system.labels.silentStart")}
|
||||
label={t("settings.system.fields.silentStart")}
|
||||
extra={
|
||||
<TooltipIcon
|
||||
title={t("settings.system.tooltips.silentStart")}
|
||||
|
||||
@@ -169,7 +169,7 @@ const ProxyControlSwitches = ({
|
||||
<Box sx={{ width: "100%", pr: noRightPadding ? 1 : 2 }}>
|
||||
{isSystemProxyMode && (
|
||||
<SwitchRow
|
||||
label={t("settings.proxyControl.labels.systemProxy")}
|
||||
label={t("settings.proxyControl.fields.systemProxy")}
|
||||
active={systemProxyActualState}
|
||||
infoTitle={t("settings.proxyControl.tooltips.systemProxy")}
|
||||
onInfoClick={() => sysproxyRef.current?.open()}
|
||||
@@ -181,7 +181,7 @@ const ProxyControlSwitches = ({
|
||||
|
||||
{isTunMode && (
|
||||
<SwitchRow
|
||||
label={t("settings.proxyControl.labels.tunMode")}
|
||||
label={t("settings.proxyControl.fields.tunMode")}
|
||||
active={enable_tun_mode || false}
|
||||
infoTitle={t("settings.proxyControl.tooltips.tunMode")}
|
||||
onInfoClick={() => tunRef.current?.open()}
|
||||
|
||||
Reference in New Issue
Block a user