mirror of
https://github.com/LHY0125/PathEditor.git
synced 2026-06-29 18:15:55 +08:00
feat(i18n): 添加多语言支持功能
- 新增国际化系统,支持中英文切换 - 添加语言选择对话框和语言切换按钮回调 - 扩展配置系统以支持语言设置存储 - 创建语言文件目录结构和占位文件 - 更新主窗口支持UI文本动态刷新
This commit is contained in:
@@ -244,4 +244,39 @@ int lua_config_reload(void)
|
||||
int lua_config_is_loaded(void)
|
||||
{
|
||||
return G_loaded;
|
||||
}
|
||||
|
||||
int lua_config_set_string(const char *section, const char *key, const char *value)
|
||||
{
|
||||
if (section == NULL || key == NULL || value == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (G_L == NULL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
lua_getglobal(G_L, "config");
|
||||
if (!lua_istable(G_L, -1))
|
||||
{
|
||||
lua_settop(G_L, 0);
|
||||
return -1;
|
||||
}
|
||||
|
||||
lua_getfield(G_L, -1, section);
|
||||
if (!lua_istable(G_L, -1))
|
||||
{
|
||||
lua_pop(G_L, 1);
|
||||
lua_createtable(G_L, 0, 4);
|
||||
lua_setfield(G_L, -2, section);
|
||||
lua_getfield(G_L, -1, section);
|
||||
}
|
||||
|
||||
lua_pushstring(G_L, value);
|
||||
lua_setfield(G_L, -2, key);
|
||||
lua_settop(G_L, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user