diff --git a/patch_v2/meow_launcherd/lock_screen_ui.c b/patch_v2/meow_launcherd/lock_screen_ui.c index ca41631..354195c 100644 --- a/patch_v2/meow_launcherd/lock_screen_ui.c +++ b/patch_v2/meow_launcherd/lock_screen_ui.c @@ -116,8 +116,8 @@ static void lk_key_render(meow_widget *w, const meow_theme *th, void *ctx) const char *label; int size; if (key >= 0) { size = 30; label = lk_key_digit(key); } - else if (key == LK_ACT_CLR) { size = 22; label = mfont_ready ? "清空" : "C"; } - else { size = 22; label = mfont_ready ? "退格" : "DEL"; } + else if (key == LK_ACT_CLR) { size = 22; label = mfont_ready ? meow_str_zh("lock.clear", "清空") : "C"; } + else { size = 22; label = mfont_ready ? meow_str_zh("lock.backspace", "退格") : "DEL"; } int cx = x + ww / 2; int cy = y + hh / 2 - meow_ui_text_height(size) / 2; meow_ui_text_center(cx, cy, label, size, th->onSurface); @@ -252,12 +252,13 @@ static void lk_draw(int entered, const char *status, time_t locked_until) meow_ui_fill_rect(0, 0, fb_xres, fb_yres, mt->surface); /* 全屏不透明表面底 */ lk_widgets_build(); /* 懒创建 12 键 */ /* 时钟/提示(居中,SDK meow_font):锁定倒计时标题 */ - meow_ui_text_center(fb_xres / 2, 120, locked_until > 0 ? "已锁定" : "输入 PIN 解锁", + meow_ui_text_center(fb_xres / 2, 120, locked_until > 0 ? meow_str_zh("lock.locked", "已锁定") + : meow_str_zh("lock.prompt", "输入 PIN 解锁"), 24, mt->onSurface); /* PIN 输入圆点(● 遮罩) */ lk_draw_pin_dots(entered, mt); /* 状态行:错误提示(PIN 错误)着 error;倒计时/其它信息用 onSurfaceVariant */ - int is_err = status[0] && (strstr(status, "PIN 错误") != NULL || + int is_err = status[0] && (strstr(status, meow_str_zh("lock.pin_wrong", "PIN 错误")) != NULL || strstr(status, "WRONG PIN") != NULL); uint32_t status_col = status[0] ? (is_err ? mt->error : mt->onSurfaceVariant) : mt->onSurfaceVariant; @@ -303,7 +304,7 @@ int run_lock_screen(void) time_t lock_until = 0; { time_t rem = lck_lock_remaining(); - if (rem > 0) { lock_until = time(NULL) + rem; snprintf(status, sizeof status, "已锁定"); } + if (rem > 0) { lock_until = time(NULL) + rem; snprintf(status, sizeof status, "%s", meow_str_zh("lock.locked", "已锁定")); } } time_t last_countdown = 0; @@ -392,7 +393,7 @@ int run_lock_screen(void) if (lock_until > 0 && now != last_countdown) { last_countdown = now; time_t rem = lock_until - now; - if (mfont_ready) snprintf(status, sizeof status, "已锁定,请 %d:%02d 后重试", + if (mfont_ready) snprintf(status, sizeof status, meow_str_zh("lock.locked_wait", "已锁定,请 %d:%02d 后重试"), (int)(rem / 60), (int)(rem % 60)); else snprintf(status, sizeof status, "LOCKED %d:%02d", (int)(rem / 60), (int)(rem % 60)); redraw = 1; @@ -545,9 +546,9 @@ int run_lock_screen(void) if (rem > 0) { lock_until = time(NULL) + rem; last_countdown = 0; - snprintf(status, sizeof status, "已锁定"); + snprintf(status, sizeof status, "%s", meow_str_zh("lock.locked", "已锁定")); } else { - if (mfont_ready) snprintf(status, sizeof status, "PIN 错误"); + if (mfont_ready) snprintf(status, sizeof status, "%s", meow_str_zh("lock.pin_wrong", "PIN 错误")); else snprintf(status, sizeof status, "WRONG PIN"); } } @@ -671,10 +672,10 @@ int lck_input_pin_modal(const char *title, char *out, int outcap) draw_text(x + w / 2 - 7, y + LK_ROW_H / 2 - 14, d, 2, th->on_surface); } } else if (key == LK_ACT_CLR) { - const char *t2 = "C"; if (mfont_ready) t2 = "清空"; + const char *t2 = "C"; if (mfont_ready) t2 = meow_str_zh("lock.clear", "清空"); lk_text(x + w / 2, y + LK_ROW_H / 2 - 9, t2, 22, th->on_surface); } else { - const char *t2 = "DEL"; if (mfont_ready) t2 = "退格"; + const char *t2 = "DEL"; if (mfont_ready) t2 = meow_str_zh("lock.backspace", "退格"); lk_text(x + w / 2, y + LK_ROW_H / 2 - 9, t2, 22, th->on_surface); } } diff --git a/patch_v2/meow_launcherd/lock_settings.c b/patch_v2/meow_launcherd/lock_settings.c index 6b58724..234fd5e 100644 --- a/patch_v2/meow_launcherd/lock_settings.c +++ b/patch_v2/meow_launcherd/lock_settings.c @@ -20,30 +20,30 @@ static char g_ls_status[48]; /* 状态行摘要(rows 填,paint static void ls_status_text(char *buf, int len) { - if (!lck_pin_configured()) { snprintf(buf, len, "未设置"); return; } + if (!lck_pin_configured()) { snprintf(buf, len, "%s", meow_str_zh("lock.status_unset", "未设置")); return; } time_t rem = lck_lock_remaining(); - if (rem > 0) snprintf(buf, len, "锁定中(%d:%02d)", (int)(rem / 60), (int)(rem % 60)); - else snprintf(buf, len, "已设置"); + if (rem > 0) snprintf(buf, len, meow_str_zh("lock.status_locked", "锁定中(%d:%02d)"), (int)(rem / 60), (int)(rem % 60)); + else snprintf(buf, len, "%s", meow_str_zh("lock.status_set", "已设置")); } static int ls_rows(void *ctx, sub_row_t *rbuf, int max) { (void)ctx; int n = 0; - if (n < max) { rbuf[n].kind = SUB_HDR; rbuf[n].label = "锁屏 PIN"; rbuf[n].sub = NULL; rbuf[n].on = 0; rbuf[n].act = 0; n++; } + if (n < max) { rbuf[n].kind = SUB_HDR; rbuf[n].label = meow_str_zh("lock.title", "锁屏 PIN"); rbuf[n].sub = NULL; rbuf[n].on = 0; rbuf[n].act = 0; n++; } ls_status_text(g_ls_status, sizeof g_ls_status); - if (n < max) { rbuf[n].kind = SUB_ROW; rbuf[n].label = "状态"; rbuf[n].sub = g_ls_status; rbuf[n].on = 0; rbuf[n].act = LS_ACT_STATUS; n++; } + if (n < max) { rbuf[n].kind = SUB_ROW; rbuf[n].label = meow_str_zh("lock.status_row", "状态"); rbuf[n].sub = g_ls_status; rbuf[n].on = 0; rbuf[n].act = LS_ACT_STATUS; n++; } int configured = lck_pin_configured(); if (!configured) { - if (n < max) { rbuf[n].kind = SUB_ACT; rbuf[n].label = "设置 PIN"; rbuf[n].sub = NULL; rbuf[n].on = 0; rbuf[n].act = LS_ACT_SET; n++; } + if (n < max) { rbuf[n].kind = SUB_ACT; rbuf[n].label = meow_str_zh("lock.act_set", "设置 PIN"); rbuf[n].sub = NULL; rbuf[n].on = 0; rbuf[n].act = LS_ACT_SET; n++; } } else { - if (n < max) { rbuf[n].kind = SUB_ACT; rbuf[n].label = "修改 PIN"; rbuf[n].sub = NULL; rbuf[n].on = 0; rbuf[n].act = LS_ACT_MODIFY; n++; } - if (n < max) { rbuf[n].kind = SUB_ACT; rbuf[n].label = "清除 PIN"; rbuf[n].sub = NULL; rbuf[n].on = 0; rbuf[n].act = LS_ACT_CLEAR; n++; } + if (n < max) { rbuf[n].kind = SUB_ACT; rbuf[n].label = meow_str_zh("lock.act_modify", "修改 PIN"); rbuf[n].sub = NULL; rbuf[n].on = 0; rbuf[n].act = LS_ACT_MODIFY; n++; } + if (n < max) { rbuf[n].kind = SUB_ACT; rbuf[n].label = meow_str_zh("lock.act_clear", "清除 PIN"); rbuf[n].sub = NULL; rbuf[n].on = 0; rbuf[n].act = LS_ACT_CLEAR; n++; } } if (n < max) { int wake = 1; if (meow_settings_get_int("system.pin_lock_on_wake", &wake) != 0) wake = 1; - rbuf[n].kind = SUB_SW; rbuf[n].label = "唤醒后锁屏"; rbuf[n].sub = NULL; + rbuf[n].kind = SUB_SW; rbuf[n].label = meow_str_zh("lock.wake_lock", "唤醒后锁屏"); rbuf[n].sub = NULL; rbuf[n].on = wake; rbuf[n].act = LS_ACT_WAKE; n++; } return n; @@ -58,35 +58,35 @@ static void ls_modal(const char *title, const char *line) static int ls_do_modify(void) { char old[LCK_PIN_LEN + 1]; - if (!lck_input_pin_modal("输入当前 PIN", old, sizeof old)) return 0; - if (!lck_pin_check(old)) { ls_modal("修改 PIN", "当前 PIN 错误"); return 1; } + if (!lck_input_pin_modal(meow_str_zh("lock.enter_cur", "输入当前 PIN"), old, sizeof old)) return 0; + if (!lck_pin_check(old)) { ls_modal(meow_str_zh("lock.act_modify", "修改 PIN"), meow_str_zh("lock.cur_wrong", "当前 PIN 错误")); return 1; } char a[LCK_PIN_LEN + 1], b[LCK_PIN_LEN + 1]; - if (!lck_input_pin_modal("设置新 PIN", a, sizeof a)) return 0; - if (!lck_input_pin_modal("再次确认新 PIN", b, sizeof b)) return 0; - if (strcmp(a, b) != 0) { ls_modal("修改 PIN", "两次输入不一致"); return 1; } - if (lck_pin_set(a) == MEOW_OK) ls_modal("修改 PIN", "已修改"); - else ls_modal("修改 PIN", "设置失败"); + if (!lck_input_pin_modal(meow_str_zh("lock.set_new", "设置新 PIN"), a, sizeof a)) return 0; + if (!lck_input_pin_modal(meow_str_zh("lock.confirm_new", "再次确认新 PIN"), b, sizeof b)) return 0; + if (strcmp(a, b) != 0) { ls_modal(meow_str_zh("lock.act_modify", "修改 PIN"), meow_str_zh("lock.mismatch", "两次输入不一致")); return 1; } + if (lck_pin_set(a) == MEOW_OK) ls_modal(meow_str_zh("lock.act_modify", "修改 PIN"), meow_str_zh("lock.modified", "已修改")); + else ls_modal(meow_str_zh("lock.act_modify", "修改 PIN"), meow_str_zh("lock.set_failed", "设置失败")); return 1; } static int ls_do_set(void) { char a[LCK_PIN_LEN + 1], b[LCK_PIN_LEN + 1]; - if (!lck_input_pin_modal("设置 4 位 PIN", a, sizeof a)) return 0; - if (!lck_input_pin_modal("再次输入确认", b, sizeof b)) return 0; - if (strcmp(a, b) != 0) { ls_modal("设置 PIN", "两次输入不一致"); return 1; } - if (lck_pin_set(a) == MEOW_OK) ls_modal("设置 PIN", "已设置"); - else ls_modal("设置 PIN", "设置失败"); + if (!lck_input_pin_modal(meow_str_zh("lock.enter_4", "设置 4 位 PIN"), a, sizeof a)) return 0; + if (!lck_input_pin_modal(meow_str_zh("lock.confirm_input", "再次输入确认"), b, sizeof b)) return 0; + if (strcmp(a, b) != 0) { ls_modal(meow_str_zh("lock.act_set", "设置 PIN"), meow_str_zh("lock.mismatch", "两次输入不一致")); return 1; } + if (lck_pin_set(a) == MEOW_OK) ls_modal(meow_str_zh("lock.act_set", "设置 PIN"), meow_str_zh("lock.status_set", "已设置")); + else ls_modal(meow_str_zh("lock.act_set", "设置 PIN"), meow_str_zh("lock.set_failed", "设置失败")); return 1; } static int ls_do_clear(void) { - const char *items[2]; items[0] = "是"; items[1] = "否"; - int pick = s_dd_modal("确定清除锁屏 PIN?", items, 2, 1); /* 默认「否」(安全) */ + const char *items[2]; items[0] = meow_str_zh("power.confirm_yes", "是"); items[1] = meow_str_zh("power.confirm_no", "否"); + int pick = s_dd_modal(meow_str_zh("lock.clear_confirm", "确定清除锁屏 PIN?"), items, 2, 1); /* 默认「否」(安全) */ if (pick != 0) return 1; - if (lck_pin_clear() == MEOW_OK) ls_modal("清除 PIN", "已清除"); - else ls_modal("清除 PIN", "清除失败(settings 不可写)"); + if (lck_pin_clear() == MEOW_OK) ls_modal(meow_str_zh("lock.act_clear", "清除 PIN"), meow_str_zh("lock.cleared", "已清除")); + else ls_modal(meow_str_zh("lock.act_clear", "清除 PIN"), meow_str_zh("lock.clear_failed", "清除失败(settings 不可写)")); return 1; } @@ -118,10 +118,10 @@ static int ls_detail(void *ctx, int idx, int act) int rem = (int)lck_lock_remaining(); if (lck_pin_configured() && rem > 0) { char buff[96]; - snprintf(buff, sizeof buff, "连续错误已锁定,剩余 %d:%02d 后重试", rem / 60, rem % 60); - ls_modal("锁屏 PIN", buff); + snprintf(buff, sizeof buff, meow_str_zh("lock.locked_retry", "连续错误已锁定,剩余 %d:%02d 后重试"), rem / 60, rem % 60); + ls_modal(meow_str_zh("lock.title", "锁屏 PIN"), buff); } else { - ls_modal("锁屏 PIN", line); + ls_modal(meow_str_zh("lock.title", "锁屏 PIN"), line); } return 1; } @@ -133,7 +133,7 @@ int run_lock_settings_page(void) { sub_page_t p; memset(&p, 0, sizeof p); - p.title = "锁屏 PIN"; + p.title = meow_str_zh("lock.title", "锁屏 PIN"); p.top_sw = NULL; p.top_sw_set = NULL; p.rows = ls_rows; diff --git a/patch_v2/meow_launcherd/settings_page.c b/patch_v2/meow_launcherd/settings_page.c index a5647c8..e5d1fa6 100644 --- a/patch_v2/meow_launcherd/settings_page.c +++ b/patch_v2/meow_launcherd/settings_page.c @@ -23,6 +23,26 @@ static const char *const out_presets[] = { "hw:0,0" }; static const char *const out_preset_labels[] = { "CS43198 (hw:0,0)" }; +/* i18n:SC_PRESET 选项中文标签键(meow_str_zh:未知 id → 中文兜底,行为/显示不变)。 + * 字体行(font.file/font.class_*)用运行时扫描表 font_presets/font_preset_labels,无键表,原样。 */ +static const char *const bg_preset_i18n[] = { "settings.bg_black", "settings.bg_blue", "settings.bg_green" }; +static const char *const hk_preset_i18n[] = { "settings.hk_powervol_pr", "settings.hk_sequence" }; +static const char *const seq_preset_i18n[] = { "settings.seq_volup3", "settings.seq_voldown3" }; +static const char *const out_preset_i18n[] = { "settings.out_cs43198" }; + +/* SC_PRESET 行选项标签本地化:按该行 presets 表匹配对应键表(字体行用运行时动态表,无键 → 原样)。 */ +static const char *s_preset_label(const srow_t *r, int i) +{ + const char *const *keys = NULL; + if (r->presets == bg_presets) keys = bg_preset_i18n; + else if (r->presets == hk_presets) keys = hk_preset_i18n; + else if (r->presets == seq_presets) keys = seq_preset_i18n; + else if (r->presets == out_presets) keys = out_preset_i18n; + const char *lbl = (r->preset_labels && r->preset_labels[i]) ? r->preset_labels[i] : ""; + if (keys && keys[i]) return meow_str_zh(keys[i], lbl); + return lbl; +} + /* M2.37:息屏时间滑条改为「离散档位」而非线性 0~86400 秒(线性步进 1 根本调不到 30s, * 上限 24h 过于抽象)。档位 0=常亮;从 5s 起步的细粒度段可精调「30s 左右」,随后按 @@ -123,6 +143,77 @@ static const srow_t SMENU[] = { { "关于本机", NULL, SC_LIST, 0,0,0, NULL,NULL,0, NET_LIST_ABOUT }, }; +/* 设置行标题 i18n 键:与 SMENU 一一对应(含分组标题 / SC_LIST 导航行),settings.* 域。 + * 默认值取 SMENU 行 label 原中文,行为/显示不变;TF 覆盖表/后续 SDK 内嵌并入后自动换语。 */ +static const char *const s_row_i18n[SMENU_N] = { + "settings.sec_display", /* 显示 */ + "settings.brightness", /* 亮度 */ + "settings.screen_off_mode", /* 息屏模式 */ + "settings.screen_off_timeout",/* 息屏时间 */ + "settings.refresh_rate", /* 刷新率 */ + "settings.refresh_always_max",/* 最高刷新率 */ + "settings.theme_mode", /* 主题 */ + "settings.theme", /* 主题深浅 */ + "settings.theme_dark_start", /* 深色时段开始 */ + "settings.theme_dark_end", /* 深色时段结束 */ + "settings.background", /* 背景 */ + "settings.bg_overlay_alpha", /* 背景叠加强度 */ + "settings.home_layout", /* 主界面布局 */ + "settings.sec_network", /* 网络 */ + "settings.wifi", /* WiFi */ + "settings.bt", /* 蓝牙 */ + "settings.sec_power", /* 电源 */ + "settings.longpress_menu", /* 长按弹菜单 */ + "settings.forceoff", /* 长按强关 */ + "settings.defeat_hotkey", /* 退出热键 */ + "settings.sec_boot", /* 开机 */ + "settings.boot_default", /* 默认系统 */ + "settings.boot_menu", /* 显示选单 */ + "settings.boot_timeout", /* 选单超时 */ + "settings.sec_input", /* 输入 */ + "settings.hotkey_seq", /* 热键序列 */ + "settings.hotkey_window", /* 热键窗口 */ + "settings.touch_arm", /* 触摸布防 */ + "settings.swipe_invert", /* 滑动方向 */ + "settings.sec_font", /* 字体主题 */ + "settings.font_file", /* 字体文件 */ + "settings.font_load_full", /* 加载大字库 */ + "settings.multi_font", /* 多字体 */ + "settings.font_cjk", /* 中文(CJK) */ + "settings.font_cjk_sym", /* 中文标点 */ + "settings.font_num", /* 数字 */ + "settings.font_latin", /* 拉丁字母 */ + "settings.font_latin_sym", /* 半角标点 */ + "settings.font_other", /* 其他字符 */ + "settings.font_title_size", /* 标题字号 */ + "settings.font_body_size", /* 正文字号 */ + "settings.ui_style", /* UI风格 */ + "settings.sec_notify", /* 通知 */ + "settings.notify_center", /* 通知中心 */ + "settings.notify_app_quota", /* 应用配额 */ + "settings.sec_log", /* 日志 */ + "settings.log_level", /* 日志级别 */ + "settings.log_to_card", /* 写入TF卡 */ + "settings.sec_audio", /* 音频 */ + "settings.volume", /* 音量 */ + "settings.volume_max", /* 音量上限 */ + "settings.volume_step", /* 音量跳步 */ + "settings.audio_output", /* 输出设备 */ + "settings.sec_security", /* 安全 */ + "settings.pin", /* 锁屏 PIN */ + "settings.sec_about", /* 关于 */ + "settings.about", /* 关于本机 */ +}; + +/* SMENU 行标题本地化:能定位到 SMENU 行 → 按对应键取文案(默认=原中文);否则原样返回。 */ +static const char *s_row_label(const srow_t *r) +{ + for (int i = 0; i < SMENU_N; i++) { + if (&SMENU[i] == r) return meow_str_zh(s_row_i18n[i], r->label); + } + return meow_str_zh("settings.unknown", r->label); +} + /* M2.39 左缘返回手势已抽为共享函数 meow_edge_back()(meow_touch.h MEOW_EDGE_W/SWIPE 由 * 其定义),设置页运行期调用;此处不再定义独立 S_EDGE_W/S_SWIPE_THRESH。 */ @@ -252,10 +343,10 @@ static int s_row_at_content_y(int cy) /* ---- 值格式化/展示 ---- */ static void s_fmt_time(int sec, char *buf, int len) { - if (sec <= 0) { snprintf(buf, len, "常亮"); return; } - if (sec < 60) { snprintf(buf, len, "%d 秒", sec); return; } - if (sec < 3600) { snprintf(buf, len, "%d 分", sec / 60); return; } - snprintf(buf, len, "%d 时", sec / 3600); + if (sec <= 0) { snprintf(buf, len, "%s", meow_str_zh("settings.always_on", "常亮")); return; } + if (sec < 60) { snprintf(buf, len, meow_str_zh("settings.time_sec", "%d 秒"), sec); return; } + if (sec < 3600) { snprintf(buf, len, meow_str_zh("settings.time_min", "%d 分"), sec / 60); return; } + snprintf(buf, len, meow_str_zh("settings.time_hr", "%d 时"), sec / 3600); } /* B2b 主题时段:分钟(0-1439) → "HH:MM"(如 1140→"19:00")。注意与 s_fmt_time 的秒语义区分。 */ @@ -298,14 +389,14 @@ static void s_fmt_value(const srow_t *r, char *buf, int len) int s2 = 0, e2 = 0; meow_settings_get_int("display.theme_dark_start", &s2); meow_settings_get_int("display.theme_dark_end", &e2); - if (s2 == e2) { snprintf(buf, len, "未设置"); return; } + if (s2 == e2) { snprintf(buf, len, "%s", meow_str_zh("settings.unset", "未设置")); return; } s_fmt_minutes(v, buf, len); return; } /* 长按弹菜单/强关:毫秒换算成秒(0.5 步进,如 "2.5 秒") */ if (!strcmp(r->key, "power.longpress_menu_ms") || !strcmp(r->key, "power.forceoff_ms")) { - if (v % 1000 == 0) snprintf(buf, len, "%d 秒", v / 1000); - else snprintf(buf, len, "%.1f 秒", v / 1000.0); + if (v % 1000 == 0) snprintf(buf, len, meow_str_zh("settings.sec_val", "%d 秒"), v / 1000); + else snprintf(buf, len, meow_str_zh("settings.sec_val_f", "%.1f 秒"), v / 1000.0); return; } snprintf(buf, len, "%d", v); @@ -324,14 +415,14 @@ static void s_display_value(const srow_t *r, char *buf, int len) if (meow_settings_get_str(r->key, cur, sizeof cur) != 0) { snprintf(buf, len, "-"); return; } /* M2.5x 多字体:class 行空值 = 跟随全局 font.file */ if (r->key && !strncmp(r->key, "font.class_", 11) && !cur[0]) { - snprintf(buf, len, "跟随全局"); + snprintf(buf, len, "%s", meow_str_zh("settings.follow_global", "跟随全局")); return; } int pn = 0; const char *const *pps = s_row_presets(r, &pn); for (int i = 0; i < pn; i++) { if (!strcmp(pps[i], cur)) { - snprintf(buf, len, "%s", (r->preset_labels && r->preset_labels[i][0]) ? r->preset_labels[i] : cur); + snprintf(buf, len, "%s", (r->preset_labels && r->preset_labels[i][0]) ? s_preset_label(r, i) : cur); return; } } @@ -655,14 +746,14 @@ static int s_dropdown(const srow_t *r) n = base + cnt; if (is_cls) { names[0] = ""; - snprintf(labels[0], sizeof labels[0], "跟随全局字体"); + snprintf(labels[0], sizeof labels[0], "%s", meow_str_zh("settings.follow_global_font", "跟随全局字体")); item[0] = labels[0]; if (!cstr[0]) cur = 0; } for (int i = 0; i < cnt; i++) { names[base + i] = pps[i]; snprintf(labels[base + i], sizeof labels[base + i], "%s", - (r->preset_labels && r->preset_labels[i][0]) ? r->preset_labels[i] : pps[i]); + (r->preset_labels && r->preset_labels[i][0]) ? s_preset_label(r, i) : pps[i]); item[base + i] = labels[base + i]; if (!strcmp(pps[i], cstr)) cur = base + i; } @@ -671,7 +762,7 @@ static int s_dropdown(const srow_t *r) if (cur < 0 || cur >= n) cur = 0; /* M7.2:枚举/预设选择器迁 SDK meow_select_show(BottomSheet+单选列表,批次2 新控件), * 替换自绘 s_dd_modal(后者仍供 about/网络列表/字体两级子菜单用,勿删)。 */ - return meow_select_show(r->label, item, n, cur); + return meow_select_show(s_row_label(r), item, n, cur); } @@ -906,8 +997,9 @@ static int s_font_dropdown(const srow_t *r, char *out_val, int vlen) char fam_slug[S_NET_MAX][64], fam_disp[S_NET_MAX][64]; int famn = 0; if (is_cls) { - if (famn < S_NET_MAX) { snprintf(fam_slug[famn], sizeof fam_slug[0], ""); - snprintf(fam_disp[famn], sizeof fam_disp[0], "跟随全局字体"); famn++; } + if (famn < S_NET_MAX) { snprintf(fam_slug[famn], sizeof fam_slug[0], "%s", ""); + snprintf(fam_disp[famn], sizeof fam_disp[0], "%s", + meow_str_zh("settings.follow_global_font", "跟随全局字体")); famn++; } } for (int i = 0; i < font_presets_n && famn < S_NET_MAX; i++) { const char *f = font_preset_fams[i] ? font_preset_fams[i] : ""; @@ -926,9 +1018,9 @@ static int s_font_dropdown(const srow_t *r, char *out_val, int vlen) int cur_fam = is_cls ? 0 : -1; for (int i = is_cls ? 1 : 0; i < famn; i++) if (curfam[0] && !strcmp(fam_slug[i], curfam)) cur_fam = i; - int pick = s_dd_modal(r->label, fitem, famn, cur_fam); + int pick = s_dd_modal(s_row_label(r), fitem, famn, cur_fam); if (pick < 0) return 0; - if (is_cls && pick == 0) { snprintf(out_val, vlen, ""); return 1; } /* 跟随全局 */ + if (is_cls && pick == 0) { snprintf(out_val, vlen, "%s", ""); return 1; } /* 跟随全局 */ const char *fam = fam_slug[pick]; /* ---- 二级:该 family 的字重列表(去重:同 (family,weight) 只显一行)---- @@ -972,7 +1064,7 @@ static int s_font_dropdown(const srow_t *r, char *out_val, int vlen) for (int i = 0; i < wn; i++) if (cwt2[0] && !strcmp(wt_pick[i], cwt2)) { cur_wt = i; break; } } - int wp = s_dd_modal(r->label, witem, wn, cur_wt); + int wp = s_dd_modal(s_row_label(r), witem, wn, cur_wt); if (wp < 0) return 0; snprintf(out_val, vlen, "%s", wt_val[wp]); return 1; @@ -1029,7 +1121,7 @@ static void set_lv_bind(int idx, meow_lv_item *out, void *ctx) out->enabled = 1; if (idx < 0 || idx >= s_vis_count()) { out->title = ""; return; } const srow_t *r = &SMENU[s_vis_at(idx)]; - out->title = r->label ? r->label : ""; + out->title = r->label ? s_row_label(r) : ""; out->section = (r->ctrl == SC_HEADER) ? 1 : 0; if (r->ctrl == SC_SWITCH) { int on = 0; meow_settings_get_switch(r->key, &on); @@ -1066,7 +1158,7 @@ static void set_lv_draw(int idx, int x, int y, int w, int h, int state, void *ct if (r->ctrl == SC_HEADER) { meow_ui_fill_rect(x, y, w, SET_ITEM_H, mt->surfaceContainerHigh); int ty = y + (SET_ITEM_H - thh) / 2; - if (ty >= 0) meow_ui_text(x + 16, ty, r->label, mt->font_body, mt->primary); + if (ty >= 0) meow_ui_text(x + 16, ty, s_row_label(r), mt->font_body, mt->primary); meow_ui_fill_rect(x, y + SET_ITEM_H - 1, w, 1, mt->outlineVariant); return; } @@ -1076,7 +1168,7 @@ static void set_lv_draw(int idx, int x, int y, int w, int h, int state, void *ct int ly = y + (SET_ITEM_H - thh) / 2; /* label 单行垂直居中 */ switch (r->ctrl) { case SC_SWITCH: { - meow_ui_text(x + 16, ly, r->label, mt->font_body, textcol); + meow_ui_text(x + 16, ly, s_row_label(r), mt->font_body, textcol); meow_widget *sw = set_sw_take(); if (sw) { int on = 0; meow_settings_get_switch(r->key, &on); @@ -1088,7 +1180,7 @@ static void set_lv_draw(int idx, int x, int y, int w, int h, int state, void *ct } case SC_SLIDER: { /* label 上移一行,track 放行下方(中心=SET_SLIDER_YOFF+3=48),与拖动命中带对齐 */ - meow_ui_text(x + 16, y + SET_SLIDER_LY, r->label, mt->font_body, textcol); + meow_ui_text(x + 16, y + SET_SLIDER_LY, s_row_label(r), mt->font_body, textcol); char vb[32]; s_fmt_value(r, vb, sizeof vb); meow_ui_text(x + w - 16 - meow_ui_text_width(vb, mt->font_body), y + SET_SLIDER_LY, vb, mt->font_body, subcol); int v = 0; meow_settings_get_int(r->key, &v); @@ -1099,13 +1191,13 @@ static void set_lv_draw(int idx, int x, int y, int w, int h, int state, void *ct break; } case SC_INFO: { - meow_ui_text(x + 16, ly, r->label, mt->font_body, textcol); + meow_ui_text(x + 16, ly, s_row_label(r), mt->font_body, textcol); char vb[48]; s_net_get(r, vb, sizeof vb); meow_ui_text(x + w - 16 - meow_ui_text_width(vb, mt->font_body), ly, vb, mt->font_body, subcol); break; } case SC_LIST: { - meow_ui_text(x + 16, ly, r->label, mt->font_body, textcol); + meow_ui_text(x + 16, ly, s_row_label(r), mt->font_body, textcol); char vb[48]; s_net_get(r, vb, sizeof vb); int vx = x + w - 16 - 12 - meow_ui_text_width(vb, mt->font_body); meow_ui_text(vx, ly, vb, mt->font_body, subcol); @@ -1113,7 +1205,7 @@ static void set_lv_draw(int idx, int x, int y, int w, int h, int state, void *ct break; } default: { /* SC_ENUM / SC_PRESET */ - meow_ui_text(x + 16, ly, r->label, mt->font_body, textcol); + meow_ui_text(x + 16, ly, s_row_label(r), mt->font_body, textcol); char vb[40]; s_display_value(r, vb, sizeof vb); int vx = x + w - 16 - meow_ui_text_width(vb, mt->font_body); meow_ui_text(vx, ly, vb, mt->font_body, subcol); @@ -1179,7 +1271,7 @@ static void set_paint_page(int sel) int W = fb_xres, H = fb_yres; fill_rect(0, 0, W, H, th->surface); draw_statusbar(); - if (mfont_ready) ui_draw(24, 50, "系统设置", th->on_surface, 28); + if (mfont_ready) ui_draw(24, 50, meow_str_zh("menu.settings", "系统设置"), th->on_surface, 28); else draw_text(24, 30, "SETTINGS", 3, th->on_surface); fill_rect(0, 50 + (mfont_ready ? meow_font_line_height(28) : 24) + 2, W, 2, th->outline); fill_rect(0, SET_CARD_Y, W, H - SET_CARD_Y, th->surface_variant); @@ -1193,7 +1285,7 @@ static void set_paint_page(int sel) snprintf(ver, sizeof ver, "MeowOS v%s dev", g_meowos_version); int foot_y = fb_yres - meow_font_line_height(20) - 8; s_draw_chevron_left(SET_CARD_X + 12, foot_y + meow_font_line_height(20) / 2, th->on_surface_variant); - ui_draw(SET_CARD_X + 24, foot_y, "返回", th->on_surface_variant, 20); + ui_draw(SET_CARD_X + 24, foot_y, meow_str_zh("settings.back", "返回"), th->on_surface_variant, 20); ui_draw(fb_xres - 8 - ui_width(ver, 20), foot_y, ver, th->outline, 20); }