Skip to content

feat: add hybrid localization system (hardcoded + external JSON)#170

Open
gridgt wants to merge 1 commit into
xland:mainfrom
gridgt:feature/external-localization
Open

feat: add hybrid localization system (hardcoded + external JSON)#170
gridgt wants to merge 1 commit into
xland:mainfrom
gridgt:feature/external-localization

Conversation

@gridgt

@gridgt gridgt commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Hybrid Localization System

Built-in dictionaries remain as the primary translations. External JSON files in the lang/ folder can:

  • Add new languages — if a language code is not found in the hardcoded list, it is automatically registered from the JSON file
  • Supplement or override existing translations — JSON keys are merged on top of the hardcoded dictionary, replacing or adding individual strings

No code changes needed to add a new language or fix a translation. Just place xx-XX.json in the lang/ folder next to the executable and restart.

de-DE.json (Deutsch) is included as an external-only test.

@gridgt gridgt force-pushed the feature/external-localization branch 2 times, most recently from 78a61ef to a7f44f8 Compare June 30, 2026 21:01
- scanLangDir() discovers lang/*.json at startup, adds new languages
- loadExternal() merges JSON translations over hardcoded dictionaries
- Encoding: UTF-16 LE with BOM via Util::readFile (same as config.json)
- de-DE.json included as external-only test language
@gridgt gridgt force-pushed the feature/external-localization branch from a7f44f8 to 0d6cc1a Compare June 30, 2026 21:03
@xland

xland commented Jul 1, 2026

Copy link
Copy Markdown
Owner

The current multilingual support module isn’t well-designed yet. I’ll take a closer look and review your PR before merging it. Thanks a lot.

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