Skip to content

Numbers and dates in the user's language, not the browser's - #239

Merged
Randomname653 merged 1 commit into
mainfrom
claude/number-locale
Oct 25, 2026
Merged

Randomname653 merged 1 commit into
mainfrom
claude/number-locale

Conversation

@Randomname653

Copy link
Copy Markdown
Owner

What & why

The front end formatted numbers and dates with the browser's locale. On a German browser the Wrap-Up's graveyard read "1.055GB" (meaning 1,055 GB), right next to the curator's "3,152 GB". The owner asked for both to follow the language the user speaks to Curatarr in.

  • services/user_language.py: the language the user writes to the curator in most.
    • It uses the detector the Wrap-Up writer already uses (wrapup_writer.main_language: stopwords over the last 300 messages, no model).
    • English when there are no messages. Read at most once an hour per user.
    • Mapped to an Intl locale (en-US, de-DE, fr-FR, …).
  • The login (PIN poll) and /api/auth/status carry it as locale.
  • ui.setLocale / ui.loc(): setUser sets it before anything renders. Every toLocaleString / toLocaleDateString / toLocaleTimeString call (81 in 14 files) now passes loc().
    • Before a session exists (setup, login), loc() is undefined, so the browser's own locale is used, as before.

Checks

  • python tests/run_all.py is green (252/252)
  • New tests/test_user_locale.py (8 checks):
    • English and mostly-German writers, and no messages;
    • the hourly re-read;
    • the auth payloads;
    • no toLocale* call left without loc();
    • setUser order;
    • de-DE 1.055 vs en-US 1,055.
  • test_wrapup_story_mode's node harness stubs loc.

🤖 Generated with Claude Code

The front end formatted with the browser's locale: a German browser showed
the graveyard's "1.055GB" (1,055 GB) next to the curator's "3,152 GB".
Both follow one language now, the one the user writes to the curator in
most (services/user_language over wrapup_writer.main_language: stopwords,
no model, English without messages, read once an hour per user). The login
and /api/auth/status carry it as "locale" (en-US, de-DE, ...); setUser
hands it to ui.setLocale, and every toLocaleString / toLocaleDateString /
toLocaleTimeString call (81 in 14 files) passes ui.loc().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Randomname653
Randomname653 merged commit 5e89ddd into main Oct 25, 2026
9 of 10 checks passed
@Randomname653
Randomname653 deleted the claude/number-locale branch October 25, 2026 10:24
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