Skip to content

feat(server): GET /auth/me/localization — tenant regional defaults for every user#2122

Merged
xuyushun441-sys merged 1 commit into
mainfrom
phase2a-expose-localization
Jun 21, 2026
Merged

feat(server): GET /auth/me/localization — tenant regional defaults for every user#2122
xuyushun441-sys merged 1 commit into
mainfrom
phase2a-expose-localization

Conversation

@xuyushun441-sys

Copy link
Copy Markdown
Contributor

Phase 2a — expose regional defaults to the client

The localization settings (currency / locale / timezone) are gated to setup.access, and the discovery endpoint is static / context-free. So a regular user's client has no way to learn the tenant's default currency or locale to format values consistently — which is why every objectui currency renderer falls back to a hardcoded $/¥/USD or a bare number (see the cross-repo currency audit).

This adds GET /api/v1/auth/me/localization{ authenticated, currency, locale, timezone } resolved off the request ExecutionContext (the values #2119 wired in), exposed to every authenticated user without the setup.access gate on the underlying settings.

Why

It's the prerequisite for Phase 2 (objectui): a LocalizationProvider fetches this once and feeds a single currency/number formatter the tenant default + locale, replacing the ~20 ad-hoc per-site currency-resolution paths (2 divergent formatCurrency, 3 Intl locales, hardcoded symbols).

Notes

🤖 Generated with Claude Code

…r every user

Phase 2a of unifying currency. The `localization` settings (currency/locale/
timezone) are gated to `setup.access`, and `discovery` is static/context-free —
so a regular user's client has no way to learn the tenant's default currency or
locale to format values consistently.

This adds `GET /api/v1/auth/me/localization`, returning the resolved
`{ currency, locale, timezone }` off the request ExecutionContext (the same
values #2119 wired in) to every AUTHENTICATED user — without the setup.access
gate on the underlying settings. A thin passthrough of `resolveCtx(c)`; the
ctx resolution itself is covered by resolve-execution-context tests.

Unblocks the objectui client (Phase 2): a LocalizationProvider can fetch this
once and feed a single currency/number formatter the tenant default + locale,
replacing ~20 ad-hoc per-site currency-resolution paths.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
spec Ready Ready Preview, Comment Jun 21, 2026 10:00am

Request Review

@github-actions github-actions Bot added documentation Improvements or additions to documentation tooling size/s labels Jun 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

📓 Docs Drift Check

This PR changes 1 package(s): @objectstack/plugin-hono-server.

5 hand-written doc(s) reference the affected code and may need an implementation-accuracy re-verification:

  • content/docs/concepts/implementation-status.mdx (via @objectstack/plugin-hono-server)
  • content/docs/concepts/packages.mdx (via @objectstack/plugin-hono-server)
  • content/docs/guides/authentication.mdx (via @objectstack/plugin-hono-server)
  • content/docs/guides/packages.mdx (via @objectstack/plugin-hono-server)
  • content/docs/guides/plugins.mdx (via @objectstack/plugin-hono-server)

Advisory only. To re-verify, run the docs-accuracy-audit workflow scoped to these files:
node scripts/docs-audit/affected-docs.mjs origin/main → pass the list as args.docs.

@xuyushun441-sys
xuyushun441-sys merged commit 00c32f2 into main Jun 21, 2026
16 checks passed
@xuyushun441-sys
xuyushun441-sys deleted the phase2a-expose-localization branch June 21, 2026 10:04
xuyushun441-sys added a commit that referenced this pull request Jun 21, 2026
…ode; showcase demo (#2123)

* docs(currency): document the field→tenant resolution chain; fix currencyMode; showcase demo

Follows the currency-resolution work (#2102/#2119/#2121/#2122). Brings the
skills + showcase in line with the now-implemented chain.

- objectstack-ui SKILL: document `DatasetMeasure.currency` (ISO 4217) and its
  resolution order (measure → field `currencyConfig` → tenant default).
- objectstack-data field-types: FIX a real doc bug — `currencyMode` was
  documented as `'multi'/'single'`, the schema is `'fixed'/'dynamic'`; add a
  "Currency resolution (ADR-0053)" note (field default → tenant default → plain
  number, never a hardcoded `$`).
- objectstack-i18n SKILL: note the workspace regional defaults (timezone /
  locale / currency) — the `localization` settings, resolved onto ExecutionContext
  and exposed at `/auth/me/localization`.
- showcase: declare a fixed `currencyConfig.defaultCurrency` on field-zoo's
  currency field (demonstrates + smoke-covers the symbol path); refresh the
  chart-gallery `budget`/`spent` comment, which claimed an unspecified-currency
  amount "must not show a $" — now it falls back to the tenant default.

Verified: app-showcase builds (field + dataset parse); check:skill-docs in sync.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* fix(showcase): currencyConfig requires precision (typecheck)

---------

Co-authored-by: Jack Zhuang <277994282+os-zhuang@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/s tooling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants