Skip to content

fix: use invariant culture in numeric display formatting#158

Merged
shanselman merged 2 commits intoopenclaw:masterfrom
AlexAlves87:fix/culture-invariant-formatting
Apr 8, 2026
Merged

fix: use invariant culture in numeric display formatting#158
shanselman merged 2 commits intoopenclaw:masterfrom
AlexAlves87:fix/culture-invariant-formatting

Conversation

@AlexAlves87
Copy link
Copy Markdown
Contributor

Summary

FormatLargeNumber and CostUsd were formatting values using the current thread culture, producing 2,5M or $0,25 on non-English locales instead of the expected 2.5M / $0.25. This fixes both helpers to use CultureInfo.InvariantCulture.

What changed

  • FormatLargeNumber and CostUsd now use invariant culture for all numeric output

Testing

  • ./build.ps1
  • dotnet test ./tests/OpenClaw.Shared.Tests/OpenClaw.Shared.Tests.csproj --no-restore
  • dotnet test ./tests/OpenClaw.Tray.Tests/OpenClaw.Tray.Tests.csproj --no-restore

All passing.

AlexAlves87 and others added 2 commits April 8, 2026 16:54
FormatLargeNumber and CostUsd were using the current thread culture,
producing "2,5M" or "$0,25" on non-English locales instead of the
expected "2.5M" / "$0.25".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers non-English culture formatting so token and cost display stays
as 2.5M / .25 rather than locale-specific 2,5M / ,25.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@shanselman shanselman merged commit 6933239 into openclaw:master Apr 8, 2026
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