Repository navigation
feat(i18n): traducir los códigos de error del backend en el cliente - #11
Merged
bpstack merged 18 commits intoOct 12, 2026
Merged
Conversation
- 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
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Cambios
errorCodeMessage.tstraduce 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).SupplierInvoicesModalpasan por la traducción; respuestas que no traíancodeahora lo traen.PARKING_CHECKIN_INVALID_STATUSyPARKING_SPOT_OCCUPIEDpasan aERROR_CODEScon su texto.ERROR_CODES.Xy todocode: '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.