feat(i18n): 添加多语言支持功能

- 新增国际化系统,支持中英文切换
- 添加语言选择对话框和语言切换按钮回调
- 扩展配置系统以支持语言设置存储
- 创建语言文件目录结构和占位文件
- 更新主窗口支持UI文本动态刷新
This commit is contained in:
2026-03-26 20:44:22 +08:00
parent 9a78b88c4a
commit 4fe7dc47e4
2343 changed files with 127697 additions and 9 deletions
+1
View File
@@ -16,6 +16,7 @@ int btn_export_cb(Ihandle *self);
int btn_ok_cb(Ihandle *self);
int btn_cancel_cb(Ihandle *self);
int btn_help_cb(Ihandle *self);
int btn_lang_cb(Ihandle *self);
// 搜索回调
int txt_search_cb(Ihandle *self);
+7
View File
@@ -31,4 +31,11 @@ int lua_config_reload(void);
// 返回值: 1 已加载, 0 未加载
int lua_config_is_loaded(void);
// 设置字符串配置值
// section: 配置章节名
// key: 配置键名
// value: 配置值
// 返回值: 0 成功, -1 失败
int lua_config_set_string(const char *section, const char *key, const char *value);
#endif // LUA_CONFIG_H
+4
View File
@@ -5,4 +5,8 @@
// 返回值:0-取消,1-确认
int custom_input_dialog(const char *title, const char *label_text, char *buffer, int buffer_size);
// 语言选择对话框
// 返回值:0-取消,1-确认
int language_select_dialog(void);
#endif // DIALOGS_H
+3
View File
@@ -6,4 +6,7 @@
// 创建主窗口
Ihandle* create_main_window(void);
// 刷新 UI 文本(语言切换时调用)
void refresh_main_window_ui(Ihandle *main_dlg);
#endif // MAIN_WINDOW_H
+23
View File
@@ -0,0 +1,23 @@
#ifndef I18N_H
#define I18N_H
#include <libintl.h>
#include <locale.h>
#ifndef _
#define _(s) gettext(s)
#endif
// 初始化国际化系统
void i18n_init(const char* default_lang);
// 检测系统语言并返回语言代码
const char* i18n_detect_system_language(void);
// 切换语言
void i18n_change_language(const char* lang);
// 获取当前语言
const char* i18n_get_current_language(void);
#endif // I18N_H