Repository navigation
[i18n] Translate backend messages by code (issues#3157) - #883
Merged
Merged
Conversation
Both HAXcms backends now send a `code` and `params` next to their English message. This adds the shared code list and the front-end side: - haxcms-elements/lib/haxcms-api-codes.json: the shared list (117 codes, English text, and the patterns the backends use to recognise their own messages). haxcms-nodejs and haxcms-php keep copies of this file. - locales/haxcms-api.<lang>.json in 102 languages, plus the manifest entry. - lib/core/utils/HAXCMSApiMessages.js: haxcmsApiMessage(response, fallback) shows the translation for the code in the user's language, or the server's English message (more specific) when English is in use or there is no translation. Also exposed as globalThis.haxcmsApiMessage for hax-body, which can't import haxcms-elements. - Used by the site editor (request errors, page details), files dialog, file actions, Excel import, archive export, app-hax site actions and site creation, and system settings. - micro-frontend-registry: error results now carry the backend message from data.message / data.error (both backends put it there) and its code; before, only a top-level message was read, so most error text was lost. - AppHaxBackendAPI: hard-denial detection uses the code, keeping the English list for older backends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EN4mJgNh8uj2C44jDs4KAD
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
This was referenced Oct 19, 2026
This branch had an error being 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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Part of haxtheweb/issues#3157. Merge this one first: it holds the shared code list the backend PRs copy. It also works on its own with today's backends (no codes yet → the English message is shown as before, and the registry fix below already helps).
What it touches
haxcms-elements/lib/haxcms-api-codes.json(new, source of truth): 117 message codes, each with English text and the patterns the backends use to recognise the messages they already send (named groups become params, e.g.{maxMb}). Covers 1,166 of the 1,171 response messages surveyed across both backends.haxcms-elements/locales/haxcms-api.<lang>.json: 102 languages, plus the manifest entry.haxcms-elements/lib/core/utils/HAXCMSApiMessages.js(new):haxcmsApiMessage(response, fallback).globalThis.haxcmsApiMessagefor hax-body, which can't import haxcms-elements.hax-upload-field), Excel import, archive export, app-hax site actions, site creation errors, system settings.micro-frontend-registryfix: error results only read a top-levelmessage, but both backends put it indata.message(ordata.error), so most backend error text never reached people. It now reads those and keepscode/params.AppHaxBackendAPI: hard-denial detection usesACCESS_DENIED/USER_TOKEN_REQUIRED, keeping the English list for older backends. Because of the registry fix, these denials are actually detected now. Before, they always went down the token-refresh path._responseStatusText: the backend message now wins over an HTTP reason phrase like "Bad Request" (the direct-fetch path setstatusTextfrom HTTP, which hid the real message).Tests
haxcms-elements/test/haxcms-api-messages.test.js:micro-frontend-registrytests cover the envelope message and code.Translation confidence
Lower confidence; worth a native speaker's look: co, eu, fo, fy, ga, gn, ha, haw, ig, jv, km, kn, ku, ky, lb, lo, mi, ml, my, ny, om, pa, pnb, ps, qu, sd, si, sn, so, tg, tk, tt, wuu, xh, yi, yo, zu.
Related PRs, in merge order
Generated by Claude Code