Skip to main content

译文引用

最近更新时间:2023-09-07

概述

通过引用译文键值Key实现译文本地化。

UI引用译文

控件启用EnableLocalText属性

Text文本格式使用符号@ + 译文键值Key:@translation_keywords_cannot_be_repeated

如下图所示:

2023-09-07_143101

脚本引用译文

-- 获取译文
function get_text(text_id)
if text_id == nil then
return text_id
else
local gui = nx_value("gui")
text_id = nx_string(text_id)
if nx_is_valid(gui) then
return nx_string(gui.TextManager:GetText(text_id))
else
return text_id
end
end
end

function main_form_open(form)
form.btn_1.Text = nx_widestr(get_text("translation_keywords_cannot_be_repeated"))
end