Feature: add a language reset button and fit toolbar labels
The entry dialog showed the external language-pack folder with no way to disable it. Reset now clears the LangDir configuration value and restores a built-in language; it does not read, move or delete any file on disk. The current language is kept when already built-in (zh_CN/zh_TW/en_US); an external pack falls back to en_US. Startup treats a missing LangDir as ./lang and an explicitly empty one as built-ins only; scanner, loader, encoding check and the zh_CN patch skip disk access when the directory is empty. The button is created at runtime, sized from the localized label (German "Zuruecksetzen" fits) and matching OK/Cancel height; the folder field shrinks. Reset and the result message are translated in en_US, zh_TW and de_DE. Toolbar buttons share one width taken from the longest label. At the 1400-px startup window en_US used 76px per button and zh_TW 85px, clipping the last icons; zh_CN was 72px and de_DE 64px. Shortening the longest en_US/zh_TW labels brings both to 64px, so all 19 icons fit. Verified with a Debug x64 build: resetting a German pack leaves de_DE.ini on disk while settings become LangDir= and Language=en_US; a built-in zh_TW UI stays zh_TW; after restart with LangDir empty, only 3 built-ins are listed. English and zh_TW screenshots show all 19 toolbar buttons at startup. Co-Authored-By: deepseek-flash
This commit is contained in:
1 parent
1d03cbeb3f
commit
3d2dd08be5
6 files changed
+226
-102
No files matched your search
@@ -641,8 +641,10 @@ BOOL CMy2015RemoteApp::InitInstance()
|
||||
// 内嵌资源支持 en_US 和 zh_TW,无需外部文件
|
||||
auto lang = THIS_CFG.GetStr("settings", "Language", "en_US");
|
||||
auto langDir = THIS_CFG.GetStr("settings", "LangDir", "./lang");
|
||||
langDir = langDir.empty() ? "./lang" : langDir;
|
||||
// 缺省(未配置)时用 ./lang;显式清空(LangDir=)表示不启用外部语言包目录。
|
||||
g_Lang.Init(langDir.c_str()); // 初始化目录(用于磁盘补丁文件)
|
||||
if (langDir.empty())
|
||||
g_Lang.ClearLangDir();
|
||||
g_Lang.Load(lang.c_str()); // 加载语言(优先内嵌资源,再覆盖磁盘文件)
|
||||
Mprintf("语言: %s, 目录: %s\n", lang.c_str(), langDir.c_str());
|
||||
|
||||
|
||||
Reference in new issue
Block a user