docs(35): decision note superseding D-05 and the locale switcher contract

This commit is contained in:
Jakub Zych
2026-11-13 20:42:06 +01:00
parent e114492bbe
commit 1173a5c5a2
2 changed files with 70 additions and 8 deletions

View File

@@ -282,8 +282,9 @@ Both codes go in the existing permission tab `permissions.tab_system` ("System")
| Column / search: code | `mail.code` | Code | Kod |
| Column: subject | `mail.template.subject` | Subject | Temat |
| Column: description | `mail.template.description` | Description | Opis |
| Column / filter: locale | `mail.template.locale` | Locale | Język |
| Locale value for a file without a suffix | `mail.template.locale_default` | Default | Domyślny |
| Column / filter: locale (superseded by C16: no locale column or filter) | `mail.template.locale` | Locale | Język |
| Locale value for a file without a suffix (superseded by C16: now the Default label of the switcher and of Customized locales) | `mail.template.locale_default` | Default | Domyślny |
| Column: customized locales (C16) | `mail.template.customized_locales` | Customized locales | Dostosowane języki |
| Column: layout | `mail.template.layout` | Layout | Układ |
| Column (invisible): customized at | `mail.customized_at` | Customized | Dostosowano |
| Column: name (layouts, partials) | `mail.name_field` | Name | Nazwa |
@@ -659,7 +660,7 @@ Partials list: `title: mail.partial.list_title`, `toolbar.buttons: []`, no check
- messages `update: mail.template.name`, `saved: messages.form.saved`;
- Save and close returns to the list.
Record title (h1, breadcrumb, `:name`): the template code, for example `golem15.user::mail.activate-en` (truncated). Subtitle: `mail.template.name`.
Record title (h1, breadcrumb, `:name`): the template code, for example `golem15.user::mail.activate-en` (truncated). Subtitle: `mail.template.name`. (superseded by C16: the title is the template's base code, `golem15.user::mail.activate`, for every locale version.)
| Field | Type | Span | Tab | Notes |
|-------|------|------|-----|-------|
@@ -681,10 +682,10 @@ Templates list (`config_list.yaml`):
| Column | Type | Visible | Searchable / sortable | Notes |
|--------|------|---------|----------------------|-------|
| `code` | text | yes | searchable, sortable | First column; carries the badges. The default sort is `code` ascending, so a base template and its locale variants sit together (D-05: separate rows, no grouping) |
| `code` | text | yes | searchable, sortable | First column; carries the badges. The default sort is `code` ascending, so a base template and its locale variants sit together (D-05: separate rows, no grouping; superseded by C16: one row per template) |
| `subject` | text | yes | searchable | The effective subject (the override's, if any) |
| `description` | text | yes | searchable | From the file |
| `locale` | text | yes | sortable | The suffix (`en`), or `mail.template.locale_default` for a file without a suffix |
| `locale` | text | yes | sortable | The suffix (`en`), or `mail.template.locale_default` for a file without a suffix (superseded by C16: replaced by `customized_locales`) |
| `layout` | text | yes | — | The effective layout's name |
| `customized_at` | datetime | invisible | sortable | |
@@ -692,7 +693,7 @@ Filters (existing `scope` type with options, like the 19.6.1 `trashed` filter):
| Scope | Label | Options |
|-------|-------|---------|
| `locale` | `mail.template.locale` | `default` (`mail.template.locale_default`) plus one option per suffix found in the catalog, labelled with the suffix |
| `locale` | `mail.template.locale` | `default` (`mail.template.locale_default`) plus one option per suffix found in the catalog, labelled with the suffix (superseded by C16: the locale filter is removed) |
| `status` | `mail.filter_status` | `customized`, `not_customized`, `outdated` (labels `mail.filter_customized`, `mail.filter_not_customized`, `mail.filter_outdated`) |
### C7. Info and File version partials (server-rendered, `.summer-partial`)
@@ -882,6 +883,33 @@ Five `pact.SettingsItem` entries in category `backend::lang.settings.category_ma
Note: the delete refusal must be a `ForbiddenError` with `Message` set. The SPA delete toast reads `error.message`, and a `ValidationError` would show "Validation failed" (the same finding as 19.6.1 C8).
### C16. Template locale switcher (gap closure G-35-1, supersedes the D-05 parts of C3b)
Decision note: `.planning/notes/2026-11-13-mail-template-locale-groups.md`. A mail template is one record; its locale versions (rows grouped by `base_code`) are opened through a switcher in the template form.
**Markup** (`admin/src/components/form/LocaleVariantSwitcher.vue`): a labelled native select, classes copied from MLField's locale select (`rounded-control border border-border-strong bg-surface px-2 py-1 text-[13px]`), attribute `data-locale-variant` on the select, a `<label for>` with `form.locale_variant` (`text-[13px] text-muted`). One option per variant; the option text is the label, or "Label — state, state" when the version has states (the server's translated `mail.state_customized`, `mail.state_outdated`). The current version is selected.
**Data:** `meta.localeVariants` on the show and update responses (`cabana.RecordMeta.LocaleVariants`): `{id, locale, label, states, current}` per version, labels and states already translated. Other controllers send no key.
**Placement:** the form header, under the title (and subtitle), only when there are two or more versions and the record has loaded.
**Navigation:** choosing a version router-pushes the same route with that version's id (FormView remounts with a fresh load). The navigation goes through FormView's existing `onBeforeRouteUpdate` unsaved-changes confirm (`form.unsaved_confirm`); when it is refused the select returns to the open version.
**Variant order:** Default (the template's own file, label `mail.template.locale_default`), then by locale code: every locale with its own file, every other application locale except the default (no file: a fallback row), and any customized version of a locale that is no longer enabled. A template whose base ships no file has no Default.
**Locale without a file:** until it is customized its form shows what that locale sends now, the default version (the base's customization when there is one). Saving creates its own customized version; Reset to file version returns it to the default version; File changed shows when the base file changes.
**List changes:** one row per template (the base's row, or the lowest variant when only variants ship); the `locale` column is replaced by `customized_locales` (Default, then the locale codes of the customized versions, at most three then "+N"; empty when none); the Customized / File changed badges and the status filter apply to the whole template (any version); the locale filter is removed.
**Info lines** (`_info.htm`, only for a template with two or more versions): on Default `mail.info_locale_default`; on a locale without a file `mail.info_locale_fallback` with `:locale`, and the file line names the base file.
| Element | Key | EN | PL |
|---------|-----|----|----|
| Switcher label | `form.locale_variant` | Language | Język |
| List column | `mail.template.customized_locales` | Customized locales | Dostosowane języki |
| Info line, Default version | `mail.info_locale_default` | Default version: sent for every locale that has neither its own file nor a customized version. | Wersja domyślna: wysyłana dla każdego języka, który nie ma własnego pliku ani dostosowanej wersji. |
| Info line, locale without a file | `mail.info_locale_fallback` | Locale :locale has no file of its own. Until you customize it, the default version is sent. | Język :locale nie ma własnego pliku. Dopóki go nie dostosujesz, wysyłana jest wersja domyślna. |
---
## UI Considerations
@@ -895,9 +923,10 @@ Applicable state considerations resolved: 48 rows (42 covered, 6 backstop, 0 unr
| empty | Partials list | ✅ covered | `mail.partial.list_empty`; the built-in button/panel/table partials mean the unfiltered list is never empty |
| loading | All lists, forms, Branding, Mail images | ✅ covered | Existing skeletons and disabled footers in ListView/FormView/SettingsFormView; no new loading UI |
| error | All lists, forms, Branding, Mail images | ✅ covered | Existing `list.load_failed` / `form.load_failed` alerts |
| populated | Templates list | ✅ covered | Code, subject, description, locale, layout; base and locale variants adjacent by code sort; badges after the code |
| populated | Templates list | ✅ covered | Code, subject, description, locale, layout; base and locale variants adjacent by code sort; badges after the code (superseded by C16: one row per template, Customized locales instead of locale, grouped badges) |
| partial | Templates list (mixed states) | ✅ covered | Not-customized rows have no badge; customized rows show "Customized"; drifted rows show "Customized" + "File changed", in fixed order, as text (WCAG 1.4.1) |
| zero-one-many | Locale filter | ✅ covered | The options are `Default` plus one per suffix in the catalog. An app with no locale variants shows only `Default` |
| zero-one-many | Locale filter | ✅ covered | The options are `Default` plus one per suffix in the catalog. An app with no locale variants shows only `Default` (superseded by C16: the locale filter is removed) |
| zero-one-many | Template locale switcher (C16) | ✅ covered | Shown from two versions; a template with one version (no locale variants, one mail locale) shows no switcher. A 50-locale site lists 50 entries in one native select, not 50 list rows |
| overflow | All lists | ✅ covered | Existing pagination (20 per page) and horizontal table scroll; long codes truncate in the first column, with the badges kept (`shrink-0`) |
| long-text | Template code in the form header and breadcrumb | ✅ covered | The h1 truncates (existing `truncate`); the full code also appears in `_info` as `code`, which wraps (`overflow-wrap:anywhere` inherited from `.summer-partial`) |
| populated | Template form, not customized | ✅ covered | Filled from the file; `_info` says "Not customized…"; no Reset in the footer; Save creates the override |