Skip to content

feat(web): translate v2 problem details - #3894

Merged
Quick104 merged 2 commits into
mainfrom
i18n/web-problem-details
Nov 10, 2026
Merged

Quick104 merged 2 commits into
mainfrom
i18n/web-problem-details

Conversation

@Quick104

@Quick104 Quick104 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Related issue: #3188
Validation tasks: none (English shows the server's text unchanged)

Stacked on #3893; the full stack order is in #3723.

When the API rejects a request, the web app shows the server's English detail even in a translated interface. The v2 API identifies every problem by type and every field error by code, so the client can show its own translation. This PR translates them.

Approach

V2ProblemError.message and a new problemFieldDetail() pick, in a translated interface: the field error's error.field.<code>, then error.<type>, then the server's detail. English always shows the server's text. The message is computed once, when the error arrives, so it stays a plain property that survives structuredClone. The field-detail readers (admin requests and libraries, item edits, new password, autoscan, profile home sections) use the helper.

Apple and Android use the same error.* keys in their own PRs.

Validation

  • Web tests, typecheck and ESLint pass on this branch. A new table test covers the order (field code, then type, then detail) and fails without the change.
  • On a sandbox (see Evidence): the same 422 shows the server's English in English and the catalog text in Spanish, Arabic, German and Japanese.

Evidence

Evidence: https://evidence.siloserver.org/r/silo-server/pr-3894/

Surface and build: web app, desktop; English on main and on a build of the whole stack, and Spanish, Arabic, German and Japanese on that build.

Risks

None identified.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
  • The Evidence section shows every change a user can see, or says there is none.

AI Disclosure

  • Harness: Claude Code (in T3 Code)
  • Tool(s): Claude Code; Codex
  • Model(s): claude-opus-5-5; claude-sonnet-5-5; gpt-6.1-sol
  • Involvement: Fully AI-generated; human review pending
  • Adversarial review: plan reviewed by Codex (gpt-6.1-sol) and Claude (claude-opus-5-5); one adversarial round by Codex (gpt-6.1-sol) found a read-time getter that structuredClone dropped, fixed here. Background review by Codex (gpt-6.1-sol) on 28b13b9: F1 (a translated generic field message replaces a server detail that names a limit) is the cross-client rule all clients follow; left for a maintainer decision, with structured limits in v2 field errors as the proposed fix.

🤖 Generated with Claude Code

Note

Add web interface translations with react-intl, locale-aware formatting, and language pickers

  • Adds an i18n layer using react-intl: a message catalog in catalog.ts, typed message keys, and formatting with English fallback and right-to-left argument isolation in format.ts
  • Adds locale catalogs for en, de, es, fr, ja, pt-BR, zh-Hans, ar, and pseudo-locales, managed by the new sync-translations script
  • Adds a LocaleProvider in useAppLocale.tsx that resolves the app language from the profile setting, a signed-out choice, or the browser, and loads localized language-name data in languageNames.ts
  • Adds language pickers on auth screens and in accessibility settings, and switches date, number, and relative-time formatting across the app to the app format locale (e.g. datetime.ts, timeAgo.ts, calendarWeek.ts)
  • Localizes V2 problem errors: V2ProblemError messages and field errors now resolve via problemText/problemFieldDetail in request.ts, and the client sends Accept-Language from appLanguage()
  • Replaces static LANGUAGES lists with languageOptions() from languageNames.ts across subtitle, metadata, and translate selectors
  • Behavioral Change: API problem error messages are fixed at construction time in the active locale rather than being the raw server detail; language selectors now derive from languageOptions() and change content when the app language changes

Macroscope summarized 223e9e5.

@silo-triage silo-triage Bot added the size/M 50–199 added + deleted lines (all files); change volume, not priority. label Nov 9, 2026
@coderabbitai

coderabbitai Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

We couldn't safely recover the incremental review. No full review was started, and the last reviewed checkpoint was preserved. Retry later, or explicitly request a full review by commenting @coderabbitai full review.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

V2 problem errors now use localized problem and field text. Validation error displays across admin, image, autoscan, password, and profile flows use the shared field-detail helper.

Changes: Localized v2 problem errors

Layer / File(s) Summary
Problem message and field-detail localization
web/src/api/v2/request.ts, web/src/api/v2/request.test.ts, web/src/i18n/README.md
V2ProblemError.message now resolves translated field text or problem text when the error is constructed. problemFieldDetail() resolves a field translation with the server detail as fallback. Tests cover translations, fallbacks, and message retention after locale changes and cloning.
Admin validation error displays
web/src/api/v2/adminRequests.ts, web/src/hooks/queries/admin/requests.ts, web/src/hooks/queries/admin/libraries.ts
Admin validation messages and catalog import toasts now use problemFieldDetail() to format field errors.
Other validation error displays
web/src/hooks/queries/items.ts, web/src/hooks/queries/useAutoscan.ts, web/src/lib/newPassword.ts, web/src/pages/admin-users/detail/preferences/ProfileHomeSections.tsx
Image, autoscan, password, and profile preference error displays now use localized problem messages or problemFieldDetail() for field errors.

Estimated code review effort: 2 (Simple) | ~12 minutes

Change: Feature

Possibly related PRs

Suggested labels: api-v2, impact: usability

Suggested reviewers: rhainland

Merge Risk: Low · previous review 8c45b

Some autoscan rejection toasts can omit the source-specific recovery advice in translated interfaces. This is a bounded, acknowledged follow-up rather than a merge blocker.

Security architecture risk: Low · up to 8c45b

The inspected changes localize error text without changing error identities, privileges, or authentication decisions. No introduced security concern was established, but downstream coverage is incomplete.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The demonstrated propagation is shared web-client error presentation across multiple workflows. The inspected changes do not add an endpoint or grant authority; incomplete downstream coverage prevents an exhaustive statement about every consumer.

Trust Boundaries and Controls

  • observed — Inspected authentication and device-approval consumers discriminate using status, problemType, and retryAfterSeconds rather than localized message text. These controls retain the structured fields preserved by the constructor.
Pre-merge checks: Passed 5

Check name Status Explanation
Title check Passed The title clearly summarizes the main change: translating v2 API problem details in the web app.
Description check Passed The description explains the problem, approach, affected web flows, and validation for the v2 problem-message translations.
Docstring Coverage Passed Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 85.71% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 7 functions across 9 files. (1 skipped: 1 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 93c737bc-d377-4bef-b88d-20803c5beac5
Commits

Reviewing files that changed from the base of the PR and between 8c8262a and 8c45b36.

Files selected for processing: 10

  • web/src/api/v2/adminRequests.ts
  • web/src/api/v2/request.test.ts
  • web/src/api/v2/request.ts
  • web/src/hooks/queries/admin/libraries.ts
  • web/src/hooks/queries/admin/requests.ts
  • web/src/hooks/queries/items.ts
  • web/src/hooks/queries/useAutoscan.ts
  • web/src/i18n/README.md
  • web/src/lib/newPassword.ts
  • web/src/pages/admin-users/detail/preferences/ProfileHomeSections.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T02:11:12.845991Z 1f1b98d New commits
🔒 Security Review ✅ Completed 2026-11-10T02:13:12.028769Z 1f1b98d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@Quick104 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adversarial review (gpt-6.1-sol, reviewed 28b13b9)

AI disclosure: gpt-6.1-sol via the Codex harness in T3 Code.

Comment thread web/src/api/v2/request.ts Resolved
@silo-triage silo-triage Bot added enhancement New feature or request evidence-required Needs before-and-after evidence before the Evidence check passes javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish stacked Base is another open PR; merge in stack order named in the body labels Nov 9, 2026
@silo-triage

silo-triage Bot commented Nov 9, 2026

Copy link
Copy Markdown

Please add phone-width before-and-after captures of the translated problem toast and a field-error example, or explain why mobile web is unaffected. The Evidence section names desktop only, but this changes shared error text used by phone-width screens; CONTRIBUTING.md requires evidence for both web surfaces.

@Quick104
Quick104 force-pushed the i18n/web-problem-details branch from 28b13b9 to 95472bc Compare November 9, 2026 17:20
@Quick104
Quick104 force-pushed the i18n/web-catalog-groundwork branch from a810bd5 to 46e4020 Compare November 9, 2026 17:20
@Quick104
Quick104 force-pushed the i18n/web-problem-details branch from 95472bc to 6f4ebdc Compare November 9, 2026 17:21
@Quick104
Quick104 force-pushed the i18n/web-catalog-groundwork branch 2 times, most recently from 1dcfe2e to dc858eb Compare November 9, 2026 17:26
@Quick104
Quick104 force-pushed the i18n/web-problem-details branch from 6f4ebdc to 07cee1f Compare November 9, 2026 17:26
@Quick104
Quick104 force-pushed the i18n/web-problem-details branch 2 times, most recently from 4b4d37b to 967b714 Compare November 9, 2026 17:59
@Quick104
Quick104 force-pushed the i18n/web-catalog-groundwork branch from 0793b85 to 8c8262a Compare November 9, 2026 17:59
@coderabbitai coderabbitai Bot added api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase impact: usability Core flow broken or severely blocked labels Nov 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Additional comments: 1

web/src/hooks/queries/admin/libraries.ts-971-971: 1

971-971: Minor · Functional Correctness · Quick win

Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.

Deduplicate the toast text in a translated interface.

V2ProblemError.message now equals the translation of the first field error's error.field.<code> when that key exists. problemFieldDetail returns the same text for that first field. The toast then shows the same sentence twice. Example: a Spanish catalog that has error.field.path_rewrite_required produces "X X Y". In English the texts differ, so this does not happen.

problemMessage in web/src/hooks/queries/admin/requests.ts already removes duplicates with a Set. Use the same approach here.

Proposed fix

-        toast.error([err.message, ...err.problem.errors.map(problemFieldDetail)].join(" "));
+        toast.error(
+          [...new Set([err.message, ...err.problem.errors.map(problemFieldDetail)])].join(" "),
+        );
Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 18769002-3ce4-4603-b537-bbbb03da3b15
Commits

Reviewing files that changed from the base of the PR and between 8c8262a and 967b714.

Files selected for processing: 10

  • web/src/api/v2/adminRequests.ts
  • web/src/api/v2/request.test.ts
  • web/src/api/v2/request.ts
  • web/src/hooks/queries/admin/libraries.ts
  • web/src/hooks/queries/admin/requests.ts
  • web/src/hooks/queries/items.ts
  • web/src/hooks/queries/useAutoscan.ts
  • web/src/i18n/README.md
  • web/src/lib/newPassword.ts
  • web/src/pages/admin-users/detail/preferences/ProfileHomeSections.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.

Comment thread web/src/hooks/queries/useAutoscan.ts Resolved
@Quick104
Quick104 force-pushed the i18n/web-problem-details branch from 8c45b36 to 2e6780b Compare November 9, 2026 20:08
@Quick104
Quick104 force-pushed the i18n/web-catalog-groundwork branch 2 times, most recently from 056efa3 to 7a99621 Compare November 10, 2026 02:08
@Quick104
Quick104 force-pushed the i18n/web-problem-details branch from 2e6780b to 223e9e5 Compare November 10, 2026 02:08
@Quick104
Quick104 force-pushed the i18n/web-catalog-groundwork branch from 7a99621 to 9d800c6 Compare November 10, 2026 02:09
@Quick104
Quick104 changed the base branch from i18n/web-catalog-groundwork to main November 10, 2026 02:09
@silo-triage silo-triage Bot added size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. and removed size/M 50–199 added + deleted lines (all files); change volume, not priority. labels Nov 10, 2026
Quick104 and others added 2 commits November 9, 2026 21:09
V2ProblemError.message and problemFieldDetail() translate server
problems in a translated interface: error.field.<code>, then
error.<type>, else the server's detail. The message is computed once, in
the language current when the error arrives, so it stays a plain property
that survives structuredClone. Field-detail readers use the helper.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Without a field error the toast read the server's detail directly,
so a translated interface still showed English. It now uses the
error's message, which is translated.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Quick104
Quick104 force-pushed the i18n/web-problem-details branch from 223e9e5 to 1f1b98d Compare November 10, 2026 02:09
@silo-triage silo-triage Bot added size/M 50–199 added + deleted lines (all files); change volume, not priority. and removed size/XXXL 3000+ added + deleted lines (all files); change volume, not priority. labels Nov 10, 2026
@Quick104
Quick104 merged commit f5d5e68 into main Nov 10, 2026
3 checks passed
@Quick104
Quick104 deleted the i18n/web-problem-details branch November 10, 2026 02:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-v2 API v2 / Huma migration program (epic #135); long-running, stacked by phase enhancement New feature or request evidence-required Needs before-and-after evidence before the Evidence check passes impact: usability Core flow broken or severely blocked javascript Pull requests that update javascript code priority: P2 Limited scope, workaround exists, or polish size/M 50–199 added + deleted lines (all files); change volume, not priority. stacked Base is another open PR; merge in stack order named in the body

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant