refactor(i18n): consolidate shared and entity namespaces across features
This commit is contained in:
@@ -66,11 +66,11 @@ export const ProviderButton = () => {
|
||||
await refreshProxy();
|
||||
await refreshProxyProviders();
|
||||
|
||||
showNotice.success("proxies.page.provider.notices.updateSuccess", {
|
||||
showNotice.success("entities.proxy.page.provider.notices.updateSuccess", {
|
||||
name,
|
||||
});
|
||||
} catch (err) {
|
||||
showNotice.error("proxies.page.provider.notices.updateFailed", {
|
||||
showNotice.error("entities.proxy.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("proxies.page.provider.notices.none");
|
||||
showNotice.info("entities.proxy.page.provider.notices.none");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -116,9 +116,9 @@ export const ProviderButton = () => {
|
||||
await refreshProxy();
|
||||
await refreshProxyProviders();
|
||||
|
||||
showNotice.success("proxies.page.provider.notices.allUpdated");
|
||||
showNotice.success("entities.proxy.page.provider.notices.allUpdated");
|
||||
} catch (err) {
|
||||
showNotice.error("proxies.page.provider.notices.genericError", {
|
||||
showNotice.error("entities.proxy.page.provider.notices.genericError", {
|
||||
message: String(err),
|
||||
});
|
||||
} finally {
|
||||
@@ -142,7 +142,7 @@ export const ProviderButton = () => {
|
||||
onClick={() => setOpen(true)}
|
||||
sx={{ mr: 1 }}
|
||||
>
|
||||
{t("proxies.page.provider.title")}
|
||||
{t("entities.proxy.page.provider.title")}
|
||||
</Button>
|
||||
|
||||
<Dialog open={open} onClose={handleClose} maxWidth="sm" fullWidth>
|
||||
@@ -153,16 +153,16 @@ export const ProviderButton = () => {
|
||||
alignItems="center"
|
||||
>
|
||||
<Typography variant="h6">
|
||||
{t("proxies.page.provider.title")}
|
||||
{t("entities.proxy.page.provider.title")}
|
||||
</Typography>
|
||||
<Box>
|
||||
<Button
|
||||
variant="contained"
|
||||
size="small"
|
||||
onClick={updateAllProviders}
|
||||
aria-label={t("proxies.page.provider.actions.updateAll")}
|
||||
aria-label={t("entities.proxy.page.provider.actions.updateAll")}
|
||||
>
|
||||
{t("proxies.page.provider.actions.updateAll")}
|
||||
{t("entities.proxy.page.provider.actions.updateAll")}
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -253,7 +253,7 @@ export const ProviderButton = () => {
|
||||
color="text.secondary"
|
||||
noWrap
|
||||
>
|
||||
<small>{t("common.labels.updateAt")}: </small>
|
||||
<small>{t("shared.labels.updateAt")}: </small>
|
||||
{time.fromNow()}
|
||||
</Typography>
|
||||
</Box>
|
||||
@@ -272,14 +272,14 @@ export const ProviderButton = () => {
|
||||
}}
|
||||
>
|
||||
<span
|
||||
title={t("common.labels.usedTotal") as string}
|
||||
title={t("shared.labels.usedTotal") as string}
|
||||
>
|
||||
{parseTraffic(upload + download)} /{" "}
|
||||
{parseTraffic(total)}
|
||||
</span>
|
||||
<span
|
||||
title={
|
||||
t("common.labels.expireTime") as string
|
||||
t("shared.labels.expireTime") as string
|
||||
}
|
||||
>
|
||||
{parseExpire(expire)}
|
||||
@@ -326,8 +326,10 @@ export const ProviderButton = () => {
|
||||
"100%": { transform: "rotate(360deg)" },
|
||||
},
|
||||
}}
|
||||
title={t("proxies.page.provider.actions.update")}
|
||||
aria-label={t("proxies.page.provider.actions.update")}
|
||||
title={t("entities.proxy.page.provider.actions.update")}
|
||||
aria-label={t(
|
||||
"entities.proxy.page.provider.actions.update",
|
||||
)}
|
||||
>
|
||||
<RefreshRounded />
|
||||
</IconButton>
|
||||
@@ -340,7 +342,7 @@ export const ProviderButton = () => {
|
||||
|
||||
<DialogActions>
|
||||
<Button onClick={handleClose} variant="outlined">
|
||||
{t("common.actions.close")}
|
||||
{t("shared.actions.close")}
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</Dialog>
|
||||
|
||||
@@ -159,7 +159,7 @@ const SortableItem = ({ proxy, index, onRemove }: SortableItemProps) => {
|
||||
label={
|
||||
proxy.delay > 0
|
||||
? `${proxy.delay}ms`
|
||||
: t("common.labels.timeout") || "超时"
|
||||
: t("shared.labels.timeout") || "超时"
|
||||
}
|
||||
size="small"
|
||||
color={
|
||||
@@ -303,7 +303,9 @@ export const ProxyChain = ({
|
||||
// onUpdateChain([]);
|
||||
} catch (error) {
|
||||
console.error("Failed to disconnect from proxy chain:", error);
|
||||
alert(t("proxies.page.chain.disconnectFailed") || "断开链式代理失败");
|
||||
alert(
|
||||
t("entities.proxy.page.chain.disconnectFailed") || "断开链式代理失败",
|
||||
);
|
||||
} finally {
|
||||
setIsConnecting(false);
|
||||
}
|
||||
@@ -311,7 +313,10 @@ export const ProxyChain = ({
|
||||
}
|
||||
|
||||
if (proxyChain.length < 2) {
|
||||
alert(t("proxies.page.chain.minimumNodes") || "链式代理至少需要2个节点");
|
||||
alert(
|
||||
t("entities.proxy.page.chain.minimumNodes") ||
|
||||
"链式代理至少需要2个节点",
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -343,7 +348,7 @@ export const ProxyChain = ({
|
||||
console.log("Successfully connected to proxy chain");
|
||||
} catch (error) {
|
||||
console.error("Failed to connect to proxy chain:", error);
|
||||
alert(t("proxies.page.chain.connectFailed") || "连接链式代理失败");
|
||||
alert(t("entities.proxy.page.chain.connectFailed") || "连接链式代理失败");
|
||||
} finally {
|
||||
setIsConnecting(false);
|
||||
}
|
||||
@@ -473,7 +478,9 @@ export const ProxyChain = ({
|
||||
mb: 2,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h6">{t("proxies.page.chain.header")}</Typography>
|
||||
<Typography variant="h6">
|
||||
{t("entities.proxy.page.chain.header")}
|
||||
</Typography>
|
||||
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
|
||||
{proxyChain.length > 0 && (
|
||||
<IconButton
|
||||
@@ -489,7 +496,8 @@ export const ProxyChain = ({
|
||||
},
|
||||
}}
|
||||
title={
|
||||
t("proxies.page.actions.clearChainConfig") || "删除链式配置"
|
||||
t("entities.proxy.page.actions.clearChainConfig") ||
|
||||
"删除链式配置"
|
||||
}
|
||||
>
|
||||
<DeleteIcon fontSize="small" />
|
||||
@@ -511,16 +519,16 @@ export const ProxyChain = ({
|
||||
}}
|
||||
title={
|
||||
proxyChain.length < 2
|
||||
? t("proxies.page.chain.minimumNodes") ||
|
||||
? t("entities.proxy.page.chain.minimumNodes") ||
|
||||
"链式代理至少需要2个节点"
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
{isConnecting
|
||||
? t("proxies.page.actions.connecting") || "连接中..."
|
||||
? t("entities.proxy.page.actions.connecting") || "连接中..."
|
||||
: isConnected
|
||||
? t("proxies.page.actions.disconnect") || "断开"
|
||||
: t("proxies.page.actions.connect") || "连接"}
|
||||
? t("entities.proxy.page.actions.disconnect") || "断开"
|
||||
: t("entities.proxy.page.actions.connect") || "连接"}
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
@@ -530,9 +538,9 @@ export const ProxyChain = ({
|
||||
sx={{ mb: 2 }}
|
||||
>
|
||||
{proxyChain.length === 1
|
||||
? t("proxies.page.chain.minimumNodesHint") ||
|
||||
? t("entities.proxy.page.chain.minimumNodesHint") ||
|
||||
"链式代理至少需要2个节点,请再添加一个节点。"
|
||||
: t("proxies.page.chain.instruction") ||
|
||||
: t("entities.proxy.page.chain.instruction") ||
|
||||
"按顺序点击节点添加到代理链中"}
|
||||
</Alert>
|
||||
|
||||
@@ -547,7 +555,7 @@ export const ProxyChain = ({
|
||||
color: theme.palette.text.secondary,
|
||||
}}
|
||||
>
|
||||
<Typography>{t("proxies.page.chain.empty")}</Typography>
|
||||
<Typography>{t("entities.proxy.page.chain.empty")}</Typography>
|
||||
</Box>
|
||||
) : (
|
||||
<DndContext
|
||||
|
||||
@@ -239,7 +239,7 @@ export const ProxyGroups = (props: Props) => {
|
||||
setProxyChain((prev) => {
|
||||
// 检查是否已经存在相同名称的代理,防止重复添加
|
||||
if (prev.some((item) => item.name === proxy.name)) {
|
||||
const warningMessage = t("proxies.page.chain.duplicateNode");
|
||||
const warningMessage = t("entities.proxy.page.chain.duplicateNode");
|
||||
setDuplicateWarning({
|
||||
open: true,
|
||||
message: warningMessage,
|
||||
@@ -372,7 +372,7 @@ export const ProxyGroups = (props: Props) => {
|
||||
}, [renderList]);
|
||||
|
||||
if (mode === "direct") {
|
||||
return <BaseEmpty textKey="proxies.page.messages.directMode" />;
|
||||
return <BaseEmpty textKey="entities.proxy.page.messages.directMode" />;
|
||||
}
|
||||
|
||||
if (isChainMode) {
|
||||
@@ -403,7 +403,7 @@ export const ProxyGroups = (props: Props) => {
|
||||
variant="h6"
|
||||
sx={{ fontWeight: 600, fontSize: "16px" }}
|
||||
>
|
||||
{t("proxies.page.rules.title")}
|
||||
{t("entities.proxy.page.rules.title")}
|
||||
</Typography>
|
||||
{currentGroup && (
|
||||
<Box
|
||||
@@ -442,7 +442,7 @@ export const ProxyGroups = (props: Props) => {
|
||||
variant="body2"
|
||||
sx={{ mr: 0.5, fontSize: "12px" }}
|
||||
>
|
||||
{t("proxies.page.rules.select")}
|
||||
{t("entities.proxy.page.rules.select")}
|
||||
</Typography>
|
||||
<ExpandMoreRounded fontSize="small" />
|
||||
</IconButton>
|
||||
|
||||
@@ -67,7 +67,7 @@ export const ProxyHead = ({
|
||||
<IconButton
|
||||
size="small"
|
||||
color="inherit"
|
||||
title={t("proxies.page.tooltips.locate")}
|
||||
title={t("entities.proxy.page.tooltips.locate")}
|
||||
onClick={onLocation}
|
||||
>
|
||||
<MyLocationRounded />
|
||||
@@ -76,7 +76,7 @@ export const ProxyHead = ({
|
||||
<IconButton
|
||||
size="small"
|
||||
color="inherit"
|
||||
title={t("proxies.page.tooltips.delayCheck")}
|
||||
title={t("entities.proxy.page.tooltips.delayCheck")}
|
||||
onClick={() => {
|
||||
console.log(`[ProxyHead] 点击延迟测试按钮,组: ${groupName}`);
|
||||
// Remind the user that it is custom test url
|
||||
@@ -95,9 +95,9 @@ export const ProxyHead = ({
|
||||
color="inherit"
|
||||
title={
|
||||
[
|
||||
t("proxies.page.tooltips.sortDefault"),
|
||||
t("proxies.page.tooltips.sortDelay"),
|
||||
t("proxies.page.tooltips.sortName"),
|
||||
t("entities.proxy.page.tooltips.sortDefault"),
|
||||
t("entities.proxy.page.tooltips.sortDelay"),
|
||||
t("entities.proxy.page.tooltips.sortName"),
|
||||
][sortType]
|
||||
}
|
||||
onClick={() =>
|
||||
@@ -112,7 +112,7 @@ export const ProxyHead = ({
|
||||
<IconButton
|
||||
size="small"
|
||||
color="inherit"
|
||||
title={t("proxies.page.tooltips.delayCheckUrl")}
|
||||
title={t("entities.proxy.page.tooltips.delayCheckUrl")}
|
||||
onClick={() =>
|
||||
onHeadState({ textState: textState === "url" ? null : "url" })
|
||||
}
|
||||
@@ -129,8 +129,8 @@ export const ProxyHead = ({
|
||||
color="inherit"
|
||||
title={
|
||||
showType
|
||||
? t("proxies.page.tooltips.showBasic")
|
||||
: t("proxies.page.tooltips.showDetail")
|
||||
? t("entities.proxy.page.tooltips.showBasic")
|
||||
: t("entities.proxy.page.tooltips.showDetail")
|
||||
}
|
||||
onClick={() => onHeadState({ showType: !showType })}
|
||||
>
|
||||
@@ -140,7 +140,7 @@ export const ProxyHead = ({
|
||||
<IconButton
|
||||
size="small"
|
||||
color="inherit"
|
||||
title={t("proxies.page.tooltips.filter")}
|
||||
title={t("entities.proxy.page.tooltips.filter")}
|
||||
onClick={() =>
|
||||
onHeadState({ textState: textState === "filter" ? null : "filter" })
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export const ProxyHead = ({
|
||||
value={filterText}
|
||||
size="small"
|
||||
variant="outlined"
|
||||
placeholder={t("proxies.page.placeholders.filter")}
|
||||
placeholder={t("entities.proxy.page.placeholders.filter")}
|
||||
onChange={(e) => onHeadState({ filterText: e.target.value })}
|
||||
sx={{ ml: 0.5, flex: "1 1 auto", input: { py: 0.65, px: 1 } }}
|
||||
/>
|
||||
@@ -175,7 +175,7 @@ export const ProxyHead = ({
|
||||
value={testUrl}
|
||||
size="small"
|
||||
variant="outlined"
|
||||
placeholder={t("proxies.page.placeholders.delayCheckUrl")}
|
||||
placeholder={t("entities.proxy.page.placeholders.delayCheckUrl")}
|
||||
onChange={(e) => onHeadState({ testUrl: e.target.value })}
|
||||
sx={{ ml: 0.5, flex: "1 1 auto", input: { py: 0.65, px: 1 } }}
|
||||
/>
|
||||
|
||||
@@ -272,7 +272,7 @@ export const ProxyItemMini = (props: Props) => {
|
||||
className={proxy.name === group.now ? "the-pin" : "the-unpin"}
|
||||
title={
|
||||
group.type === "URLTest"
|
||||
? t("proxies.page.labels.delayCheckReset")
|
||||
? t("entities.proxy.page.labels.delayCheckReset")
|
||||
: ""
|
||||
}
|
||||
>
|
||||
|
||||
@@ -160,7 +160,7 @@ export const ProxyRender = (props: RenderProps) => {
|
||||
}}
|
||||
/>
|
||||
<Box sx={{ display: "flex", alignItems: "center" }}>
|
||||
<Tooltip title={t("proxies.page.labels.proxyCount")} arrow>
|
||||
<Tooltip title={t("entities.proxy.page.labels.proxyCount")} arrow>
|
||||
<Chip
|
||||
size="small"
|
||||
label={`${group.all.length}`}
|
||||
|
||||
Reference in New Issue
Block a user