A locale on the profile, offering US and UK English open
Filed at Paul's request while shipping the toolbar fix, so the decision behind "Align center" is written down rather than folded into an unrelated branch.
What prompted it
I flagged that the alignment buttons read "Align left / Align centre / Align right" — British spelling in the label, center in the attribute, the CSS keyword and the command name. Paul's answer: the right fix is a locale on the user profile offering both US and UK English, and in the meantime the UI should be US English throughout.
So this discussion is the feature; the immediate spelling change ships separately and is not a substitute for it.
What already exists
The groundwork is better than I expected. Every user-facing string in the editor already goes through rastrillo.T(r, "<key>"), and the English text lives in one catalog in internal/docs/render.go. There is no string interpolation into that catalog and no copy embedded in the templates — the templates carry {{.Toolbar.AlignCenter}}, not the words. That means adding a second English is adding a second table plus a way to choose between them, not an extraction project.
Two things it does NOT already have:
- A selection mechanism.
rastrillo.Tresolves against whatever the request carries. Nothing in the docs app sets a locale on the request, and the person record has no locale field. - Any locale but one. The catalog is a bare
map[string]string, not keyed by locale.
What the work is
- A locale on the person record, defaulting to
en-US, withen-GBas the second value. Anything else is out of scope until there is a second language rather than a second spelling. - Keying the catalog by locale, with
en-USas the base anden-GBholding only the keys that actually differ — falling back to the base for everything else. Two full tables would drift the moment someone adds a string to one. - A control to change it. Where that lives is a design question, not settled here.
- A test that the fallback works: a key present only in the base resolves under
en-GBrather than rendering empty. That is the failure mode worth guarding — an empty label is invisible in review and obvious to a user.
What is deliberately not in it
- Framework locales. rastrillo's own locale support exists on its
mainbut not in the released version this app builds against, and the two are different things. Whichever way that lands, the catalog above is the app's copy, not the framework's. - Dates, numbers, currency. en-US and en-GB differ there too, and none of it is on screen yet.
internal/fonts'Licence(). British spelling, but it is a Go identifier and a panic string, not copy a user reads; the served path is alreadyLICENSE-OFL-1.1.txt. Renaming it is churn with no user-visible effect.
Right now
One string differs: docs.editor.toolbar.align.center reads "Align centre". A scan of the whole catalog, every Go string outside tests, and the templates' visible text found no other British spelling in anything a user reads. It becomes "Align center" today, and becomes the en-GB entry's value when this lands.