Files
Unlucky-Launcher/crates/i18n/src/catalog/download.rs
T
AskaEth 45544791e5 fix(app-iced): M107 r1 复审五条 p2 —— 搜索与主版本桶一致、chips 可滚、单复数、端到端
复审 r1(p2-5items / fix-then-merge)的五条可达问题,逐条落点:

- **P2-1** 搜索命中数与主版本桶不再自相矛盾:`group::active_bucket` 让第二级在搜索期间
  **自动放宽到「全部」**(选择本身留在模型里,清空搜索后回来),侧栏点亮「全部版本」⇒ 没有幽灵选中;
  `rebuild_after_query` 回填时校验桶仍存在(新桶列表里没有的选择直接丢弃)。
  判据:`a_search_hit_never_lands_on_an_empty_list`(4 分类 × 5 桶值 × 4 查询词的矩阵)+ 出图 11
- **P2-2** chips 档的主版本行套**横向滚动**(显式滚动条),竖栏与 chips 吃同一份 `major_entries`;
  22 桶夹具断言最后一个桶 `1.0` 在列表里,出图 12 看得到滚动条
- **P2-3** 只做搜索这条路径(`rebuild_after_query` + 校验 + app 层测试);`app/state.rs::refresh_view`
  的全量修法**留到 M105 之后**(不在 scope,且 M105 正改同一片文件)——报告里明写
- **P2-4** `1 matches` 修掉:新增 `VersionSearchHitsOne` / `VersionSearchElsewhereOne` 两条单数 key,
  「在别处」用独立标题(不再拿命中数当标题,同屏一个数只报一次)
- **P2-5** 搜索链路补 4 条 **app 层端到端**(键入 → 快照 → 重建 → 列表);变异自证:
  删 `self.state.download_query = query` ⇒ 2 条红;`from_snapshot` 忽略 query ⇒ 8 条红;
  去掉 `active_bucket` 的放宽 ⇒ 4 条红
- 顺带:64 宽图标条每项挂 tooltip(复审建议);`install.rs` 那段自相矛盾的文档订正

门禁:fmt 0 / app-iced lib 431 passed / workspace --exclude unlucky-app 全绿(见报告)
2026-11-05 02:01:11 +08:00

138 lines
7.2 KiB
Rust
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
//! 下载页文案(M94)。
//!
//! 一句话一个 key:带变量的句子用 `{name}`,页面只做 [`crate::Catalog::render`],不拼片段
//! ([`crate::bridge`] 的规矩 1)。
//!
//! 文案口径(M94 r1 / P2-2):**只说这个页面真能做到的动作**(切分类、刷新、看日志),
//! 不写「稍后会自动重试」这类 UI 没有的能力,也不拿文案去补功能。
//!
//! 域文件的形状见 [`crate::catalog`] 的「域装配」一节。
macro_rules! download_entries {
($next:ident, $($rest:ident,)* { $($acc:tt)* }) => {
$next! { $($rest,)* {
$($acc)*
// --- download page (M94) ---
DownloadTitle => ("Downloads", "下载"),
DownloadSubtitle => ("Versions you can install", "可以安装的版本"),
DownloadRefresh => ("Refresh", "刷新"),
DownloadInstall => ("Install", "安装"),
DownloadCancel => ("Cancel install", "取消安装"),
DownloadInstalled => ("Installed", "已安装"),
DownloadCount => ("{count} versions", "{count} 个版本"),
DownloadRowSupporting => ("{kind} · released {date}", "{kind} · 发布于 {date}"),
DownloadSelectHint => ("Pick a version, then install", "选一个版本再安装"),
DownloadLoading => ("Loading versions…", "正在加载版本列表…"),
DownloadLoadingHint => (
"If this stays here, press Refresh in the top right.",
"如果一直停在这里,点右上角的刷新。"
),
DownloadEmptyTitle => ("No versions to show", "没有可显示的版本"),
DownloadEmptyBody => (
"Pick another category, or refresh the list.",
"换一个分类,或刷新一次列表。"
),
DownloadCategoryAll => ("All", "全部"),
DownloadCategoryRelease => ("Release", "正式版"),
DownloadCategorySnapshot => ("Snapshot", "预览版"),
DownloadCategoryAncient => ("Ancient", "远古版"),
DownloadStagePlanning => ("Planning", "解析版本"),
DownloadStageDownloading => ("Downloading files", "下载文件"),
DownloadStageInstalling => ("Building the version", "生成版本"),
DownloadStageRegistering => ("Registering the instance", "登记实例"),
DownloadStageDone => ("Done", "已完成"),
DownloadStageFailed => ("Install failed", "安装失败"),
DownloadStageCancelled => ("Install cancelled", "安装已取消"),
DownloadProgress => (
"{done}/{total} files",
"{done}/{total} 文件"
),
DownloadProgressUnknown => ("Waiting for the first file…", "等第一个文件…"),
// 速率与剩余时间是两个独立短语,各占一个 key(`DownloadRate` 只负责把它们排成一行)
DownloadRate => ("{speed} · {eta}", "{speed},{eta}"),
DownloadEtaSecs => ("{secs}s left", "剩 {secs}s"),
DownloadEtaMins => ("{mins}m{secs}s left", "剩 {mins}m{secs}s"),
DownloadFailedHint => (
"The Logs page has the full reason.",
"完整原因在日志页。"
),
DownloadOpenLogs => ("Open logs", "打开日志"),
DownloadDismiss => ("Dismiss", "关闭"),
// --- 安装选项(M105)---
DownloadOptionsTitle => ("Install options", "安装选项"),
DownloadOptionsLoaderVersion => ("Loader version", "加载器版本"),
DownloadOptionsLoaderVersionsLoading => (
"Fetching loader versions…",
"正在获取加载器版本…"
),
DownloadOptionsLoaderVersionsFailed => (
"Could not fetch loader versions: {reason}",
"取不到加载器版本:{reason}"
),
DownloadOptionsLoaderVersionsEmpty => (
"No loader builds published for {version}",
"官方没有为 {version} 发布加载器版本"
),
DownloadOptionsInstanceName => ("Instance name", "实例名"),
DownloadOptionsInstanceNameHint => (
"Empty = use the version id",
"留空就用版本号"
),
DownloadOptionsIncompatible => (
"{loader} has no builds for {version}",
"{loader} 没有适配 {version} 的构建"
),
DownloadOptionsNeedsAtLeast => (
"{loader} needs Minecraft {min} or newer",
"{loader} 需要 Minecraft {min} 或更新"
),
DownloadCancelled => (
"Install cancelled — finished files are kept, the instance was not created",
"安装已取消 —— 已下好的文件保留,实例未登记"
),
} }
};
}
pub(crate) use download_entries;
/// **M107 版本管理页**的侧栏 / 搜索文案。
///
/// 为什么单独一个宏、并**接在装配链最后**:`catalog/golden.rs` 是「`Key` 声明顺序 × 译文」的逐字节
/// 快照,M107 的纪律是**只追加不重排**。把新 key 插在 `download_entries` 中间会让 `Key::ALL`
/// 的顺序在 `DownloadDismiss` 与 `LogsSubtitleIdle` 之间断开,金表就得整体重排(那正是要避免的
/// 风险)。追加在链尾 ⇒ 新 key 落在 `Key::ALL` 末尾 ⇒ 金表末尾追加同样几行即可。
macro_rules! version_entries {
($next:ident, $($rest:ident,)* { $($acc:tt)* }) => {
$next! { $($rest,)* {
$($acc)*
// --- version management page (M107) ---
VersionRailTitle => ("Version type", "版本类型"),
VersionMajorTitle => ("Major version", "主版本"),
VersionMajorAll => ("All versions", "全部版本"),
VersionSearchPlaceholder => ("Search version numbers", "搜版本号"),
VersionSearchClear => ("Clear search", "清空搜索"),
VersionSearchHits => ("{count} matches", "{count} 个匹配"),
VersionSearchEmptyTitle => ("No matching versions", "没有匹配的版本"),
VersionSearchEmptyBody => (
"Try a shorter piece of the number — 1.21, 24w, a1.",
"试试更短的片段 — 1.21、24w、a1。"
),
VersionSearchElsewhere => (
"{count} versions match, but they are in another type.",
"有 {count} 个版本匹配,但它们在别的类型里。"
),
VersionSearchElsewhereAction => ("Show all types", "看全部类型"),
// --- M107 r2:复数口径与「在别处」的标题(追加在域尾 ⇒ `Key::ALL` 顺序只增不动) ---
VersionSearchHitsOne => ("1 match", "1 个匹配"),
VersionSearchElsewhereTitle => ("Found in another type", "在别的类型里找到了"),
VersionSearchElsewhereOne => (
"1 version matches, but it is in another type.",
"有 1 个版本匹配,但它在别的类型里。"
),
} }
};
}
pub(crate) use version_entries;