请问GUI-Guider上是怎样实现多国语言显示的?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

请问GUI-Guider上是怎样实现多国语言显示的?

Jump to solution
4,806 Views
alen-liao
Contributor III
 
0 Kudos
Reply
1 Solution
4,708 Views
LiubinGong
NXP Employee
NXP Employee

@alen-liao 

     目前GUI GUIIDER 的project 还不能通过IDE自动化添加多语言,需要您添加cusotm code来实现。请看我下面简单的code 示例。希望对您有帮助。

void en_cn_font_change()
{
	lv_style_value_t v = {
        .ptr = &lv_font_simsun_32
    };
	lv_obj_set_local_style_prop(guider_ui.screen_label_1, LV_STYLE_TEXT_FONT, v, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_label_set_text(guider_ui.screen_label_1, "美式咖啡");
    lv_obj_set_local_style_prop(guider_ui.screen_label_3, LV_STYLE_TEXT_FONT, v, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_label_set_text(guider_ui.screen_label_3, "拿铁");
}

void cn_en_font_change()
{
	lv_style_value_t v = {
        .ptr = &lv_font_montserratMedium_32
    };

	lv_obj_set_local_style_prop(guider_ui.screen_label_1, LV_STYLE_TEXT_FONT, v, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_label_set_text(guider_ui.screen_label_1, "Americano");
    lv_obj_set_local_style_prop(guider_ui.screen_label_3, LV_STYLE_TEXT_FONT, v, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_label_set_text(guider_ui.screen_label_3, "CafeLatte");
}

然后可以通过event 来调用这些函数。

LiubinGong_0-1701254464875.png

下面是simulator 的效果:点击button 切换语言。

 

LiubinGong_1-1701254609907.png

LiubinGong_2-1701254629600.png

Best Regards

Liubin

View solution in original post

6 Replies
4,786 Views
alen-liao
Contributor III

我是意思是怎样用GUI-Guider设计多国语言的UI界面。

0 Kudos
Reply
4,777 Views
YoungWind
Contributor III

在网上下载你需要的国家的语言字库导入即可

坚持做自己喜欢的事
0 Kudos
Reply
4,719 Views
alen-liao
Contributor III

不是很理解。我知道是要其它语言的字库,但GUI-Guider的每个控件文本显示框就只有一个啊。如果是串口屏的UI设计软件,每个控件的文本框都有多条文本输入,可以输入不同语言文字,然后通过函数切换。我就想知道在GUI-Guider上是怎样实现这个功能的?

0 Kudos
Reply
4,709 Views
LiubinGong
NXP Employee
NXP Employee

@alen-liao 

     目前GUI GUIIDER 的project 还不能通过IDE自动化添加多语言,需要您添加cusotm code来实现。请看我下面简单的code 示例。希望对您有帮助。

void en_cn_font_change()
{
	lv_style_value_t v = {
        .ptr = &lv_font_simsun_32
    };
	lv_obj_set_local_style_prop(guider_ui.screen_label_1, LV_STYLE_TEXT_FONT, v, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_label_set_text(guider_ui.screen_label_1, "美式咖啡");
    lv_obj_set_local_style_prop(guider_ui.screen_label_3, LV_STYLE_TEXT_FONT, v, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_label_set_text(guider_ui.screen_label_3, "拿铁");
}

void cn_en_font_change()
{
	lv_style_value_t v = {
        .ptr = &lv_font_montserratMedium_32
    };

	lv_obj_set_local_style_prop(guider_ui.screen_label_1, LV_STYLE_TEXT_FONT, v, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_label_set_text(guider_ui.screen_label_1, "Americano");
    lv_obj_set_local_style_prop(guider_ui.screen_label_3, LV_STYLE_TEXT_FONT, v, LV_PART_MAIN|LV_STATE_DEFAULT);
	lv_label_set_text(guider_ui.screen_label_3, "CafeLatte");
}

然后可以通过event 来调用这些函数。

LiubinGong_0-1701254464875.png

下面是simulator 的效果:点击button 切换语言。

 

LiubinGong_1-1701254609907.png

LiubinGong_2-1701254629600.png

Best Regards

Liubin

4,660 Views
alen-liao
Contributor III
谢谢!
0 Kudos
Reply
4,795 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

GUI-Guider目前只支持英文和中文,不支持其他语言

BR

XiangJun Rong

0 Kudos
Reply