Skip to content

feat: add i18n system with 22 languages#10

Open
WkdXeqtr wants to merge 1 commit into
SteamClientHomebrew:mainfrom
WkdXeqtr:main
Open

feat: add i18n system with 22 languages#10
WkdXeqtr wants to merge 1 commit into
SteamClientHomebrew:mainfrom
WkdXeqtr:main

Conversation

@WkdXeqtr
Copy link
Copy Markdown

Summary

  • Adds a full localization system (Locale class) with auto-detection of system language and runtime switching
  • 22 languages matching Millennium: Brazilian Portuguese, Bulgarian, Danish, Dutch, English, French, German, Hungarian, Indonesian, Italian, Japanese, Korean, Latin American Spanish, Polish, Russian, Simplified Chinese, Spanish, Swedish, Traditional Chinese, Turkish, Ukrainian, Vietnamese
  • Translations embedded into the binary at CMake configure time — no external files needed at runtime
  • Language selector in the title bar (top-right), auto-detects system language on first launch
  • All hardcoded UI strings replaced with Locale::Get()

Font system

  • Geist — Latin, Cyrillic, Latin Extended (Polish, Turkish…)
  • CJK name subsets (~21 KB, embedded) — only the glyphs needed to render CJK language names in the dropdown
  • System CJK font — loaded as primary UI font when a CJK language is active (Windows: msyh/msjh/YuGothic/Malgun; Linux: fc-match; macOS: fc-match → PingFang/Hiragino/AppleSDGothicNeo)
  • Vietnamese — system Arial/LiberationSans/HelveticaNeue replaces Geist as the primary font entirely when Vietnamese is active (full Latin Extended Additional coverage, zero Geist mixing); the language selector dropdown keeps its Geist appearance via a separate font slot
  • VietName_Standalone (~18 KB, embedded) — Arial subset of the 9 unique codepoints in "Tiếng Việt", pushed per-item in the dropdown

cjk_names.h and viet_name.h are pre-generated static byte arrays — no tooling required at build time. To regenerate from system fonts:

pip install fonttools brotli
python tools/generate_font_headers.py

- Implement Locale class (i18n.h + locale.cc): auto-detect system
  language, runtime switching, English fallback
- Add locale JSON files for all 22 languages matching Millennium
- Embed translations into binary at CMake configure time via
  generated/locale_data.h (no runtime file I/O)
- Replace all hardcoded UI strings with Locale::Get() across all routes
- Add language selector dropdown to the title bar (top-right)
- Font atlas adapts to the active language:
  · Geist + CJK name subsets (~21 KB embedded) always merged in
  · System CJK font loaded as primary when a CJK locale is active
  · Vietnamese: system Arial/LiberationSans/HelveticaNeue replaces
    Geist as primary font entirely (no merging); dropdown keeps Geist
    appearance via a dedicated font slot (Fonts[3])
  · VietName_Standalone (~18 KB embedded) for the Vietnamese item
    in the dropdown
- Rebuild font atlas on language switch
- Platform support: Windows (WinAPI lang detect + system font paths),
  Linux (fc-match + LiberationSans fallback), macOS (fc-match +
  PingFang/Hiragino/AppleSDGothicNeo/HelveticaNeue fallbacks)
- Add tools/generate_font_headers.py to regenerate embedded subsets
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.

1 participant