Skip to content

feat(i18n): traducir los códigos de error del backend en el cliente - #11

Merged
bpstack merged 18 commits into
claude/compassionate-planck-gh6aoffrom
opencode/error-codes
Oct 12, 2026
Merged

bpstack merged 18 commits into
claude/compassionate-planck-gh6aoffrom
opencode/error-codes

Conversation

@bpstack

@bpstack bpstack commented Oct 12, 2026

Copy link
Copy Markdown
Owner

Cambios

  • errorCodeMessage.ts traduce en es y en los códigos de error de todos los módulos que ya los envían (backoffice, cashier, groups, messages, parking, conciliation, logbook, blacklist, notifications, departments, activity, auth).
  • Login, PDF de facturas y SupplierInvoicesModal pasan por la traducción; respuestas que no traían code ahora lo traen.
  • Parking: PARKING_CHECKIN_INVALID_STATUS y PARKING_SPOT_OCCUPIED pasan a ERROR_CODES con su texto.
  • Test-guarda: todo ERROR_CODES.X y todo code: 'X' del backend tiene texto en es y en.
  • docs/TODO.md: el punto de errores sin traducir se reescribe con lo que queda, medido por módulo.

Por qué

La interfaz mostraba el texto del backend, siempre en español, o el código en crudo; con la página en inglés los errores salían en español.

bpstack added 18 commits October 9, 2026 15:55
- Add 57 BACKOFFICE codes to TRANSLATED set in errorCodeMessage.ts (alphabetical order)
- All codes have matching text in es/en errors.json and are sent with fixed text from backend
- Exclude 5 BACKOFFICE codes without translation: SUPPLIER_INACTIVE_EXISTS, SUPPLIER_HAS_INVOICES, INACTIVATE_SUPPLIER_ERROR, ACTIVATE_SUPPLIER_ERROR, DELETE_SUPPLIER_ERROR
- Add it.each test for all 57 codes (non-empty text in es and en)
- Add test for 5 excluded codes (return undefined)
- blacklist-controller.ts: getImage 404s carry code NOT_FOUND.
- demo-reset-controller.ts: failed reset and status 500s carry code
  INTERNAL_ERROR.

Why: the frontend translates errors by `code`; without it the user saw the
raw value of `error`, which is the code itself.
- errorCodeMessage.ts: add the 24 codes the backend sends that were still
  untranslated (AUTH, generic ones such as FORBIDDEN or INVALID_ID, and
  five supplier codes); keep the set in alphabetical order.
- errors.json (es, en): add texts for AUTH_DEMO_UNAVAILABLE and the five
  supplier codes that had none.
- errorBodyMessage: shared helper for errors read with a plain fetch.
  Used by the login, the invoice PDF download and SupplierInvoicesModal,
  which showed `error` as is.
- error-code-message.test.ts: new guard that every ERROR_CODES.X in the
  backend has a text in es and en; drop the assertions that required
  those codes to stay untranslated; cover errorBodyMessage.

Why: a failed login showed AUTH_INVALID_CREDENTIALS on screen. Checked in
the browser in es and en: wrong password and duplicate supplier name.
- Rewrite the entry: backend codes are translated on the client; what
  remains is the server actions, maintenance, the demo reset 409 and the
  login subtitle.

Why: the old entry described the whole job, most of which is now done.
- Add PARKING_CHECKIN_INVALID_STATUS and PARKING_SPOT_OCCUPIED to
  ERROR_CODES and send them from the check-in controller instead of bare
  strings.
- Give both codes a text in es and en and list them as translated.
- The error-code guard test now also collects codes written as bare strings
  (`code: 'X'`), so a code that skips ERROR_CODES cannot go untranslated.

Why: the two codes were sent as literals, which the guard test did not see,
so they had no text; with the page in English, a check-in on an occupied
spot showed the backend's Spanish message.
- Rewrite the untranslated-errors entry: the guard now also covers bare
  `code: 'X'` strings, and about 380 error responses carry a fixed Spanish
  text with no code, counted per module.

Why: the entry only named maintenance, while the A9 review found the same
gap in scheduling, parking, middlewares, cashier, checklist and auth.
…of' into opencode/error-codes

# Conflicts:
#	docs/TODO.md
@vercel

vercel Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
four-points Ready Ready Preview Oct 12, 2026 8:07am UTC

@bpstack
bpstack merged commit a6e01a1 into claude/compassionate-planck-gh6aof Oct 12, 2026
6 checks passed
@bpstack
bpstack deleted the opencode/error-codes branch October 12, 2026 19:01

This branch was successfully deployed

1 active deployment
Preview — 533c00d0 Deployed Oct 12, 2026 by vercel[bot]
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