Repository navigation
feat(gallery): translate the image gallery and validate its image list - #1306
Merged
nanaf6203-bit merged 1 commit intoOct 21, 2026
Merged
nanaf6203-bit merged 1 commit into
nanaf6203-bit merged 1 commit into
Conversation
The image gallery rendered hard-coded English strings and trusted the image list it received from the API, so a broken address became a broken image and a duplicated address was rendered twice. - move every string of the gallery and of the lightbox into the `gallery` section of the `common` namespace, in all seven shipped languages, and use the i18next plural form for the counted strings - validate the image list before rendering it: an entry that is not text, is empty, is not a source `next/image` can load, or repeats an address is skipped and reported to the user in a status notice - clamp the lightbox index to the image list, so it can never point at an image that does not exist - fall back to a generic label when the property has no name, so the images keep an alternative text - cover the validation rules, the translations and the plural forms with tests, and document the behaviour in docs/gallery.md Closes MettaChain#1264 Closes MettaChain#1265
|
@rozemary2026-a11y Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This was referenced Oct 20, 2026
nanaf6203-bit
approved these changes
Oct 21, 2026
nanaf6203-bit
left a comment
Contributor
There was a problem hiding this comment.
Gallery i18n plus image list validation, solid combo. Approved.
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
The image gallery (
ImageGallery/ImageLightbox) rendered hard-coded English strings and trusted the image list it received from the API. A broken address became a broken image, a duplicated address was rendered twice, and the gallery was the only part of the property page that ignored the language the user picked.This PR translates the gallery and validates the image list before anything is rendered.
Closes #1264
Closes #1265
Changes
Translations (#1264)
ImageGalleryandImageLightboxnow comes from thegallerysection of thecommonnamespace: the empty state, the overlay on the main image, the alternative text of the images and of the lightbox thumbnails, the lightbox controls and the position indicator.gallerysection is shipped in all seven languages the app supports (en,es,fr,de,zh,ar,he), so the translation completeness test keeps them in sync.viewAll/viewAll_one). The base key is kept as well, so languages with more plural categories than English (Arabic, Hebrew) resolve to a sentence instead of a raw key.Validation (#1265)
The image list is validated with a zod schema (
galleryImageSchema) before it is rendered. The rules are the ones the renderer can actually honour:http(s)URL or a path that starts with/GALLERY_MAX_IMAGES(50)next/imageonly accepts an absolutehttp(s)URL or a path that starts with a slash, so a relative path without the leading slash and adata:URL are rejected before they can turn into a broken image.Every rejected entry is reported to the user in a
role="status"notice above the gallery, with the reason it was skipped. A gallery whose images are all invalid shows that notice and the empty state.The lightbox index is clamped to the image list, so it can never point at an image that does not exist.
Tests
src/lib/__tests__/galleryValidation.test.ts— the validation rules themselves.src/components/property/__tests__/ImageGallery.validation.test.tsx— which images are rendered, which are skipped and what the user is told about it.src/components/property/__tests__/ImageGallery.i18n.test.tsx— the translated strings, the plural forms, the language switch and the key parity between the languages.src/test/i18n.ts— a test helper that boots i18next with the real translations, so the tests assert the strings the app renders instead of the raw keys.src/components/property/__tests__/ImageGallery.test.tsx— the existing suite, now rendering the translated strings.Documentation
docs/gallery.mddescribes the validation rules, the translation keys and the tests, and is linked from the README.How it was verified
The gallery suites pass, and the type check and the lint report exactly the same findings as the base commit — this change adds none.