refactor(i18n): settings/lock 剩余中文补抽为 meow_str_zh 键(内联键,默认=原中文显示不变) — settings_page([59]设置行/值格式/标题)+lock_settings(行/模态/动作)+lock_screen_ui(清空/退格/PIN锁定提示);顺带修2条既有-Wformat-zero-length;宿主settings/lock全过,0warning

This commit is contained in:
AskaEth committed 2026-09-04 02:21:45 +08:00
1 parent 211c5a556a
commit c69fb92284
3 files changed
+158 -65

No files matched your search

+11 -10
View File
@@ -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);
}
}