Skip to content

feat: add multi-language support (Chinese / English / Bahasa Indonesia)#158

Merged
xland merged 3 commits into
xland:mainfrom
satriaajiputra:feature/multilanguage
Jun 29, 2026
Merged

feat: add multi-language support (Chinese / English / Bahasa Indonesia)#158
xland merged 3 commits into
xland:mainfrom
satriaajiputra:feature/multilanguage

Conversation

@satriaajiputra

Copy link
Copy Markdown
Contributor

简体中文

实现 ReadMe.md 待办清单中的 多语言支持- [ ] 多语言支持- [x])。

概述

新增多语言管理模块,默认主语言仍为简体中文,新增 EnglishBahasa Indonesia。用户可在「设置 → 通用设置」中通过下拉框实时切换语言,无需重启。

实现方式

  • 新增 Lang 单例类(Lang.h / Lang.cpp),沿用项目中 Settinginit()/dispose() 模式。
  • 字典硬编码在源码中,保持项目「单文件、零外部依赖」的定位(不引入外部语言文件)。
  • Setting 新增 language 配置项,持久化到 config.json(默认值 zh)。
  • 将所有硬编码 UI 文案替换为 Lang::get(key) 查询。
  • 设置页的语言行由原占位文案「此功能尚未完成」改为可点击下拉框,支持实时切换。

支持的语言

代码 名称
zh 中文(默认主语言)
en English
id Bahasa Indonesia

如何新增语言

  1. Lang.cppsupportedLangs 追加一项:{ L"xx", L"语言名称" }
  2. Lang::load() 补全对应字典

无需改动任何 UI 代码,下拉框会自动显示新语言。

改动范围

  • 新增:Lang.hLang.cpp
  • 修改:App.cppSetting.h/.cpp、各 Tool 与 Win 下的 UI 文案、Tray.cppUtil.cppReadMe.md(翻译为英文并勾选多语言)
  • 共 21 个文件,+627 / -97 行

验证

  • Release|x64 编译通过,0 error / 0 warning
  • 产出 ScreenCapture.exe,体积无明显变化(单文件定位得以保持)

English

Implements multi-language support from the ReadMe.md todo list (- [ ] Multi-language support- [x]).

Summary

Adds a multi-language system. The default/primary language remains Simplified Chinese, with English and Bahasa Indonesia added. Users can switch language live via a dropdown in Settings → General, without restarting.

Implementation

  • New Lang singleton (Lang.h / Lang.cpp), following the existing Setting init()/dispose() pattern.
  • Dictionaries are hardcoded in source, preserving the project's "single-file, zero-dependency" philosophy (no external language files).
  • Setting gains a language field persisted to config.json (default zh).
  • All hardcoded UI strings are replaced with Lang::get(key) lookups.
  • The placeholder language row in Settings ("此功能尚未完成") is replaced by a clickable dropdown with live switching.

Supported languages

Code Name
zh 中文 (default)
en English
id Bahasa Indonesia

Adding a new language

  1. Add one entry to supportedLangs in Lang.cpp: { L"xx", L"Language Name" }
  2. Add its dictionary in Lang::load()

No UI code changes needed — the dropdown auto-populates from the list.

Files changed

  • Added: Lang.h, Lang.cpp
  • Modified: App.cpp, Setting.h/.cpp, UI strings across Tool/ and Win/, Tray.cpp, Util.cpp, ReadMe.md
  • 21 files, +627 / -97 lines

Verified

  • Builds clean on Release|x64, 0 errors / 0 warnings
  • Single-executable design preserved
image image

- Add Lang singleton class with centralized language dictionaries (hardcoded in source to preserve single-file, zero-dependency design)
- Add 'language' setting in Setting, persisted to config.json (default: 'zh')
- Replace placeholder text in Settings with a clickable language dropdown supporting live language switching
- Replace all hardcoded UI strings with Lang::get(key) lookups
- Initial languages: Simplified Chinese (default), English, Bahasa Indonesia
- Adding a new language only requires one entry in supportedLangs plus its dictionary
…done

- Translate ReadMe.md from Chinese to English (it is the English counterpart
  linked from ReadMe.zhcn.md and ReadMe.ru.md)
- Add language switcher header to match the other READMEs
- Mark 'Multi-language support' checkbox as completed ([ ] -> [x])
@xland

xland commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Thanks for your PR!
I've got some other stuff on my plate right now,
so it'll probably be a few days before I can get around to reviewing it.

@xland xland merged commit 95abd95 into xland:main Jun 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants