Summary
With the app language set to English ("locale": "en" in settings.json), token counts render using Chinese myriad units. The context-window chip shows the Grok 4.6 window as 50万 instead of 500K, while every surrounding string ("Context window", "Provided by Grok CLI") is correctly in English.
Environment
- Grok App v0.2.18, Windows x64 portable build
- Windows 11
settings.json → "locale": "en"
- Grok Build CLI 1.0.3
Root cause
formatTokenCount() in src/lib/contextUsage.ts:726 has no English branch. The locale argument is only used to choose between Simplified and Traditional Chinese:
export function formatTokenCount(n: number, locale: string = "zh"): string {
const isTw = locale === "zh-TW" || /* ...zh-hant... */;
const wan = isTw ? "萬" : "万";
const yi = isTw ? "億" : "亿";
if (whole >= 100_000_000) return `...${yi}`;
if (whole >= 10_000) return `...${wan}`;
if (whole >= 1_000) return `...千`; // not locale-gated
if (whole >= 100) return `...百`; // not locale-gated
return String(whole);
}
For locale === "en", isTw is false, so wan resolves to "万". The 千 and 百 branches are unconditional and apply to every locale.
The surrounding plumbing is correct — AppWorkbench.tsx:20615 does pass locale={locale}, and that value resolves to "en". The formatter itself is the only gap.
formatContextChipLabel() (src/lib/contextUsage.ts:750) carries the same locale: string = "zh" default and inherits the behavior.
Expected vs actual (locale en)
| tokens |
current |
expected |
| 500,000 |
50万 |
500K |
| 12,400 |
1.2万 |
12.4K |
| 1,000,000 |
100万 |
1M |
| 5,000 |
5千 |
5K |
| 300 |
3百 |
300 |
Suggested fix
Add an English K/M/B path ahead of the CJK bands, gated on the locale not starting with zh.
Existing tests in src/lib/contextUsage.test.ts:43-64 cover only Chinese (handles edge and Chinese scale bands (百/千/万/亿) and uses 萬/億 for zh-TW), so an en case would lock this in.
Happy to send a PR if that would help.
Summary
With the app language set to English (
"locale": "en"insettings.json), token counts render using Chinese myriad units. The context-window chip shows the Grok 4.6 window as50万instead of500K, while every surrounding string ("Context window", "Provided by Grok CLI") is correctly in English.Environment
settings.json→"locale": "en"Root cause
formatTokenCount()insrc/lib/contextUsage.ts:726has no English branch. Thelocaleargument is only used to choose between Simplified and Traditional Chinese:For
locale === "en",isTwisfalse, sowanresolves to"万". The 千 and 百 branches are unconditional and apply to every locale.The surrounding plumbing is correct —
AppWorkbench.tsx:20615does passlocale={locale}, and that value resolves to"en". The formatter itself is the only gap.formatContextChipLabel()(src/lib/contextUsage.ts:750) carries the samelocale: string = "zh"default and inherits the behavior.Expected vs actual (locale
en)50万500K1.2万12.4K100万1M5千5K3百300Suggested fix
Add an English K/M/B path ahead of the CJK bands, gated on the locale not starting with
zh.Existing tests in
src/lib/contextUsage.test.ts:43-64cover only Chinese (handles edge and Chinese scale bands (百/千/万/亿)anduses 萬/億 for zh-TW), so anencase would lock this in.Happy to send a PR if that would help.