Summary
The graph UI already ships complete, parallel English and Simplified-Chinese message catalogs in graph-ui/src/lib/i18n.ts (messages.en / messages.zh), and the backend already computes and exposes a lang field from GET /api/ui-config — derived from the ui-lang config key (CBM_CONFIG_UI_LANG, default auto) or the request's Accept-Language (detect_ui_lang).
However, there is currently no in-app control to choose the language. A user who wants Chinese today must either set CBM_CONFIG_UI_LANG=zh out-of-band (CLI / config store) or change their browser language. The UI itself offers no selector.
Proposal
Add a small, non-breaking language switcher to the UI header with three options:
- 中文 (zh)
- English (en)
- 跟随浏览器 (auto)
Behavior:
- The selection is persisted by a new
POST /api/ui-config endpoint that writes CBM_CONFIG_UI_LANG (en / zh / auto) via the existing cbm_config_set path already opened by handle_ui_config (src/ui/http_server.c).
GET /api/ui-config is unchanged (still returns lang + upstream_issues_url).
- The frontend
i18n.ts gains a setUiLanguage() that POSTs the choice, then updates cachedLanguage and notifies listeners so the whole UI re-renders immediately.
- Default remains
auto — no behavior change for existing users.
Scope / constraints
- Pure C for the binary change; React/TS for the frontend.
- Adds tests in
tests/test_httpd.c (POST path) and graph-ui/src/lib/i18n.test.ts.
- No new dependencies, no new network egress, no hardcoded external URLs (the issues URL stays backend-served per the existing UI security audit).
- Kept under the 500-line / single-issue guidance.
Ask
I'd like to contribute this as a PR. Posting here first per CONTRIBUTING ("open an issue first"). Happy to adjust the endpoint shape or selector placement to your preference before implementing.
Summary
The graph UI already ships complete, parallel English and Simplified-Chinese message catalogs in
graph-ui/src/lib/i18n.ts(messages.en/messages.zh), and the backend already computes and exposes alangfield fromGET /api/ui-config— derived from theui-langconfig key (CBM_CONFIG_UI_LANG, defaultauto) or the request'sAccept-Language(detect_ui_lang).However, there is currently no in-app control to choose the language. A user who wants Chinese today must either set
CBM_CONFIG_UI_LANG=zhout-of-band (CLI / config store) or change their browser language. The UI itself offers no selector.Proposal
Add a small, non-breaking language switcher to the UI header with three options:
Behavior:
POST /api/ui-configendpoint that writesCBM_CONFIG_UI_LANG(en/zh/auto) via the existingcbm_config_setpath already opened byhandle_ui_config(src/ui/http_server.c).GET /api/ui-configis unchanged (still returnslang+upstream_issues_url).i18n.tsgains asetUiLanguage()that POSTs the choice, then updatescachedLanguageand notifies listeners so the whole UI re-renders immediately.auto— no behavior change for existing users.Scope / constraints
tests/test_httpd.c(POST path) andgraph-ui/src/lib/i18n.test.ts.Ask
I'd like to contribute this as a PR. Posting here first per CONTRIBUTING ("open an issue first"). Happy to adjust the endpoint shape or selector placement to your preference before implementing.