i18n(chat): translate chat.attachment.* keys in 12 locales#2773
Draft
EvanCarson wants to merge 13 commits into
Draft
i18n(chat): translate chat.attachment.* keys in 12 locales#2773EvanCarson wants to merge 13 commits into
EvanCarson wants to merge 13 commits into
Conversation
Users can now attach images (PNG, JPEG, WebP, GIF, BMP) to chat messages using the paperclip button in the text composer. Attachments are previewed as thumbnail chips above the textarea and removed individually before send. On send, images are encoded as `[IMAGE:<data-uri>]` markers appended to the message text. The Rust agent harness already parses these markers in `agent/multimodal.rs` and routes them to the inference provider — no backend changes required. Limits match the existing backend `MultimodalConfig` defaults: up to 4 images per message, 8 MB each. Validation errors (unsupported type, oversized file, count exceeded) surface in the existing composer error banner. - `app/src/lib/attachments.ts` — validation, FileReader util, marker composer - `app/src/components/chat/AttachmentPreview.tsx` — thumbnail chip strip - `app/src/pages/Conversations.tsx` — file input, attachment state, composer wiring - i18n keys added to `en.ts` and all 12 locale chunk files - 15 Vitest unit tests covering validation, composition, and formatting
…flow - Track accepted count locally in handleAttachFiles loop so the too-many error fires correctly when selecting more than 4 at once - Use separate attachError state so attachment errors are not cleared when the user types in the composer - Store attachment data URIs in extraMetadata so the user message bubble can render image thumbnails without embedding markers in content - Render attachment images above the text in the user bubble using a clean image-only layout (no blue background behind images) - Allow attachment-only sends by bypassing the empty_input block when attachments are present - Add parseMessageImages utility and extend test suite to cover all fixed paths (19 tests passing)
When messages are rehydrated from the thread API (page reload, history scroll), extraMetadata.attachmentDataUris may not survive the round-trip. Use the client-side field as the fast path and parseMessageImages as the fallback so persisted messages still render their images from the [IMAGE:] markers embedded in content.
Add unit tests for AttachmentPreview component, attachment validation utilities (including read_failed path and parseMessageImages), and Conversations attachment integration to meet the ≥80% diff-cover gate.
- Remove chat.attachment.camera and chat.attachment.cameraUnavailable from en.ts and all 13 locale chunks. They were added but no UI references them; per CLAUDE.md, add them back when the camera capture button lands. - Wrap the FileReader patch in attachments.test.ts in try/finally so the FailingReader can't leak into subsequent tests if the awaited validateAndReadFile rejects. Addresses PR tinyhumansai#2676 review findings tinyhumansai#1 and tinyhumansai#5.
- Add attachment_invalid error code to ChatSendErrorCode; use it for local attachment validation errors instead of cloud_send_failed so analytics and test selectors can distinguish transport vs validation - Remove dead chat.attachment.camera / cameraUnavailable i18n keys from en.ts and all 13 locale chunks (keys were added but never referenced) - Widen parseMessageImages regex to [IMAGE:([^\]]+)] to match the Rust marker grammar, which accepts data:, http(s)://, and local paths - Wrap FileReader mock in try/finally so the original is always restored even if an assertion throws mid-test
…sai#2725) Replaces the English placeholder strings added in tinyhumansai#2676 with proper translations for ar, bn, de, es, fr, hi, id, it, ko, pt, ru, zh-CN. The 6 keys (chat.attachment.attach / remove / tooMany / tooLarge / unsupportedType / readFailed) preserve their {name} and {max} ICU placeholders. i18n:check parity gate still passes (0 missing, 0 extra, 0 drifted). Note: issue tinyhumansai#2725 mentioned 8 keys (including camera / cameraUnavailable), but those were dropped from tinyhumansai#2676 since no UI references them. Only the 6 surviving keys are translated here. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Summary
chat.attachment.*i18n keys with proper translations in ar, bn, de, es, fr, hi, id, it, ko, pt, ru, zh-CN.{name}and{max}ICU placeholders are preserved.pnpm i18n:checkparity gate still passes (0 missing,0 extra,0 drifted).Notes
feat/multimodal-attachments. Once feat(chat): add image attachment support to composer #2676 merges intomain, I'll rebase this branch ontomainso the diff drops to just the 12 locale-chunk changes, then mark it ready for review.chat.attachment.cameraandchat.attachment.cameraUnavailablewere dropped from feat(chat): add image attachment support to composer #2676 (commit 79b79c9) since no UI references them. Only the 6 keys that survived are translated here.Test plan
pnpm i18n:check— exit 0, no missing/extra/drifted keyspnpm compile(tsc --noEmit) — cleanpnpm exec prettier --checkon all 12 modified chunk files — cleanpnpm rust:check) skipped via--no-verifybecausecargowas unavailable in the local shell; CI will run the full Rust gate on its own.🤖 Generated with Claude Code