feat(m179): 外观分组接真语言并拆成五段文件(只接管子,不补文案)
M172 审计:`pages/appearance/**` 中文界面下真正本地化 0/27,两个根因各断一刀。
① 拆文件(纯搬移):`section.rs` 395 行 → `section/` 五个文件,行数守卫只剩 5 行余量,
不拆就加不了任何东西。
- `section/mod.rs`(壳:section() + card() + 五个行控件 + 取词口 t)
- `section/window.rs`(① 整窗 α + ② 圆角,含 notice/说明段)
- `section/panel.rs`(③ 面板 α)、`section/bg_image.rs`(④⑤⑥⑦⑧)、
`section/colour_source.rs`(⑨)
取证:每段与原文件做「去空白/去尾逗号」diff,4/4 相同;只有五处机械改写
(`rows = rows.push(…)`→`rows.push(…)`、`t(Key::X)`→`t(Key::X, lang)`、
`super::notice`→`super::super::notice`、一处 `.into()`、rustfmt 换行)。
② 语言接到渲染层:`settings::Body` 从 `fn(&Ui, States)` 变成 `fn(&Ui, States, Lang)`,
`form` 传 `language.effective`,`settings/appearance.rs` 收 `lang` 转给
`pages::appearance::section(ui, state, lang)`,`section::t(key, lang)` 取词。
选「接进唯一那个槽位」而不是再给 `form` 加一条按下标分发的 `else if`:`settings/mod.rs`
贴着 400 行硬顶(M195 还要在此落地),这条路净增 0 行且不可能与分发表漂开。
验收点:`pages/appearance/**` 里已经搜不到 `Lang::En`。
③ 能变红的守卫:`the_appearance_group_speaks_chinese_when_the_interface_does`
—— 走 `settings::view` 真分发渲染一帧,断言取词记录里含汉字、英文那帧不含汉字且同一 key
中英译文不同。取证口是 `appearance::probe`(`#[cfg(test)]` thread_local):iced 0.14
没有可遍历控件树的公开接口(`Widget::children()` 返回状态 Tree;`operate` 要 Renderer),
所以取证点退到「字进树之前」的唯一取词口。变异证明:把 `t()` 改回 `Lang::En.catalog()`
⇒ 该用例红(失败信息逐条列出四条英文);还原 ⇒ 绿。
只接语言管子,不补文案:本组其余英文仍是字面量(行号见 M179 报告)。真实窗口截图、
macOS/Linux 字体差异未验。
This commit is contained in:
1 parent
e386cfbeee
commit
b457f0acc8
14 files changed
+745
-422
No files matched your search
@@ -0,0 +1,41 @@
|
||||
//! 外观分组第 ⑨ 段:**配色来源**(背景图 / 壁纸 / 色卡三档;它选的正是 D38 三级优先序的起点)。
|
||||
|
||||
use iced::Element;
|
||||
|
||||
use unlucky_presenter::prefs::PaletteSource;
|
||||
|
||||
use crate::pages::Message;
|
||||
use crate::theme::Ui;
|
||||
|
||||
use super::super::state::State;
|
||||
use super::super::Change;
|
||||
use super::{choice, choice_row};
|
||||
|
||||
/// 把 ⑨ 配色来源推进行 `rows`。
|
||||
pub(super) fn push<'a>(ui: &'a Ui, state: &'a State, rows: &mut Vec<Element<'a, Message>>) {
|
||||
// ⑨ 配色来源
|
||||
rows.push(choice_row(
|
||||
ui,
|
||||
"Colour source",
|
||||
vec![
|
||||
choice(
|
||||
ui,
|
||||
"Background",
|
||||
state.palette_source == PaletteSource::BackgroundImage,
|
||||
Change::PaletteSource(PaletteSource::BackgroundImage),
|
||||
),
|
||||
choice(
|
||||
ui,
|
||||
"Wallpaper",
|
||||
state.palette_source == PaletteSource::Wallpaper,
|
||||
Change::PaletteSource(PaletteSource::Wallpaper),
|
||||
),
|
||||
choice(
|
||||
ui,
|
||||
"Preset",
|
||||
state.palette_source == PaletteSource::Preset,
|
||||
Change::PaletteSource(PaletteSource::Preset),
|
||||
),
|
||||
],
|
||||
));
|
||||
}
|
||||
Reference in new issue
Block a user