mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-10-25 17:22:27 +08:00
fix(i18n): reword the failed quota line in Chinese as "query failed"
The Simplified and Traditional Chinese copy for a failed quota query, "额度没查到" / "額度沒查到", read as a casual remark rather than a status. Use "额度查询失败" / "額度查詢失敗" on the provider card, in the auth center's account quota column (including its defaultValue fallback) and in the tray, where the two variants with a reason now read "额度查询失败:登录已过期" and "额度查询失败:令牌待刷新". English, Japanese and Turkish are unchanged. Tests and comments that quoted the old wording are updated.
This commit is contained in:
1 parent
72b056f6e6
commit
e68e694374
9 files changed
+19
-19
No files matched your search
@@ -497,7 +497,7 @@ fn build_provider_meta(
|
|||||||
|
|
||||||
// 套餐地址且没带脚本:和在应用里新建一样,按套餐额度查询并默认启用
|
// 套餐地址且没带脚本:和在应用里新建一样,按套餐额度查询并默认启用
|
||||||
// (链接写了 `usageEnabled` 仍照办)。额度走后端固定端点,不执行任何脚本。
|
// (链接写了 `usageEnabled` 仍照办)。额度走后端固定端点,不执行任何脚本。
|
||||||
// 火山例外:查额度要账号级 AccessKey,链接里没有,默认启用只会显示「额度没查到」,
|
// 火山例外:查额度要账号级 AccessKey,链接里没有,默认启用只会显示「额度查询失败」,
|
||||||
// 所以只预选套餐不启用(前端 `codingPlanEnabledByDefault` 与此一致)。
|
// 所以只预选套餐不启用(前端 `codingPlanEnabledByDefault` 与此一致)。
|
||||||
if let (Some(provider_id), true) = (coding_plan_provider, code.is_empty()) {
|
if let (Some(provider_id), true) = (coding_plan_provider, code.is_empty()) {
|
||||||
return Ok(Some(ProviderMeta {
|
return Ok(Some(ProviderMeta {
|
||||||
|
|||||||
@@ -401,9 +401,9 @@ impl TrayTexts {
|
|||||||
balance: "餘額 {value}",
|
balance: "餘額 {value}",
|
||||||
plan_expired: "方案已過期",
|
plan_expired: "方案已過期",
|
||||||
used_amount: "已使用 {value}",
|
used_amount: "已使用 {value}",
|
||||||
quota_failed: "額度沒查到",
|
quota_failed: "額度查詢失敗",
|
||||||
quota_failed_login_expired: "額度沒查到:登入已過期",
|
quota_failed_login_expired: "額度查詢失敗:登入已過期",
|
||||||
quota_failed_token_refresh_pending: "額度沒查到:權杖待重新整理",
|
quota_failed_token_refresh_pending: "額度查詢失敗:權杖待重新整理",
|
||||||
reset_on_date: "{labelSp}額度 {when}重置",
|
reset_on_date: "{labelSp}額度 {when}重置",
|
||||||
reset_at_time: "{labelSp}額度 {when} 重置",
|
reset_at_time: "{labelSp}額度 {when} 重置",
|
||||||
date_format: "%-m 月 %-d 日",
|
date_format: "%-m 月 %-d 日",
|
||||||
@@ -455,9 +455,9 @@ impl TrayTexts {
|
|||||||
balance: "余额 {value}",
|
balance: "余额 {value}",
|
||||||
plan_expired: "套餐已过期",
|
plan_expired: "套餐已过期",
|
||||||
used_amount: "已使用 {value}",
|
used_amount: "已使用 {value}",
|
||||||
quota_failed: "额度没查到",
|
quota_failed: "额度查询失败",
|
||||||
quota_failed_login_expired: "额度没查到:登录已过期",
|
quota_failed_login_expired: "额度查询失败:登录已过期",
|
||||||
quota_failed_token_refresh_pending: "额度没查到:令牌待刷新",
|
quota_failed_token_refresh_pending: "额度查询失败:令牌待刷新",
|
||||||
reset_on_date: "{labelSp}额度 {when}重置",
|
reset_on_date: "{labelSp}额度 {when}重置",
|
||||||
reset_at_time: "{labelSp}额度 {when} 重置",
|
reset_at_time: "{labelSp}额度 {when} 重置",
|
||||||
date_format: "%-m 月 %-d 日",
|
date_format: "%-m 月 %-d 日",
|
||||||
@@ -3724,7 +3724,7 @@ mod tests {
|
|||||||
assert_eq!(title(failed.clone()), None);
|
assert_eq!(title(failed.clone()), None);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
quota_note(&zh(), &failed.unwrap(), now()).as_deref(),
|
quota_note(&zh(), &failed.unwrap(), now()).as_deref(),
|
||||||
Some("额度没查到")
|
Some("额度查询失败")
|
||||||
);
|
);
|
||||||
|
|
||||||
let login =
|
let login =
|
||||||
@@ -3732,7 +3732,7 @@ mod tests {
|
|||||||
let view = format_subscription_quota(&zh(), &login).unwrap();
|
let view = format_subscription_quota(&zh(), &login).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
quota_note(&zh(), &view, now()).as_deref(),
|
quota_note(&zh(), &view, now()).as_deref(),
|
||||||
Some("额度没查到:登录已过期")
|
Some("额度查询失败:登录已过期")
|
||||||
);
|
);
|
||||||
let pending = SubscriptionQuota::error(
|
let pending = SubscriptionQuota::error(
|
||||||
"claude",
|
"claude",
|
||||||
@@ -3742,7 +3742,7 @@ mod tests {
|
|||||||
let view = format_subscription_quota(&zh(), &pending).unwrap();
|
let view = format_subscription_quota(&zh(), &pending).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
quota_note(&zh(), &view, now()).as_deref(),
|
quota_note(&zh(), &view, now()).as_deref(),
|
||||||
Some("额度没查到:令牌待刷新")
|
Some("额度查询失败:令牌待刷新")
|
||||||
);
|
);
|
||||||
// 没有凭据时不说话。
|
// 没有凭据时不说话。
|
||||||
let missing =
|
let missing =
|
||||||
|
|||||||
@@ -200,7 +200,7 @@ export function quotaRows(
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 额度没查到的原因:登录过期 / 令牌待刷新写固定文案,其余写后端给的错误 */
|
/** 额度查询失败的原因:登录过期 / 令牌待刷新写固定文案,其余写后端给的错误 */
|
||||||
export function quotaFailureReason(
|
export function quotaFailureReason(
|
||||||
t: TFunction,
|
t: TFunction,
|
||||||
quota: SubscriptionQuota,
|
quota: SubscriptionQuota,
|
||||||
@@ -216,7 +216,7 @@ export function quotaFailureReason(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 纯展示组件:渲染 SubscriptionQuota 的状态(not_found / parse_error 不显示;
|
* 纯展示组件:渲染 SubscriptionQuota 的状态(not_found / parse_error 不显示;
|
||||||
* 登录过期 / 令牌待刷新 / 查询失败写「额度没查到」+ 原因;成功按档写剩余或已用),支持卡片(inline)和展开两种布局。
|
* 登录过期 / 令牌待刷新 / 查询失败写「额度查询失败」+ 原因;成功按档写剩余或已用),支持卡片(inline)和展开两种布局。
|
||||||
*
|
*
|
||||||
* 数据源由调用方 hook 注入,方便不同的额度后端复用同一套渲染逻辑:
|
* 数据源由调用方 hook 注入,方便不同的额度后端复用同一套渲染逻辑:
|
||||||
* - `SubscriptionQuotaFooter`(CLI 凭据路径,by appId)
|
* - `SubscriptionQuotaFooter`(CLI 凭据路径,by appId)
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ function isRejectedResult(result: unknown): boolean {
|
|||||||
* 点击触发的重查:从点下去开始转,直到查完且满 MIN_REFRESH_SPIN_MS,再按结果换成 ✓ 或 ✗
|
* 点击触发的重查:从点下去开始转,直到查完且满 MIN_REFRESH_SPIN_MS,再按结果换成 ✓ 或 ✗
|
||||||
* 停一会儿。✗ 不能省:本来就没查到、再点又失败时,红字前后一模一样,没有它就像没点过。
|
* 停一会儿。✗ 不能省:本来就没查到、再点又失败时,红字前后一模一样,没有它就像没点过。
|
||||||
*
|
*
|
||||||
* 成败两头看:额度列换成了「额度没查到」,或 refetch() 的结果是失败——后者管的是
|
* 成败两头看:额度列换成了「额度查询失败」,或 refetch() 的结果是失败——后者管的是
|
||||||
* 「保留上次成功值」窗口里的瞬时失败(界面照旧显示旧值,只看额度行会误打 ✓)。
|
* 「保留上次成功值」窗口里的瞬时失败(界面照旧显示旧值,只看额度行会误打 ✓)。
|
||||||
* 要等 Promise 有结果且 loading 落下(新的额度行已渲染)两件事都到,才下结论。
|
* 要等 Promise 有结果且 loading 落下(新的额度行已渲染)两件事都到,才下结论。
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ export interface AccountQuotaRow {
|
|||||||
line: QuotaLine;
|
line: QuotaLine;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 额度列要画的东西:成功按档画条;查询失败写「额度没查到」+ 原因;查成功但没有额度时写一句灰字;null 表示不显示 */
|
/** 额度列要画的东西:成功按档画条;查询失败写「额度查询失败」+ 原因;查成功但没有额度时写一句灰字;null 表示不显示 */
|
||||||
export type AccountQuotaState =
|
export type AccountQuotaState =
|
||||||
| { kind: "rows"; rows: AccountQuotaRow[] }
|
| { kind: "rows"; rows: AccountQuotaRow[] }
|
||||||
| { kind: "failed"; reason: string }
|
| { kind: "failed"; reason: string }
|
||||||
@@ -131,7 +131,7 @@ export function AccountQuotaColumn({
|
|||||||
{state.kind === "failed" && (
|
{state.kind === "failed" && (
|
||||||
<>
|
<>
|
||||||
<span className="h-[18px] text-caption font-medium text-danger-text">
|
<span className="h-[18px] text-caption font-medium text-danger-text">
|
||||||
{t("quota.failed", { defaultValue: "额度没查到" })}
|
{t("quota.failed", { defaultValue: "额度查询失败" })}
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className="truncate text-caption text-fg-3"
|
className="truncate text-caption text-fg-3"
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export function detectCodingPlanProvider(
|
|||||||
/**
|
/**
|
||||||
* 认出套餐地址后,额度查询是否默认启用。火山查额度要账号级 AccessKey ID +
|
* 认出套餐地址后,额度查询是否默认启用。火山查额度要账号级 AccessKey ID +
|
||||||
* Secret(不是推理 Key),新建或导入时还没有这两项,启用了只会在卡片上显示
|
* Secret(不是推理 Key),新建或导入时还没有这两项,启用了只会在卡片上显示
|
||||||
* 「额度没查到」,被误读成供应商没生效(#8494)。所以火山只预选套餐、不启用,
|
* 「额度查询失败」,被误读成供应商没生效(#8494)。所以火山只预选套餐、不启用,
|
||||||
* 等用户在额度设置里填好凭据再打开。与后端深链接导入的默认值一致。
|
* 等用户在额度设置里填好凭据再打开。与后端深链接导入的默认值一致。
|
||||||
*/
|
*/
|
||||||
export function codingPlanEnabledByDefault(
|
export function codingPlanEnabledByDefault(
|
||||||
|
|||||||
@@ -4458,7 +4458,7 @@
|
|||||||
"usedUp": "已用完",
|
"usedUp": "已用完",
|
||||||
"balance": "餘額 {{value}}",
|
"balance": "餘額 {{value}}",
|
||||||
"planExpired": "方案已過期",
|
"planExpired": "方案已過期",
|
||||||
"failed": "額度沒查到",
|
"failed": "額度查詢失敗",
|
||||||
"reason": {
|
"reason": {
|
||||||
"loginExpired": "登入已過期",
|
"loginExpired": "登入已過期",
|
||||||
"tokenRefreshPending": "權杖待重新整理"
|
"tokenRefreshPending": "權杖待重新整理"
|
||||||
|
|||||||
@@ -4457,7 +4457,7 @@
|
|||||||
"usedUp": "已用完",
|
"usedUp": "已用完",
|
||||||
"balance": "余额 {{value}}",
|
"balance": "余额 {{value}}",
|
||||||
"planExpired": "套餐已过期",
|
"planExpired": "套餐已过期",
|
||||||
"failed": "额度没查到",
|
"failed": "额度查询失败",
|
||||||
"reason": {
|
"reason": {
|
||||||
"loginExpired": "登录已过期",
|
"loginExpired": "登录已过期",
|
||||||
"tokenRefreshPending": "令牌待刷新"
|
"tokenRefreshPending": "令牌待刷新"
|
||||||
|
|||||||
@@ -267,7 +267,7 @@ describe("credential failures", () => {
|
|||||||
|
|
||||||
it("says the token is waiting for a refresh, not that the login expired", () => {
|
it("says the token is waiting for a refresh, not that the login expired", () => {
|
||||||
failed("refresh_pending");
|
failed("refresh_pending");
|
||||||
expect(screen.getByText("额度没查到")).toBeInTheDocument();
|
expect(screen.getByText("额度查询失败")).toBeInTheDocument();
|
||||||
expect(screen.getByText("令牌待刷新")).toBeInTheDocument();
|
expect(screen.getByText("令牌待刷新")).toBeInTheDocument();
|
||||||
expect(screen.queryByText("登录已过期")).not.toBeInTheDocument();
|
expect(screen.queryByText("登录已过期")).not.toBeInTheDocument();
|
||||||
expect(screen.queryByText("raw backend message")).not.toBeInTheDocument();
|
expect(screen.queryByText("raw backend message")).not.toBeInTheDocument();
|
||||||
|
|||||||
Reference in new issue
Block a user