添加多国语言支持

This commit is contained in:
VinJay
2025-02-18 19:33:07 +08:00
parent 140aab8999
commit d5594d01a3
12 changed files with 206 additions and 27 deletions

View File

@@ -7,6 +7,7 @@
#include <vector>
#include <esp_lvgl_port.h>
#include <esp_timer.h>
#include "assets/lang_config.h"
#include "board.h"
@@ -256,13 +257,13 @@ void LcdDisplay::SetupUI() {
notification_label_ = lv_label_create(status_bar_);
lv_obj_set_flex_grow(notification_label_, 1);
lv_obj_set_style_text_align(notification_label_, LV_TEXT_ALIGN_CENTER, 0);
lv_label_set_text(notification_label_, "通知");
lv_label_set_text(notification_label_, (Lang::Strings::NOTICE).c_str());
lv_obj_add_flag(notification_label_, LV_OBJ_FLAG_HIDDEN);
status_label_ = lv_label_create(status_bar_);
lv_obj_set_flex_grow(status_label_, 1);
lv_label_set_long_mode(status_label_, LV_LABEL_LONG_SCROLL_CIRCULAR);
lv_label_set_text(status_label_, "正在初始化");
lv_label_set_text(status_label_,(Lang::Strings::INITIALIZING + "...").c_str());
lv_obj_set_style_text_align(status_label_, LV_TEXT_ALIGN_CENTER, 0);
mute_label_ = lv_label_create(status_bar_);

View File

@@ -6,6 +6,7 @@
#include <esp_lcd_panel_ops.h>
#include <esp_lcd_panel_vendor.h>
#include <esp_lvgl_port.h>
#include "assets/lang_config.h"
#define TAG "Ssd1306Display"
@@ -220,12 +221,12 @@ void Ssd1306Display::SetupUI_128x64() {
notification_label_ = lv_label_create(status_bar_);
lv_obj_set_flex_grow(notification_label_, 1);
lv_obj_set_style_text_align(notification_label_, LV_TEXT_ALIGN_CENTER, 0);
lv_label_set_text(notification_label_, "通知");
lv_label_set_text(notification_label_, (Lang::Strings::NOTICE).c_str());
lv_obj_add_flag(notification_label_, LV_OBJ_FLAG_HIDDEN);
status_label_ = lv_label_create(status_bar_);
lv_obj_set_flex_grow(status_label_, 1);
lv_label_set_text(status_label_, "正在初始化");
lv_label_set_text(status_label_,(Lang::Strings::INITIALIZING + "...").c_str());
lv_obj_set_style_text_align(status_label_, LV_TEXT_ALIGN_CENTER, 0);
mute_label_ = lv_label_create(status_bar_);
@@ -295,10 +296,10 @@ void Ssd1306Display::SetupUI_128x32() {
status_label_ = lv_label_create(status_bar_);
lv_obj_set_style_pad_left(status_label_, 2, 0);
lv_label_set_text(status_label_, "正在初始化");
lv_label_set_text(status_label_,(Lang::Strings::INITIALIZING + "...").c_str());
notification_label_ = lv_label_create(status_bar_);
lv_label_set_text(notification_label_, "通知");
lv_label_set_text(notification_label_, (Lang::Strings::NOTICE).c_str());
lv_obj_set_style_pad_left(notification_label_, 2, 0);
lv_obj_add_flag(notification_label_, LV_OBJ_FLAG_HIDDEN);