refactor(i18n): remove pages.* namespace and migrate route texts under module-level page keys

This commit is contained in:
Slinetrac
2025-11-02 21:18:33 +08:00
Unverified
parent e6df315bb0
commit 3512caebae
72 changed files with 13589 additions and 13755 deletions

View File

@@ -66,11 +66,11 @@ export const ProviderButton = () => {
await refreshProxy();
await refreshProxyProviders();
showNotice.success("components.providers.notices.updateSuccess", {
showNotice.success("providers.notices.updateSuccess", {
name,
});
} catch (err) {
showNotice.error("components.providers.notices.updateFailed", {
showNotice.error("providers.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("components.providers.notices.none");
showNotice.info("providers.notices.none");
return;
}
@@ -116,9 +116,9 @@ export const ProviderButton = () => {
await refreshProxy();
await refreshProxyProviders();
showNotice.success("components.providers.notices.allUpdated");
showNotice.success("providers.notices.allUpdated");
} catch (err) {
showNotice.error("components.providers.notices.genericError", {
showNotice.error("providers.notices.genericError", {
message: String(err),
});
} finally {
@@ -142,7 +142,7 @@ export const ProviderButton = () => {
onClick={() => setOpen(true)}
sx={{ mr: 1 }}
>
{t("pages.proxies.provider.title")}
{t("proxies.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("pages.proxies.provider.title")}
{t("proxies.page.provider.title")}
</Typography>
<Box>
<Button
variant="contained"
size="small"
onClick={updateAllProviders}
aria-label={t("pages.proxies.provider.actions.updateAll")}
aria-label={t("proxies.page.provider.actions.updateAll")}
>
{t("pages.proxies.provider.actions.updateAll")}
{t("proxies.page.provider.actions.updateAll")}
</Button>
</Box>
</Box>
@@ -320,8 +320,8 @@ export const ProviderButton = () => {
"100%": { transform: "rotate(360deg)" },
},
}}
title={t("pages.proxies.provider.actions.update")}
aria-label={t("pages.proxies.provider.actions.update")}
title={t("proxies.page.provider.actions.update")}
aria-label={t("proxies.page.provider.actions.update")}
>
<RefreshRounded />
</IconButton>

View File

@@ -299,7 +299,7 @@ export const ProxyChain = ({
// onUpdateChain([]);
} catch (error) {
console.error("Failed to disconnect from proxy chain:", error);
alert(t("pages.proxies.chain.disconnectFailed") || "断开链式代理失败");
alert(t("proxies.page.chain.disconnectFailed") || "断开链式代理失败");
} finally {
setIsConnecting(false);
}
@@ -307,7 +307,7 @@ export const ProxyChain = ({
}
if (proxyChain.length < 2) {
alert(t("pages.proxies.chain.minimumNodes") || "链式代理至少需要2个节点");
alert(t("proxies.page.chain.minimumNodes") || "链式代理至少需要2个节点");
return;
}
@@ -339,7 +339,7 @@ export const ProxyChain = ({
console.log("Successfully connected to proxy chain");
} catch (error) {
console.error("Failed to connect to proxy chain:", error);
alert(t("pages.proxies.chain.connectFailed") || "连接链式代理失败");
alert(t("proxies.page.chain.connectFailed") || "连接链式代理失败");
} finally {
setIsConnecting(false);
}
@@ -469,7 +469,7 @@ export const ProxyChain = ({
mb: 2,
}}
>
<Typography variant="h6">{t("pages.proxies.chain.header")}</Typography>
<Typography variant="h6">{t("proxies.page.chain.header")}</Typography>
<Box sx={{ display: "flex", alignItems: "center", gap: 1 }}>
{proxyChain.length > 0 && (
<IconButton
@@ -485,7 +485,7 @@ export const ProxyChain = ({
},
}}
title={
t("pages.proxies.actions.clearChainConfig") || "删除链式配置"
t("proxies.page.actions.clearChainConfig") || "删除链式配置"
}
>
<DeleteIcon fontSize="small" />
@@ -507,16 +507,16 @@ export const ProxyChain = ({
}}
title={
proxyChain.length < 2
? t("pages.proxies.chain.minimumNodes") ||
? t("proxies.page.chain.minimumNodes") ||
"链式代理至少需要2个节点"
: undefined
}
>
{isConnecting
? t("pages.proxies.actions.connecting") || "连接中..."
? t("proxies.page.actions.connecting") || "连接中..."
: isConnected
? t("pages.proxies.actions.disconnect") || "断开"
: t("pages.proxies.actions.connect") || "连接"}
? t("proxies.page.actions.disconnect") || "断开"
: t("proxies.page.actions.connect") || "连接"}
</Button>
</Box>
</Box>
@@ -526,9 +526,9 @@ export const ProxyChain = ({
sx={{ mb: 2 }}
>
{proxyChain.length === 1
? t("pages.proxies.chain.minimumNodesHint") ||
? t("proxies.page.chain.minimumNodesHint") ||
"链式代理至少需要2个节点请再添加一个节点。"
: t("pages.proxies.chain.instruction") ||
: t("proxies.page.chain.instruction") ||
"按顺序点击节点添加到代理链中"}
</Alert>
@@ -543,7 +543,7 @@ export const ProxyChain = ({
color: theme.palette.text.secondary,
}}
>
<Typography>{t("pages.proxies.chain.empty")}</Typography>
<Typography>{t("proxies.page.chain.empty")}</Typography>
</Box>
) : (
<DndContext

View File

@@ -239,7 +239,7 @@ export const ProxyGroups = (props: Props) => {
setProxyChain((prev) => {
// 检查是否已经存在相同名称的代理,防止重复添加
if (prev.some((item) => item.name === proxy.name)) {
const warningMessage = t("pages.proxies.chain.duplicateNode");
const warningMessage = t("proxies.page.chain.duplicateNode");
setDuplicateWarning({
open: true,
message: warningMessage,
@@ -403,7 +403,7 @@ export const ProxyGroups = (props: Props) => {
variant="h6"
sx={{ fontWeight: 600, fontSize: "16px" }}
>
{t("pages.proxies.rules.title")}
{t("proxies.page.rules.title")}
</Typography>
{currentGroup && (
<Box
@@ -442,7 +442,7 @@ export const ProxyGroups = (props: Props) => {
variant="body2"
sx={{ mr: 0.5, fontSize: "12px" }}
>
{t("pages.proxies.rules.select")}
{t("proxies.page.rules.select")}
</Typography>
<ExpandMoreRounded fontSize="small" />
</IconButton>

View File

@@ -67,7 +67,7 @@ export const ProxyHead = ({
<IconButton
size="small"
color="inherit"
title={t("pages.proxies.tooltips.locate")}
title={t("proxies.page.tooltips.locate")}
onClick={onLocation}
>
<MyLocationRounded />
@@ -76,7 +76,7 @@ export const ProxyHead = ({
<IconButton
size="small"
color="inherit"
title={t("pages.proxies.tooltips.delayCheck")}
title={t("proxies.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("pages.proxies.tooltips.sortDefault"),
t("pages.proxies.tooltips.sortDelay"),
t("pages.proxies.tooltips.sortName"),
t("proxies.page.tooltips.sortDefault"),
t("proxies.page.tooltips.sortDelay"),
t("proxies.page.tooltips.sortName"),
][sortType]
}
onClick={() =>
@@ -112,7 +112,7 @@ export const ProxyHead = ({
<IconButton
size="small"
color="inherit"
title={t("pages.proxies.tooltips.delayCheckUrl")}
title={t("proxies.page.tooltips.delayCheckUrl")}
onClick={() =>
onHeadState({ textState: textState === "url" ? null : "url" })
}
@@ -129,8 +129,8 @@ export const ProxyHead = ({
color="inherit"
title={
showType
? t("pages.proxies.tooltips.showBasic")
: t("pages.proxies.tooltips.showDetail")
? t("proxies.page.tooltips.showBasic")
: t("proxies.page.tooltips.showDetail")
}
onClick={() => onHeadState({ showType: !showType })}
>
@@ -140,7 +140,7 @@ export const ProxyHead = ({
<IconButton
size="small"
color="inherit"
title={t("pages.proxies.tooltips.filter")}
title={t("proxies.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("pages.proxies.placeholders.filter")}
placeholder={t("proxies.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("pages.proxies.placeholders.delayCheckUrl")}
placeholder={t("proxies.page.placeholders.delayCheckUrl")}
onChange={(e) => onHeadState({ testUrl: e.target.value })}
sx={{ ml: 0.5, flex: "1 1 auto", input: { py: 0.65, px: 1 } }}
/>

View File

@@ -272,7 +272,7 @@ export const ProxyItemMini = (props: Props) => {
className={proxy.name === group.now ? "the-pin" : "the-unpin"}
title={
group.type === "URLTest"
? t("pages.proxies.labels.delayCheckReset")
? t("proxies.page.labels.delayCheckReset")
: ""
}
>

View File

@@ -160,7 +160,7 @@ export const ProxyRender = (props: RenderProps) => {
}}
/>
<Box sx={{ display: "flex", alignItems: "center" }}>
<Tooltip title={t("pages.proxies.labels.proxyCount")} arrow>
<Tooltip title={t("proxies.page.labels.proxyCount")} arrow>
<Chip
size="small"
label={`${group.all.length}`}