Repository navigation
feat(translations): add the Mapbox wordmark and attribution labels to sy-atlas-translations - #1036
sydevs-bot wants to merge 2 commits into
Conversation
…tions sydevs/SahajAtlasWeb#324 makes the Mapbox wordmark and an attribution control visible on the map. Both take their accessible name from mapbox-gl's own `defaultLocale`, and the widget can override that name — it already does for the geolocate control — but only with copy from this global. No key held either string, so on every non-English embed those two controls read English while the rest of the interface is translated. `mapbox_homepage` overrides `LogoControl.Title` and keeps Mapbox's own `Mapbox homepage`: the wordmark is a link to mapbox.com, so naming the destination is what the control does. `toggle_attribution` overrides `AttributionControl.ToggleAttribution`, whose English `Toggle attribution` names the mechanism rather than what a visitor gets, so the seeded English is `Map data credits`. Neither takes a `maxLength` — both render as `aria-label` and `title`, never as laid-out text. The `common.map` group's own description already reads "Labels on the map's own controls", so it needed no widening. English alone is seeded. Each locale file's `_meta.omitted_keys` states that an untranslated key is omitted rather than blank, and the client read's English merge (#705) serves English for it. The seeded English is a default a manager can reword on the production global. The key count assertion moves 258 -> 260, read off the failure rather than the ticket, which predates #1020. `leafGroups` stays 43, since no group is added. No migration: a leaf group is one `jsonb` column, so only that column's generated JSON Schema changes. `pnpm db:migrations:create --skip-empty` emitted nothing, which is the check. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_014rSJxsCbdTj8Jh8M1R6KAb
|
🚅 Deployed to the SahajCloud-pr-1036 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 Adversarial review
Four files, 21 lines, each named in #1032's approach — no abstraction, no knob, no refactor. The shape is right, and the "necessary but not sufficient" framing answers the obvious question before it is asked: the schema must exist before the widget can t() either key, and the copy is #1025's to settle.
Two notes, neither a finding. The body says both keys render as aria-label and title; in mapbox-gl 3.33.0 only AttributionControl.ToggleAttribution does both — LogoControl.Title sets aria-label alone, despite its name. Same answer on maxLength, so nothing changes. And #1033 edits the same three files: whichever merges second owes a hand-resolved conflict in common.map, not only a new count.
Findings
consider—toggle_attributionnames the mechanism its own copy rejects, and breaks its sibling's convention. Inline thread ontranslationsSchema.json:239.
What was checked
- The diff whole against #1032's four steps, plus
translationsField.tsandTranslationsRowField.tsxfor how a key becomes an admin row. - The count derived independently from the branch schema: 260 keys, 43 leaf groups, 13 tabs. Merge-base is
origin/main, so 258 is current and 260 right. The ten seed_meta.schema_versionlines quote no key count, so none was owed an edit. Every other assertion in that spec re-checked by hand — English covers both keys, no other locale holds them, no invented placeholder, no blank description. - Upstream: fetched mapbox-gl 3.33.0's
defaultLocale. Both override keys exist, with exactly the English the ticket quotes. - Consumer side:
Map.tsx'smapLocalecarries the two geolocate overrides only, so #324 adds entries rather than changing shape. - Preview: the admin URL answers 200, but sign-in needs
PREVIEW_ADMIN_EMAIL, absent here, so neither row was seen rendered.
🤖 Written by the sydevs autonomous loop — see what this is
Generated by Claude Code
|
One thread, rebutted. No commit, so the head stays Base — the branch is already at Rebutted — Body refreshed, for two claims that were already wrong:
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
#1033 landed location_failed in the same common.map object this branch adds mapbox_homepage and toggle_attribution to, and reworded both the group's own description and location_not_available's. Both sides kept, everywhere: main's reworded descriptions, this branch's two keys, all three seed strings. The declared-key count assertion goes to 261 — 258 before either PR, one from #1033, two here — read off the spec run, not computed. src/payload-types.ts auto-merged, and generate:types reproduces it with no drift. Co-Authored-By: Claude Opus 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01HCtN4KyjT7zuHFmFGB1Ep7
|
Merged The declared-key count is now 261 — 258 before either PR, one from #1033, two here. Read off the failing assertion, not computed.
🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
|
Closing as won't-do. These keys aren't the attribution text (that comes from the map style); they're the screen-reader labels on the Mapbox wordmark and attribution toggle, which exist for Mapbox's terms rather than as a feature. Not worth two schema keys, nine translations, and the #1025 dependency. Mapbox's English defaults stay; sydevs/SahajAtlasWeb#330 records the decision in Map.tsx. |
Summary
common.map.mapbox_homepageandcommon.map.toggle_attribution, the two control labels fix(map): show the Mapbox logo and attribution SahajAtlasWeb#324 needs, and seeds their English defaults.Change outline
Contract — the widget-facing key set
The one shape a consumer sees. Both keys override a string in mapbox-gl's own
defaultLocale,which is where these controls get their accessible name today. The English given is Mapbox's own,
so the seeded copy is a translation of a real string rather than an invention.
sy-atlas-translations └── common tab └── map leaf group → jsonb sy_atlas_translations_locales.common_map find_my_location # GeolocateControl.FindMyLocation — already overridden location_not_available # GeolocateControl.LocationNotAvailable — already overridden + mapbox_homepage overrides LogoControl.Title ("Mapbox homepage") + "Label of the Mapbox wordmark, which links to mapbox.com." + toggle_attribution overrides AttributionControl.ToggleAttribution ("Toggle attribution") + "Label of the control that shows and hides the map's data credits."No
maxLengthon either: neither is laid-out text.toggle_attributionrenders as botharia-labelandtitle;mapbox_homepageasaria-labelalone —LogoControlsets notitlein mapbox-gl 3.33.0, despite what its key is called. The group's own description already reads
"Labels on the map's own controls", so it needed no widening. No migration — a leaf group is one
jsonbcolumn, so only that column's generated JSON Schema moves.The seeded English departs from Mapbox once, deliberately:
toggle_attributionisMap data credits, notToggle attribution. The control opens the "© Mapbox © OpenStreetMap" line, soMapbox's own wording names the mechanism rather than what a visitor gets.
Types — the generated interface
interface SyAtlasTranslationsCommonMapStrings { src/payload-types.ts find_my_location?: string; location_not_available?: string; + mapbox_homepage?: string; + toggle_attribution?: string; }Files — where the keys are declared and seeded
src/globals/SahajAtlasTranslations/ └── translationsSchema.json # declares both keys, their type and their descriptions seeds/sy-atlas-translations/ ├── data.en.json # the two seed defaults, reworded by a manager └── data.{cs,de,es,fr,hu,nl,pt-BR,ru,uk}.json # untouched: omitted, never blankPreview
sy-atlas-translations→ Common → Map — the new Mapbox Homepage and Toggle Attribution rows, each with its descriptionData: not seeded.
previewUrl.seedis unset for this repo, so a fresh preview carries notranslation values. Both rows render with an empty input either way, which is what this change
adds — the fields and their descriptions, not values.
Sign in with
PREVIEW_ADMIN_EMAILat/admin/login.Contract impact
src/payload-types.tsis acontractSyncsource for WeMeditateWeb and SahajAtlasWeb.Both copies re-sync in a bot PR after this merges; neither needs work here.
Merging this does not unblock sydevs/SahajAtlasWeb#324 on its own, for the same reason
#1025 records for
event.display.room: nothing in the deploy writes a seed file,and
scripts/sync-translations.mjsin the widget repo snapshots what production serves.English has no fallback source of its own —
clientEnglishFallbackskips the default locale — sotranslations.en.jsonthere gains neither key until the copy exists on the live global.#1025 holds that decision (its Question 1: run the production seed, or have a
manager type it). Whichever answer it takes covers these two keys as well — they are in the
same
data.en.jsonand the same global. No second ticket is filed for them; answering #1025 onceis the cheaper path, and splitting it would ask the same question twice.
Test results
.claude/skills/pr-prep/check.sh— lint, format, typecheck (src + tests), 226 unit files / 2902 teststests/int/translations-globals.int.spec.ts(36),tests/int/translations-field.int.spec.ts(26),tests/int/globals-client-reads.int.spec.ts(15)The count assertion was watched failing at
260before258was bumped, as the ticket asks. Theticket predicted
259from a count of257;258is whatmainactually carries since #1020merged, so the number was read off the failure rather than taken from the body.
Manual verification
descriptions.
chore(translations): enter the production English copy for event.display.room #1025 settles. The global is
drafts: { localizeStatus: true }, so a localeserves a key only after that locale is published. This PR ships the schema and the seed, not
the copy.
Notes for reviewer
All four acceptance criteria were checked against a running server, not inferred — including the
locale=declient read, which #1020 could not reach. See Detail for how./code-review highreported no findings, having fetched mapbox-gl's owndefaultLocaletoconfirm that
LogoControl.Titleis"Mapbox homepage"andAttributionControl.ToggleAttributionis
"Toggle attribution", and thatLogoControl's anchor points athttps://www.mapbox.com/./simplifyfound nothing to act on: the branch adds no code — JSON data, one numeric constant,and generated output.
comment-lint.mjs: no banned comment added. Security review skipped: nopath matches
securityReview.triggerPattern, and this repo sets nocontentPattern. Docschecked, nothing stale — no Markdown file names a key in this group or the leaf-group count.
#1033 overlaps this PR by more than the key count. It adds
location_failedto this samecommon.mapgroup, for #1031, and it also rewrites the group's own description andlocation_not_available's — inside the same object this PR inserts two keys into. So whichevermerges second owes a hand-resolved conflict in
translationsSchema.jsonanddata.en.json, notonly a new number. Nothing else is shared.
The naming of
toggle_attributionwas raised and settled (thread ontranslationsSchema.json).A key here names its slot, not its copy: 195 of the 263 seeded English strings differ from
toWords(key). A copy-derived name would be the one to go stale when a manager rewords the string,which #1025 expects.
Detail
How acceptance criterion 3 was checked, and the trap in the way. "The same read at
locale=de, authenticated as aclientsAPI key, returns the English strings." A plain REST readagainst a local dev server answers this wrongly and silently:
admin.autoLogin(
src/payload.config.ts:172) authenticates the request as the admin manager, which outranks theAPI key, and
clientEnglishFallbackthen correctly skips a manager read. The response is a 200carrying German's own two keys and no merge — indistinguishable from a broken fallback. Six
pre-existing keys (
event.display.room,event.display.unverified_note,event.display.unverified_title,registration.form.subscribe,registration.form.title,share.title) read as missing the same way, which is what ruled the change out as the cause.Sending
DisableAutologin: truebeside the API key is what makes the read a real client read —the header
scripts/redeem-signin-link.ts:73uses for the same reason. The request then hits theclient gate (400 without
depth), and withdepth=0returns:{"common":{"map":{ "find_my_location":"Meinen Standort finden", "location_not_available":"Standort nicht verfügbar", "mapbox_homepage":"Mapbox homepage", "toggle_attribution":"Map data credits"}}}Both English, neither blank.
locale=enreturns all four of its own. The admin page was fetchedtoo:
/admin/globals/sy-atlas-translationscarries both field names and both descriptions.Which attribute each key actually lands on, read off mapbox-gl 3.33.0's own source rather than
inferred from the key names.
LogoControl.onAddcallssetAttribute('aria-label', …)on itsanchor and sets no
title.AttributionControl.onAddreads the string once and uses it twice —aria-labelon the compact button,titleon the icon span inside it. Neither is laid-out text,so the
maxLengthanswer is the same for both.No migration, verified rather than assumed.
pnpm db:migrations:create … --skip-emptyemittedno file.
No new test, as the ticket's first criterion requires.
tests/unit/atlas-translations-schema.spec.tsalready pins every property this change has: the key count, a non-blank description per key, an
English seed value for every declared key, that a seed writes only declared keys, and that no
other locale invents a placeholder English lacks. The count case was watched red on the schema
edit and green on the bump.
mergeEnglish's "fills a key the locale omits entirely" case(
tests/unit/client-english-fallback.spec.ts) is the pin for the fallback these keys rely on, andit was re-run against the real seeded data and the real lookups before the REST check above.
The override is construction-only, inherited from how Mapbox works rather than from this
change:
localeis read once when the map is built and there is nosetLocale, so a mid-sessionlanguage switch will not relabel either control. The geolocate labels already have that
limitation, documented in
docs/rules/mapbox.mdin the widget repo. Worth knowing, not a blocker.Closes #1032
🤖 Generated with Claude Code
https://claude.ai/code/session_014rSJxsCbdTj8Jh8M1R6KAb