oficina / mapa Public

Mapa: dates, times and numbers in the reader's locale

Paul's rule is to localise from day one. Every date, time and count Mapa shows is now written in the reader's locale: their own choice in Settings, else what the browser asks for, else the team's (MAPA_LOCALE, en-IE). The images' screens, merged from main, go through it too. Stored Markdown, URLs and payloads stay ISO. Level-up build note 85. Fable approved; Luna's copy pass applied.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Squashed from feat/locale into main.
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 2096c232f21974bac8f1cdf901cf6a18943402b0 parent f9337f9
100 files changed, +7,932 −374
  • AGENTS.md +16 −0
  • Makefile +12 −2
  • cmd/mapa/main.go +1 −1
  • copy-review/locale/result.json +143 −0
  • copy-review/locale/strings.json +122 −0
  • docs/superpowers/specs/2026-11-14-mapa-level-up.md +14 −1
  • editor/datepicker.mjs +11 −11
  • editor/datepicker.test.mjs +24 −0
  • editor/dates.mjs +100 −0
  • editor/dates.test.mjs +73 −0
  • editor/gen-dates.mjs +177 −0
  • editor/page.mjs +3 −0
  • editor/parity.test.mjs +37 −0
  • editor/resolutions.mjs +8 −17
  • editor/typeddate.mjs +41 −6
  • editor/typeddate.test.mjs +20 −4
  • internal/mapa/app.go +13 −0
  • internal/mapa/around.go +7 −5
  • internal/mapa/auth_navigation.go +1 −1
  • internal/mapa/calendar.go +17 −14
  • internal/mapa/calendar_test.go +18 −5
  • internal/mapa/colophon.go +1 −1
  • internal/mapa/config.go +18 −0
  • internal/mapa/config_test.go +25 −5
  • internal/mapa/credits/assets.json +1 −1
  • internal/mapa/diff_test.go +1 −1
  • internal/mapa/door.go +3 −3
  • internal/mapa/frame.go +1 −1
  • internal/mapa/funcs.go +21 −62
  • internal/mapa/graph.go +12 −3
  • internal/mapa/handlers_history.go +6 −5
  • internal/mapa/handlers_images.go +13 −7
  • internal/mapa/handlers_images_form.go +1 −1
  • internal/mapa/handlers_names.go +2 −2
  • internal/mapa/handlers_pages.go +8 −4
  • internal/mapa/handlers_search.go +5 −1
  • internal/mapa/handlers_title.go +1 −2
  • internal/mapa/history_view.go +15 −12
  • internal/mapa/images.go +16 −9
  • internal/mapa/images_list.go +9 −4
  • internal/mapa/island.go +6 −0
  • internal/mapa/locale/dates.json +2,176 −0
  • internal/mapa/locale/format.go +200 −0
  • internal/mapa/locale/locale.go +195 −0
  • internal/mapa/locale/locale_test.go +185 −0
  • internal/mapa/locale/testdata/date_labels.json +2,162 −0
  • internal/mapa/locales.go +115 −0
  • internal/mapa/locales_test.go +62 −0
  • internal/mapa/mapview.go +3 −2
  • internal/mapa/markup/chips.go +0 −14
  • internal/mapa/markup/golden_locales_test.go +89 −0
  • internal/mapa/markup/golden_test.go +17 −12
  • internal/mapa/markup/testdata/corpus/edge.json +24 −0
  • internal/mapa/markup/testdata/editor.json +7 −1
  • internal/mapa/markup/testdata/golden.json +9 −3
  • internal/mapa/markup/testdata/golden_locales.json +38 −0
  • internal/mapa/members.go +13 −0
  • internal/mapa/members_locale.go +70 −0
  • internal/mapa/mentions.go +2 −1
  • internal/mapa/migrations/0006_alter_members.sql +1 −0
  • internal/mapa/migrations/schema.sql +1 −1
  • internal/mapa/models.go +7 −0
  • internal/mapa/private.go +1 −0
  • internal/mapa/rank.go +4 −2
  • internal/mapa/recent.go +1 −1
  • internal/mapa/render.go +43 −8
  • internal/mapa/seal/seal.go +2 −0
  • internal/mapa/search.go +5 −3
  • internal/mapa/search_groups_test.go +1 −1
  • internal/mapa/settings.go +10 −2
  • internal/mapa/settings_locale.go +85 −0
  • internal/mapa/shell.go +1 −1
  • internal/mapa/static/{editor.4b68391a7ef1b95e.js => editor.230eae88eb1bf4a3.js} +30 −30
  • internal/mapa/static/mapa.js +11 −4
  • internal/mapa/templates/deleted.html +1 −1
  • internal/mapa/templates/frame.html +6 −5
  • internal/mapa/templates/history.html +1 −1
  • internal/mapa/templates/pages.html +1 −1
  • internal/mapa/templates/partials.html +2 −2
  • internal/mapa/templates/scratch.html +1 −1
  • internal/mapa/templates/settings.html +4 −0
  • internal/mapa/testdata/typed_dates.json +339 −1
  • internal/mapa/today.go +13 −18
  • internal/mapa/typeddate.go +96 −16
  • internal/mapa/typeddate_test.go +43 −12
  • internal/mapa/versions.go +14 −16
  • internal/mapa/views.go +17 −12
  • internal/mapatest/browser_test.go +33 −3
  • internal/mapatest/daily_test.go +1 −1
  • internal/mapatest/datepicker_browser_test.go +1 −1
  • internal/mapatest/editor_typing_browser_test.go +3 −3
  • internal/mapatest/gate8_test.go +2 −0
  • internal/mapatest/history_panel_test.go +1 −1
  • internal/mapatest/locale_browser_test.go +133 −0
  • internal/mapatest/locale_settings_test.go +138 −0
  • internal/mapatest/locale_sweep_test.go +194 −0
  • internal/mapatest/locale_test.go +292 −0
  • internal/mapatest/pagelink_browser_test.go +1 −1
  • internal/mapatest/palette_test.go +1 −1
  • internal/mapatest/plaintext_test.go +1 −0

CI passed — run details

CI log
=== editor ===
cd editor && npm ci --no-audit --no-fund --loglevel=error

added 16 packages in 318ms
cd editor && node build-bundles.mjs
wrote internal/mapa/static/editor.230eae88eb1bf4a3.js (348754 bytes, 109.5KB gzipped; L12 budget 120KB)
cd editor && node --test
✔ days and weeks move across months and years (1.231905ms)
✔ a month keeps the day, or takes the month's last (0.228965ms)
✔ the grid is six weeks from Monday, as the month calendar draws it (0.678499ms)
✔ the grid starts the week where the locale does (1.368839ms)
✔ the keys move a day, a week, a month and a year (0.254132ms)
✔ the picked day is the chip [[ makes for a date (14.741379ms)
✔ Insert → Today's date still puts today in at once (1.308517ms)
✔ / offers Date, the picker, and Today's date beside it (0.222433ms)
✔ after a ! the chip goes in after a space, never as an embed (2.237872ms)
✔ where the Markdown would read the chip differently, it is refused (1.551208ms)
✔ over a selection the chip goes after it and the words stay (1.362278ms)
✔ today is the day in the viewer's zone (16.395938ms)
✔ every offered locale has cases (1.082939ms)
✔ dates.mjs writes every date Go writes, byte for byte (4.595967ms)
✔ a chip, the month and the week, in three locales (0.602958ms)
✔ dates.json is what ICU gives, byte for byte (454.269006ms)
✔ L1: mounting then serialising gives cleanBody(body), byte for byte (65.814944ms)
ℹ 794 bodies
✔ L1: mounting a stored body adds nothing, and saving it writes nothing new (57.992772ms)
✔ L2: one edited block changes only that block's bytes; undo gives the body back (104.120219ms)
ℹ 782 single-block edits
✔ L2: inserting or deleting a block changes bytes only at the new seams, by Join (109.167304ms)
ℹ 789 inserts, 747 deletes
✔ L3: seeded edits keep the document and its Markdown saying the same thing (3345.368389ms)
ℹ 19056 edits over 794 bodies
✔ L3: Link to a page makes exactly one chip, and changes nothing else (928.766675ms)
ℹ 4217 links over 794 bodies; refused: {"A page link can’t hold another link or a line break. Select plain words.":744,"A page link can’t show [ or ]]. Select words without them.":381,"Select some words to link them to a page.":169,"Linked here, the Markdown around these words would read differently: a ! before them makes an embed, and a stray ` or * pairs up. Select other words.":17}
✔ L3: a picked date is one more date chip, or refused where a letter would be too (954.406113ms)
ℹ over 794 bodies: {"inserted":4727,"spaced":18,"refused":19,"unstable":9}
✔ linear: trailing spaces (44.977174ms)
✔ linear: trailing whitespace (18.173847ms)
✔ linear: unclosed web links (17.090277ms)
✔ linear: web links with no address (24.586926ms)
✔ linear: unclosed wiki links (20.727585ms)
✔ linear: unclosed embeds (16.457243ms)
✔ linear: closes only (7.240633ms)
✔ the selected words become the chip's shown text (10.534035ms)
✔ words that are the title make a plain [[Title]] (4.35018ms)
✔ spaces at the selection's edges stay outside the chip (1.64415ms)
✔ a date makes a date link, in a heading, an item and a quote (6.457369ms)
✔ bold words lose their bold: a chip carries no marks in Mapa's Markdown (0.983745ms)
✔ only the linked block's bytes change, and undo gives the body back (2.320816ms)
✔ a selection across blocks, over a chip or a break, or of brackets is refused (1.154943ms)
✔ a target the words cannot be linked to as typed is refused (0.183821ms)
✔ ⌘L: over a selection it opens Page link; with none it types [[; in code it does nothing (1.899534ms)
✔ web-linked words are refused: the address would be lost (review M4) (0.765992ms)
✔ words whose Markdown would read otherwise are refused (review M3) (1.438288ms)
✔ ⌘A then ⌘L says why, instead of doing nothing (review low 1) (0.297101ms)
✔ linkCheck says why it refuses (review low 2) (0.561692ms)
✔ golden file has bodies (0.858472ms)
✔ markup.mjs parses every body into Go's blocks, byte offsets and all (24.60532ms)
✔ markup.mjs strips and spans every block as Go does (30.547303ms)
✔ the schema's toDOM draws every body as Go renders it (60.086005ms)
✔ emphasis draws the four pinned outputs (14.195918ms)
✔ a body ends in the editor's empty paragraph (0.304625ms)
✔ the editor labels date chips as Go does, in every locale L4 holds (7.9455ms)
✔ a POST that never answers is aborted after the timeout (21.666717ms)
✔ a keepalive POST carries no signal, and an answer clears the timer (3.603036ms)
✔ autosave sends only what differs, and the tab owns the draft it wrote (9.453639ms)
✔ an offered draft never commits by itself; Save commits it (1.069344ms)
✔ reload, then close: sessionStorage says the draft is this tab's own (0.466034ms)
✔ closing carries text not yet sent, and the cap leaves it out (26.332103ms)
✔ clean rebase: applied, the caret survives, the base moves by the rebase POST (2.877329ms)
✔ the block under the caret is the teammate's too, and undo brings back yours (2.219168ms)
✔ typing mid-flight: the merge is not applied and the base does not move (1.014462ms)
✔ a merge the editor cannot represent stops after three tries (3.63371ms)
✔ a conflict is shown, locks the editor's own commits, and Resolve settles it (1.294271ms)
✔ leaving: a conflict stays with the choice; a failed flush offers Leave anyway; a stored draft leaves (1.571837ms)
✔ a stale tab shows the newer draft, offered, and never overwrites it (1.876973ms)
✔ the first scratch commit: empty creates nothing, then one page, then drafts on it (0.873671ms)
✔ noBase and gone lead to the existing choices (0.839056ms)
✔ a commit that merged is applied when nothing was typed since (0.95936ms)
✔ back from the cache: nothing unsaved reloads, unsaved text autosaves at once (5.887363ms)
✔ an own draft committed meanwhile goes on as a new draft (1.040781ms)
✔ a reload keeps a stored draft; unsent text still commits (0.362903ms)
✔ a page deleted mid-edit: what is typed is still stored as the draft, and nothing commits (H1) (0.759729ms)
✔ an offered draft committed in another tab: typing goes on as a new draft (H1) (2.093885ms)
✔ a commit reply without a revision is not a commit; an emptied day starts afresh (H2) (0.95902ms)
✔ Resolve stores what was typed first, and takes no typing until its answer is applied (M1) (3.691719ms)
✔ closing with a choice open, or commits held, still writes the text, never commits (M2) (1.16947ms)
✔ closing inside the settling window sends the loaded version with settling=1 (M3) (0.327928ms)
✔ a clean merge not applied because of typing still ends the choice on show (M4) (0.892456ms)
✔ settling finds the draft committed with a teammate's text: a close still writes (M-A) (0.433233ms)
✔ settling finds another tab's newer draft: the tab shows it before any typing (0.649184ms)
✔ a page deleted before the first autosave: the text is offered as a scratch page, and a close makes one (M-B) (0.564007ms)
✔ an autosave that never answered but landed: its 409 keeps the typing since (L3) (0.515627ms)
✔ marks: em outside strong, bold reopened around italics, edges outside (6.548078ms)
✔ marks close before code, links and atoms, and reopen after (0.502132ms)
✔ untouched blocks and atoms re-emit their source; edited atoms are written from attributes (7.591926ms)
✔ empty blocks are written as nothing (3.272692ms)
✔ an unclosed fence that is no longer last gets its closing fence (1.797534ms)
✔ the structure check puts Join's seam where a kept one would merge two blocks (2.521358ms)
✔ prepareSave adopts the parse when no seam or rewrite can save the document (4.780048ms)
✔ reparse: typed emphasis becomes a mark, "- " after a break becomes an item (2.52243ms)
✔ a trailing hard break stays on screen and is written as nothing (1.490055ms)
✔ the reparse waits while an IME is composing (1.092867ms)
✔ copied blocks paste with their bytes and seams; a cut and paste gives the body back (4.323019ms)
✔ a forged x-mapa slice is refused, and text from outside is read as Markdown (0.911411ms)
✔ rebuild changes origins only, outside undo history (1.540088ms)
✔ applyBody takes a teammate's block, keeps the caret, and ends untouched (1.349895ms)
✔ a block whose context changed is written again: a task toggled, a bullet, a quote (1.756549ms)
✔ a duplicate ^id typed above its holder never takes the id from it (1.66521ms)
✔ a copy-dragged block is reparsed, and says what its Markdown says (1.09965ms)
✔ a history command that throws is refused, never thrown (4.476795ms)
✔ an image re-emits its source, and an edited alt changes only its span (1.121271ms)
✔ a paste whose image copy is refused says why and pastes nothing (13.391774ms)
✔ one rename at a time, from either field (2.04351ms)
✔ an empty or unchanged title sends nothing (0.213175ms)
✔ a refusal keeps what was typed, and the title (0.243702ms)
✔ the pending state holds for the busy rule (9.558104ms)
✔ a failed POST says so and keeps the title (0.889029ms)
✔ Update links posts the confirm page's POST (0.246457ms)
✔ clean is CleanTitle's whitespace rule (0.33939ms)
✔ the saver's base follows a rename made over it, and only that (0.324732ms)
✔ closing sends the rename as one keepalive POST (2.909128ms)
✔ the port answers every shared case as typeddate.go does (4.239726ms)
✔ numbers follow the locale: 12/11 is November in en-IE, December in en-US (0.166318ms)
✔ M6: several files land in the order they were chosen (43.798338ms)
✔ M5: one Backspace before the box keeps the image where the box is (12.115367ms)
✔ M5: undoing text typed just before the box keeps the upload (10.53786ms)
✔ L12: a failed upload an undo takes away does not stall the next (14.561174ms)
✔ M4: Replace… keeps the old image until the new one is in, and its alt (12.261038ms)
✔ M3 and N1: text wins, except over a picture copied from a page (1.852488ms)
✔ N2: a JPEG over 10 MB is scaled before its size is checked (6.096009ms)
✔ a drag whose anchor the document no longer reaches selects to its end (6.266597ms)
ℹ tests 119
ℹ suites 0
ℹ pass 119
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 5698.744948
=== vet ===
go vet ./...
go vet -tags browser ./internal/mapatest/
=== fmt ===
=== code ===
go tool rastrillo budget code
The base has no .rastrillo/code.txt: skipping the check that records only go down.
budget code: within the limits.
=== test ===
CGO_ENABLED=0 go test ./...
?   	amadan.net/oficina/mapa/cmd/mapa	[no test files]
ok  	amadan.net/oficina/mapa/internal/mapa	1.151s
?   	amadan.net/oficina/mapa/internal/mapa/icons	[no test files]
ok  	amadan.net/oficina/mapa/internal/mapa/imagefile	(cached)
ok  	amadan.net/oficina/mapa/internal/mapa/locale	0.006s
ok  	amadan.net/oficina/mapa/internal/mapa/markup	0.094s
ok  	amadan.net/oficina/mapa/internal/mapa/seal	0.003s
ok  	amadan.net/oficina/mapa/internal/mapatest	13.214s
?   	amadan.net/oficina/mapa/scripts/mutate	[no test files]
?   	amadan.net/oficina/mapa/scripts/preview	[no test files]
=== migration-check ===
go tool rastrillo migration check
rastrillo migration check: models and migrations agree
=== credits-check ===
python3 scripts/credits.py --check
credits: checked
AGENTS.md

Loading diff…

Makefile

Loading diff…

cmd/mapa/main.go

Loading diff…

copy-review/locale/result.json

Loading diff…

copy-review/locale/strings.json

Loading diff…

docs/superpowers/specs/2026-11-14-mapa-level-up.md

Loading diff…

editor/datepicker.mjs

Loading diff…

editor/datepicker.test.mjs

Loading diff…

editor/dates.mjs

Loading diff…

editor/dates.test.mjs

Loading diff…

editor/gen-dates.mjs

Loading diff…

editor/page.mjs

Loading diff…

editor/parity.test.mjs

Loading diff…

editor/resolutions.mjs

Loading diff…

editor/typeddate.mjs

Loading diff…

editor/typeddate.test.mjs

Loading diff…

internal/mapa/app.go

Loading diff…

internal/mapa/around.go

Loading diff…

internal/mapa/auth_navigation.go

Loading diff…

internal/mapa/calendar.go

Loading diff…

internal/mapa/calendar_test.go

Loading diff…

internal/mapa/colophon.go

Loading diff…

internal/mapa/config.go

Loading diff…

internal/mapa/config_test.go

Loading diff…

internal/mapa/credits/assets.json

Loading diff…

internal/mapa/diff_test.go

Loading diff…

internal/mapa/door.go

Loading diff…

internal/mapa/frame.go

Loading diff…

internal/mapa/funcs.go

Loading diff…

internal/mapa/graph.go

Loading diff…

internal/mapa/handlers_history.go

Loading diff…

internal/mapa/handlers_images.go

Loading diff…

internal/mapa/handlers_images_form.go

Loading diff…

internal/mapa/handlers_names.go

Loading diff…

internal/mapa/handlers_pages.go

Loading diff…

internal/mapa/handlers_search.go

Loading diff…

internal/mapa/handlers_title.go

Loading diff…

internal/mapa/history_view.go

Loading diff…

internal/mapa/images.go

Loading diff…

internal/mapa/images_list.go

Loading diff…

internal/mapa/island.go

Loading diff…

internal/mapa/locale/dates.json

Loading diff…

internal/mapa/locale/format.go

Loading diff…

internal/mapa/locale/locale.go

Loading diff…

internal/mapa/locale/locale_test.go

Loading diff…

internal/mapa/locale/testdata/date_labels.json

Loading diff…

internal/mapa/locales.go

Loading diff…

internal/mapa/locales_test.go

Loading diff…

internal/mapa/mapview.go

Loading diff…

internal/mapa/markup/chips.go

Loading diff…

internal/mapa/markup/golden_locales_test.go

Loading diff…

internal/mapa/markup/golden_test.go

Loading diff…

internal/mapa/markup/testdata/corpus/edge.json

Loading diff…

internal/mapa/markup/testdata/editor.json

Loading diff…

internal/mapa/markup/testdata/golden.json

Loading diff…

internal/mapa/markup/testdata/golden_locales.json

Loading diff…

internal/mapa/members.go

Loading diff…

internal/mapa/members_locale.go

Loading diff…

internal/mapa/mentions.go

Loading diff…

internal/mapa/migrations/0006_alter_members.sql

Loading diff…

internal/mapa/migrations/schema.sql

Loading diff…

internal/mapa/models.go

Loading diff…

internal/mapa/private.go

Loading diff…

internal/mapa/rank.go

Loading diff…

internal/mapa/recent.go

Loading diff…

internal/mapa/render.go

Loading diff…

internal/mapa/seal/seal.go

Loading diff…

internal/mapa/search.go

Loading diff…

internal/mapa/search_groups_test.go

Loading diff…

internal/mapa/settings.go

Loading diff…

internal/mapa/settings_locale.go

Loading diff…

internal/mapa/shell.go

Loading diff…

internal/mapa/static/{editor.4b68391a7ef1b95e.js => editor.230eae88eb1bf4a3.js}

Loading diff…

internal/mapa/static/mapa.js

Loading diff…

internal/mapa/templates/deleted.html

Loading diff…

internal/mapa/templates/frame.html

Loading diff…

internal/mapa/templates/history.html

Loading diff…

internal/mapa/templates/pages.html

Loading diff…

internal/mapa/templates/partials.html

Loading diff…

internal/mapa/templates/scratch.html

Loading diff…

internal/mapa/templates/settings.html

Loading diff…

internal/mapa/testdata/typed_dates.json

Loading diff…

internal/mapa/today.go

Loading diff…

internal/mapa/typeddate.go

Loading diff…

internal/mapa/typeddate_test.go

Loading diff…

internal/mapa/versions.go

Loading diff…

internal/mapa/views.go

Loading diff…

internal/mapatest/browser_test.go

Loading diff…

internal/mapatest/daily_test.go

Loading diff…

internal/mapatest/datepicker_browser_test.go

Loading diff…

internal/mapatest/editor_typing_browser_test.go

Loading diff…

internal/mapatest/gate8_test.go

Loading diff…

internal/mapatest/history_panel_test.go

Loading diff…

internal/mapatest/locale_browser_test.go

Loading diff…

internal/mapatest/locale_settings_test.go

Loading diff…

internal/mapatest/locale_sweep_test.go

Loading diff…

internal/mapatest/locale_test.go

Loading diff…

internal/mapatest/pagelink_browser_test.go

Loading diff…

internal/mapatest/palette_test.go

Loading diff…

internal/mapatest/plaintext_test.go

Loading diff…