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

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

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

ソリューションへジャンプ
4,803件の閲覧回数
alen-liao
Contributor III
0 件の賞賛
返信
1 解決策
4,705件の閲覧回数
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

元の投稿で解決策を見る

6 返答(返信)
4,783件の閲覧回数
alen-liao
Contributor III

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

0 件の賞賛
返信
4,774件の閲覧回数
YoungWind
Contributor III

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

坚持做自己喜欢的事
0 件の賞賛
返信
4,716件の閲覧回数
alen-liao
Contributor III

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

0 件の賞賛
返信
4,706件の閲覧回数
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,657件の閲覧回数
alen-liao
Contributor III
谢谢!
0 件の賞賛
返信
4,792件の閲覧回数
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

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

BR

XiangJun Rong

0 件の賞賛
返信