i18n Phase 2 — DB locale column + /api/me/locale preference

Seen in 1 project by 1 person

About

Split from the master i18n plan (task i18n-en, Plane YOPSYS-62) for independent overnight dispatch.

BLOCKED ON: i18n foundation (Phase 1, task i18n-en) — imports SUPPORTED_LOCALES/Locale from @pickism/shared. This task is backlog so the dispatcher skips it; promote backlog → todo once the foundation has merged.

Scope (self-contained once unblocked, ~1–1.5h):

  • Migration: ALTER TABLE profiles ADD COLUMN locale text NOT NULL DEFAULT 'en' CHECK (locale IN ('en','fr')). Generate the CHECK list from SUPPORTED_LOCALES. Backfill covered by DEFAULT. Heed the shared-dev-DB migration-timestamp-collision rule: pick a unique HHMMSS and check existing history first.
  • RLS unchanged — existing profiles policies already restrict updates to auth.uid() = id; add a test asserting it.
  • PATCH /api/me/locale — validates locale ∈ SUPPORTED_LOCALES, updates the row, sets the NEXT_LOCALE cookie in the response.
  • Tests: /api/me/locale round-trip, RLS (user can only update own locale), CHECK rejects unknown codes.

Prod note: adds a column → migrations-first on prod before code that reads it ships (see prod-deploy procedure). Overnight worker targets local/staging; flag prod promotion as a follow-up.

Independent of Phases 3/4/5 — fully parallel with the app phases once the foundation lands.

Links

No links shared yet.

Listed in

Bookmarked in

Not in any public bookmark categories yet.