fix: language toggle doesn't update dynamically rendered components#6
Merged
zihenghe04 merged 5 commits intoApr 7, 2026
Merged
Conversation
On Windows, Python defaults to the system encoding (cp1252) when opening files without an explicit encoding parameter. Since Claude Code writes history.jsonl as UTF-8, this causes a UnicodeDecodeError on startup: UnicodeEncodeError: 'charmap' codec can't encode characters This matches the encoding pattern already used throughout the rest of server.py for JSONL file reads.
- Default language now detects browser locale instead of hardcoding 'zh', so non-Chinese users see English on first visit - Language toggle now re-renders all dynamically built components (rhythm bars, work mode, model DNA, efficiency, insights, overview) that were previously stuck in the initial language - lastUp timestamp updates on toggle with null-safe getElementById
…n re-renders - Force UTF-8 stdout/stderr at startup for Windows compatibility - Include open(HISTORY_FILE) encoding fix from PR zihenghe04#5 - Add tooltip theme to all ApexCharts instances (fixes white-on-white in dark mode) - Re-render report, git stats, MCP stats, tools on language toggle - Translate hardcoded 'msgs' and '/day' strings
toggleTheme() only called renderCharts(), leaving all other ApexCharts instances (tools, MCP, efficiency, overview donuts) stuck with the previous theme's colors. Added re-renders for all dynamic components.
Owner
|
Thanks for your contribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes several i18n and theme issues where dynamically rendered components don't update on language or theme toggle.
Language toggle fixes
navigator.languageinstead of hardcoded'zh', so non-Chinese users see English on first visittoggleLang()now re-renders all dynamic components: rhythm bars, work mode, model DNA, efficiency trend, insights, overview, report, git stats, MCP stats, toolslastUptimestamp switches between "Updated" / "更新于" on toggle (with null-safe getElementById)'msgs'and'/day'stringsTheme toggle fixes
toggleTheme()now re-renders all dynamic components so chart colors, text, and tooltips update on dark/light switchtheme:dk?'dark':'light'to 5 ApexCharts tooltip configs that were missing it (fixes white-on-white tooltips in dark mode)Windows compatibility
open(HISTORY_FILE, encoding='utf-8', errors='replace')(fixes startup crash on Windows)Test plan