diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b8c250c..bcc97b0f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,27 @@ exact tag (`ghcr.io/calnode/calnode:0.1.0`) if you need stability between upgrad ## [Unreleased] +### Added + +- **German without du or Sie (`de-x-neutral`).** An opt-in wording variant of the German + booker catalogue that addresses nobody: "Tag auswählen" rather than "Wählen Sie einen + Tag". It is for operators whose own site is informal, where the formal widget stands out + and an informal one would be wrong for everyone else. `de` is unchanged and stays formal. + The variant is never offered in the language switcher or matched from `Accept-Language`; + select it with `?lang=de-x-neutral` or ``. + +### Fixed + +- **Buttons and inputs in the booking UI now use the surrounding font.** Form controls + take their font family from the browser stylesheet, so day cells, time slots and the + confirm button rendered in the system font beside text in the page font. An embedder who + set `calnode-booking { font-family: … }` got the brand font everywhere except on the + controls. Sizes, weights and control heights are unchanged. +- **The embed widget's `lang` attribute accepts hyphenated locales.** The widget trimmed + the attribute to its primary subtag before sending it, so `lang="fr-CA"` loaded France + French. The attribute is now sent whole and the server falls back to the primary + language when there is no exact match, so `lang="de-DE"` still selects German. + ## [0.14.0] - 2026-11-08 ### Added diff --git a/cmd/i18n-coverage/main.go b/cmd/i18n-coverage/main.go index 0f13662c..da1247fd 100644 --- a/cmd/i18n-coverage/main.go +++ b/cmd/i18n-coverage/main.go @@ -99,7 +99,7 @@ func report(root string, c catalogue) error { sort.Slice(rows, func(i, j int) bool { return rows[i].code < rows[j].code }) fmt.Printf("%s\n %s (source %s.json, %d keys)\n\n", c.name, c.dir, sourceCode, len(source)) - fmt.Printf(" %-7s %6s %8s %10s %8s\n", "code", "keys", "coverage", "status", "unknown") + fmt.Printf(" %-12s %6s %8s %10s %8s\n", "code", "keys", "coverage", "status", "unknown") for _, r := range rows { status := "source" switch { @@ -108,10 +108,13 @@ func report(root string, c catalogue) error { status = "has unknown keys" case c.floor > 0 && r.cover < c.floor: status = "withheld" + case i18n.IsOptInVariant(r.code): + // Complete, but a wording variant: reachable by code only, never offered. + status = "opt-in" default: status = "offered" } - fmt.Printf(" %-7s %6d %7.0f%% %10s %8d\n", r.code, r.keys, r.cover*100, status, r.unknown) + fmt.Printf(" %-12s %6d %7.0f%% %10s %8d\n", r.code, r.keys, r.cover*100, status, r.unknown) } if c.floor > 0 { fmt.Printf("\n floor: %.0f%% (below it a language is not offered; ?lang= still works)\n", c.floor*100) diff --git a/docs/i18n-glossary.md b/docs/i18n-glossary.md index 2ee884b5..e3fb0cef 100644 --- a/docs/i18n-glossary.md +++ b/docs/i18n-glossary.md @@ -46,6 +46,12 @@ not have to invent terminology that is already decided. The existing booker locales are deliberately split by market: `fr`/`de`/`it`/`pt` formal, `es`/`nl`/`sv` informal. Match the language, not the English. +`de-x-neutral` is the one exception, and it is a third option rather than a change of side: +German with no address at all (infinitive and nominal style, "Tag auswählen"), for +operators whose own site does not say *Sie*. It is opt-in and never offered to visitors, so +`de` remains the formal default. When a string changes in `de.json`, change it in +`de-x-neutral.json` too, without the pronoun. + ## Things that are not translated Brand names, URLs, protocol tokens (`STARTTLS`, `RSVP`, `PII`), third-party console labels diff --git a/internal/handler/embed.js b/internal/handler/embed.js index e45944a3..a9cceccb 100644 --- a/internal/handler/embed.js +++ b/internal/handler/embed.js @@ -33,9 +33,12 @@ // the /public call, matching the ?lang= override semantics on book.html/manage.html. // /public returns the resolved {locale, i18n} once; cached on the instance and reused // by every subsequent render, not refetched per-request. + // The attribute is sent whole: the server tries the exact code first and then the + // primary language (i18n.getOverride), so lang="de-DE" still selects de while + // lang="fr-CA" and lang="de-x-neutral" select their own catalogues. Trimming to the + // primary subtag here made those two unreachable from the widget. function langOverride(el) { - var v = el.getAttribute('lang'); - return v ? v.split('-')[0] : ''; + return el.getAttribute('lang') || ''; } // t: pure lookup, not a method — mirrors internal/i18n.Locale.T (falls back to the // key itself if the string table hasn't loaded yet or the key is missing). diff --git a/internal/handler/embed_handler_test.go b/internal/handler/embed_handler_test.go index 42654eb6..a0608fe7 100644 --- a/internal/handler/embed_handler_test.go +++ b/internal/handler/embed_handler_test.go @@ -87,3 +87,12 @@ func TestBookingCSS_cacheModes(t *testing.T) { t.Errorf("versioned Cache-Control = %q, want immutable", cc) } } + +// Form controls take their font family from the UA stylesheet unless told otherwise, so +// without this rule every button in the widget ignores the font the embedding page set +// on . Nothing else in the suite renders CSS, so pin the rule itself. +func TestBookingCSS_controlsInheritFontFamily(t *testing.T) { + if !strings.Contains(string(bookingCSS), "button, input, select, textarea { font-family: inherit; }") { + t.Error("booking.css no longer makes form controls inherit font-family; buttons fall back to the UA font inside the embed widget") + } +} diff --git a/internal/handler/templates/booking.css b/internal/handler/templates/booking.css index 412be3f8..c0ded652 100644 --- a/internal/handler/templates/booking.css +++ b/internal/handler/templates/booking.css @@ -10,6 +10,15 @@ * padding removes default
    /

    /

    spacing (component rules below set their own). */ *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } +/* Form controls do not inherit the font family: the UA stylesheet gives