diff --git a/Power_Pico/User/GUI/screens/ui_PPSPage.c b/Power_Pico/User/GUI/screens/ui_PPSPage.c index c692a54..fa75df4 100644 --- a/Power_Pico/User/GUI/screens/ui_PPSPage.c +++ b/Power_Pico/User/GUI/screens/ui_PPSPage.c @@ -91,7 +91,11 @@ static void _switch_pps_panel(void) current_btn_index = 8; // 设置当前对象红色边框 lv_obj_set_style_border_width(btns[current_btn_index], 3, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(ui_LabelSwitch, "press here to Fixed Set"); + lv_label_set_text(ui_LabelSwitch, _("press here to Fixed Set")); + if(ui_get_language_select() == 0) + lv_obj_set_style_text_font(ui_LabelSwitch, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT); + else + lv_obj_set_style_text_font(ui_LabelSwitch, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT); _set_label_val_cur(); } else @@ -103,7 +107,12 @@ static void _switch_pps_panel(void) current_btn_index = 0; // 设置当前对象红色边框 lv_obj_set_style_border_width(btns[current_btn_index], 3, LV_PART_MAIN | LV_STATE_DEFAULT); - lv_label_set_text(ui_LabelSwitch, "press here to Variable"); + lv_label_set_text(ui_LabelSwitch, _("press to Step Adjust")); + if(ui_get_language_select() == 0) + lv_obj_set_style_text_font(ui_LabelSwitch, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT); + else + lv_obj_set_style_text_font(ui_LabelSwitch, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT); + } } @@ -572,8 +581,11 @@ void ui_PPSPage_screen_init(void) lv_obj_set_width(ui_LabelSwitch, LV_SIZE_CONTENT); /// 1 lv_obj_set_height(ui_LabelSwitch, LV_SIZE_CONTENT); /// 1 lv_obj_set_align(ui_LabelSwitch, LV_ALIGN_CENTER); - lv_label_set_text(ui_LabelSwitch, "press here to Variable"); - lv_obj_set_style_text_font(ui_LabelSwitch, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_text(ui_LabelSwitch, _("press to Step Adjust")); + if(ui_get_language_select() == 0) + lv_obj_set_style_text_font(ui_LabelSwitch, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT); + else + lv_obj_set_style_text_font(ui_LabelSwitch, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT); ui_BtnClose = lv_button_create(ui_PPSPage); lv_obj_set_width(ui_BtnClose, 210); @@ -593,8 +605,11 @@ void ui_PPSPage_screen_init(void) lv_obj_set_width(ui_LabelClose, LV_SIZE_CONTENT); /// 1 lv_obj_set_height(ui_LabelClose, LV_SIZE_CONTENT); /// 1 lv_obj_set_align(ui_LabelClose, LV_ALIGN_CENTER); - lv_label_set_text(ui_LabelClose, "press here to close PD"); - lv_obj_set_style_text_font(ui_LabelClose, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_text(ui_LabelClose, _("press here to close PD")); + if(ui_get_language_select() == 0) + lv_obj_set_style_text_font(ui_LabelClose, &lv_font_montserrat_18, LV_PART_MAIN | LV_STATE_DEFAULT); + else + lv_obj_set_style_text_font(ui_LabelClose, &ui_font_zhongyuan20, LV_PART_MAIN | LV_STATE_DEFAULT); ui_pps_timer = lv_timer_create(_flush_timer_cb, 500, NULL); diff --git a/Power_Pico/User/GUI/screens/ui_SetPage.c b/Power_Pico/User/GUI/screens/ui_SetPage.c index 9047fcb..4fb8c00 100644 --- a/Power_Pico/User/GUI/screens/ui_SetPage.c +++ b/Power_Pico/User/GUI/screens/ui_SetPage.c @@ -311,15 +311,18 @@ void ui_SetPage_screen_init(void) lv_obj_set_align(ui_SliderBL, LV_ALIGN_BOTTOM_MID); //Compensating for LVGL9.1 draw crash with bar/slider max value when top-padding is nonzero and right-padding is 0 - if(lv_obj_get_style_pad_top(ui_SliderBL, LV_PART_MAIN) > 0) lv_obj_set_style_pad_right(ui_SliderBL, - lv_obj_get_style_pad_right(ui_SliderBL, LV_PART_MAIN) + 1, LV_PART_MAIN); + if(lv_obj_get_style_pad_top(ui_SliderBL, LV_PART_MAIN) > 0) lv_obj_set_style_pad_right(ui_SliderBL, lv_obj_get_style_pad_right(ui_SliderBL, LV_PART_MAIN) + 1, LV_PART_MAIN); ui_LabelBL = lv_label_create(ui_PanelBL); lv_obj_set_width(ui_LabelBL, LV_SIZE_CONTENT); /// 1 lv_obj_set_height(ui_LabelBL, LV_SIZE_CONTENT); /// 1 lv_obj_set_x(ui_LabelBL, 0); lv_obj_set_y(ui_LabelBL, -5); - lv_label_set_text(ui_LabelBL, "Screen Brightness :"); - lv_obj_set_style_text_font(ui_LabelBL, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_text(ui_LabelBL, _("Screen Brightness :")); + if(ui_get_language_select() == 0) + lv_obj_set_style_text_font(ui_LabelBL, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + else + lv_obj_set_style_text_font(ui_LabelBL, &ui_font_zhongyuan18, LV_PART_MAIN | LV_STATE_DEFAULT); + ui_PanelKS = lv_obj_create(ui_SetPage); lv_obj_set_width(ui_PanelKS, 234); @@ -342,8 +345,11 @@ void ui_SetPage_screen_init(void) lv_obj_set_width(ui_LabelKS, LV_SIZE_CONTENT); /// 1 lv_obj_set_height(ui_LabelKS, LV_SIZE_CONTENT); /// 1 lv_obj_set_align(ui_LabelKS, LV_ALIGN_LEFT_MID); - lv_label_set_text(ui_LabelKS, "Enable key sound"); - lv_obj_set_style_text_font(ui_LabelKS, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_text(ui_LabelKS, _("Enable key sound")); + if(ui_get_language_select() == 0) + lv_obj_set_style_text_font(ui_LabelKS, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + else + lv_obj_set_style_text_font(ui_LabelKS, &ui_font_zhongyuan18, LV_PART_MAIN | LV_STATE_DEFAULT); ui_PanelLang = lv_obj_create(ui_SetPage); lv_obj_set_width(ui_PanelLang, 234); @@ -365,8 +371,11 @@ void ui_SetPage_screen_init(void) lv_obj_set_width(ui_LabelLang, LV_SIZE_CONTENT); /// 1 lv_obj_set_height(ui_LabelLang, LV_SIZE_CONTENT); /// 1 lv_obj_set_align(ui_LabelLang, LV_ALIGN_LEFT_MID); - lv_label_set_text(ui_LabelLang, "Enable Chinese"); - lv_obj_set_style_text_font(ui_LabelLang, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_text(ui_LabelLang, _("Enable Chinese")); + if(ui_get_language_select() == 0) + lv_obj_set_style_text_font(ui_LabelLang, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + else + lv_obj_set_style_text_font(ui_LabelLang, &ui_font_zhongyuan18, LV_PART_MAIN | LV_STATE_DEFAULT); ui_PanelRotate = lv_obj_create(ui_SetPage); lv_obj_set_width(ui_PanelRotate, 234); @@ -383,8 +392,11 @@ void ui_SetPage_screen_init(void) lv_obj_set_width(ui_LabelRotation, LV_SIZE_CONTENT); /// 1 lv_obj_set_height(ui_LabelRotation, LV_SIZE_CONTENT); /// 1 lv_obj_set_align(ui_LabelRotation, LV_ALIGN_LEFT_MID); - lv_label_set_text(ui_LabelRotation, "Chose Rotation"); - lv_obj_set_style_text_font(ui_LabelRotation, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_text(ui_LabelRotation, _("Chose Rotation")); + if(ui_get_language_select() == 0) + lv_obj_set_style_text_font(ui_LabelRotation, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + else + lv_obj_set_style_text_font(ui_LabelRotation, &ui_font_zhongyuan18, LV_PART_MAIN | LV_STATE_DEFAULT); ui_LabelRotNum = lv_label_create(ui_PanelRotate); lv_obj_set_width(ui_LabelRotNum, LV_SIZE_CONTENT); /// 1 @@ -413,8 +425,11 @@ void ui_SetPage_screen_init(void) lv_obj_set_width(ui_LabelPPS, LV_SIZE_CONTENT); /// 1 lv_obj_set_height(ui_LabelPPS, LV_SIZE_CONTENT); /// 1 lv_obj_set_align(ui_LabelPPS, LV_ALIGN_LEFT_MID); - lv_label_set_text(ui_LabelPPS, "PD Setting"); - lv_obj_set_style_text_font(ui_LabelPPS, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + lv_label_set_text(ui_LabelPPS, _("PD Setting")); + if(ui_get_language_select() == 0) + lv_obj_set_style_text_font(ui_LabelPPS, &lv_font_montserrat_16, LV_PART_MAIN | LV_STATE_DEFAULT); + else + lv_obj_set_style_text_font(ui_LabelPPS, &ui_font_zhongyuan18, LV_PART_MAIN | LV_STATE_DEFAULT); ui_PanelAbout = lv_obj_create(ui_SetPage); lv_obj_set_width(ui_PanelAbout, 234); diff --git a/Power_Pico/User/GUI/ui.c b/Power_Pico/User/GUI/ui.c index 4795383..e00c281 100644 --- a/Power_Pico/User/GUI/ui.c +++ b/Power_Pico/User/GUI/ui.c @@ -90,7 +90,10 @@ void ui_init(void) // internationalization init lv_i18n_init(lv_i18n_language_pack); //lv_i18n 的语言初始化 - lv_i18n_set_locale("en"); //lv_i18n 设置当前语言 + if(ui_get_language_select() == 0) + lv_i18n_set_locale("en"); //lv_i18n 设置当前语言 + else + lv_i18n_set_locale("zh-cn"); //lv_i18n 设置当前语言 // main timer (you can add someting to do in the timer_cb if needed) lv_timer_t * ui_MainTimer = lv_timer_create(main_timer_cb, 1000, NULL);