oficina / docs Public

Merge branch 'us-english' into main

claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev d20a813798e0973207acff812eef23e6b1afdaf9 parent f5fd252parent 3ddbee6
2 files changed, +82 −1
  • internal/docs/render.go +1 −1
  • internal/docs/render_test.go +81 −0

CI passed — run details

diff --git a/internal/docs/render.go b/internal/docs/render.go
index 704689e..e18cbe5 100644
--- a/internal/docs/render.go
+++ b/internal/docs/render.go
@@ -251,7 +251,7 @@ var Catalog = rastrillo.Catalog{
// "Align left" and not "Left": the name is read on its own by a
// screen reader, out of any row, and "Left" answers no question.
"docs.editor.toolbar.align.left": "Align left",
- "docs.editor.toolbar.align.center": "Align centre",
+ "docs.editor.toolbar.align.center": "Align center",
"docs.editor.toolbar.align.right": "Align right",
// docs.editor.menu.* — the menu bar (show.html's [docs-menubar],
diff --git a/internal/docs/render_test.go b/internal/docs/render_test.go
index e6bcc77..fa8215a 100644
--- a/internal/docs/render_test.go
+++ b/internal/docs/render_test.go
@@ -4,6 +4,7 @@ import (
"io/fs"
"strings"
"testing"
+ "unicode"
)
// TestOurTemplatesUseTheAttributeGrammar holds the markup constraint
@@ -54,3 +55,83 @@ func TestOurTemplatesUseTheAttributeGrammar(t *testing.T) {
t.Fatalf("walk viewsFS: %v", err)
}
}
+
+// The catalog is written in US English, per Paul's ruling on 2026-09-03.
+// It reached this rule by shipping the counterexample: the alignment
+// buttons read "Align centre" while the command, the CSS class and the
+// keyword `text-align` itself all say `center`, so the label disagreed
+// with every other name for the same thing — and with the person who
+// asked for the feature.
+//
+// The real answer is a locale on the profile offering both spellings
+// (discussion 31), which this test does not pre-empt: when that lands,
+// en-GB is a second table and this guard moves to the en-US one. Until
+// then there is exactly one table, and nothing else was checking which
+// English it was written in.
+//
+// It is deliberately a word list rather than a dictionary. A general
+// speller is a dependency and a source of false positives on product
+// nouns; the pairs below are the ones a UK-based writer actually
+// reaches for, and a miss costs one wrong word that the next addition
+// to the list catches. Each entry is a British form whose US form
+// differs — never a word that is merely uncommon.
+func TestTheCatalogIsWrittenInUSEnglish(t *testing.T) {
+ // British form -> the US form it should have been. The value is
+ // never used to rewrite anything; it is there so a failure tells
+ // the reader what to write instead of only that something is
+ // wrong. Derived forms are listed rather than stemmed, because a
+ // suffix rule that turns "premise" into a finding is worse than
+ // a list that misses "colourless" until someone writes it.
+ british := map[string]string{
+ "centre": "center",
+ "centred": "centered",
+ "centres": "centers",
+ "colour": "color",
+ "colours": "colors",
+ "coloured": "colored",
+ "behaviour": "behavior",
+ "behaviours": "behaviors",
+ "licence": "license",
+ "defence": "defense",
+ "grey": "gray",
+ "catalogue": "catalog",
+ "dialogue": "dialog",
+ "favourite": "favorite",
+ "favourites": "favorites",
+ "cancelled": "canceled",
+ "cancelling": "canceling",
+ "customise": "customize",
+ "customised": "customized",
+ "organise": "organize",
+ "organised": "organized",
+ "organising": "organizing",
+ "recognise": "recognize",
+ "recognised": "recognized",
+ "initialise": "initialize",
+ "analyse": "analyze",
+ "analysed": "analyzed",
+ "apologise": "apologize",
+ "programme": "program",
+ "whilst": "while",
+ "towards": "toward",
+ }
+
+ // Words, lowercased, with anything that is not a letter treated as
+ // a separator: the catalog's values carry apostrophes, ellipses and
+ // ordinary punctuation, and "couldn't" has to split into "couldn"
+ // and "t" rather than leaving a word glued to a mark and invisible
+ // to an exact-match lookup.
+ words := func(s string) []string {
+ return strings.FieldsFunc(strings.ToLower(s), func(r rune) bool {
+ return !unicode.IsLetter(r)
+ })
+ }
+
+ for key, value := range Catalog {
+ for _, w := range words(value) {
+ if us, ok := british[w]; ok {
+ t.Errorf("%s: %q is British English — write %q (this catalog is en-US; see discussion 31)", key, w, us)
+ }
+ }
+ }
+}