加入语言切换

This commit is contained in:
不吃油炸鸡
2026-01-28 19:54:23 +08:00
parent 67a79e3697
commit a13e87179c

View File

@@ -132,7 +132,20 @@ void ui_set_page_key_handler(void *key_event)
// language // language
case 2: case 2:
// do nothing // key yes
if (((key_event_t*)key_event)->id == KEY_ID_Y && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
{
lv_obj_add_state(ui_SwitchLang, LV_STATE_CHECKED);
ui_set_language_select(1);
lv_i18n_set_locale("en");
}
// key neg
else if (((key_event_t*)key_event)->id == KEY_ID_N && ((key_event_t*)key_event)->type == KEY_EVT_CLICK)
{
lv_obj_clear_state(ui_SwitchLang, LV_STATE_CHECKED);
ui_set_language_select(0);
lv_i18n_set_locale("zh-cn");
}
break; break;
// chose rotation // chose rotation
@@ -201,6 +214,12 @@ static void _setting_init(void) {
else else
lv_obj_clear_state(ui_SwitchKS, LV_STATE_CHECKED); lv_obj_clear_state(ui_SwitchKS, LV_STATE_CHECKED);
// language
if(ui_get_language_select() == 1)
lv_obj_add_state(ui_SwitchLang, LV_STATE_CHECKED);
else
lv_obj_clear_state(ui_SwitchLang, LV_STATE_CHECKED);
// lcd rotation // lcd rotation
uint16_t rotation = ui_get_display_rotation(); uint16_t rotation = ui_get_display_rotation();
if (rotation == 0) { if (rotation == 0) {