feat(mail): one admin record per mail template with a locale switcher

Gap G-35-1 (supersedes D-05), tracer slice:
- postcard: migration 202611130001_mail_template_base_code (base_code
  column and index); SyncIndex writes base_code; EnsureLocaleRows creates
  the <template>-<locale> rows of locales that ship no file; TemplateBase
  and Catalog.TemplateFor; send, preview and validation resolve a missing
  <template>-<locale> to the locale's customization, else the base's
  customization, else the base file. Names with their own file send as
  before.
- cabana: mail locales are the translator's plus the TranslationWriter's
  enabled locales; sync ensures the locale rows and re-syncs when the
  locale set changes; record lookups admit fallback-locale rows; the
  record title is the base code; RecordMeta.LocaleVariants
  (RecordLocaleVariant) on the show and update responses.
- admin: LocaleVariantSwitcher in the update form header, from
  meta.localeVariants, behind the unsaved-changes confirm.
- tests: TestMailOverrideSmoke/locale_fallback,
  TestMailScreensSmoke/locales, LocaleVariantSwitcher.test.ts.
This commit is contained in:
Jakub Zych
2026-11-13 20:29:42 +01:00
parent 9afe95ccef
commit 52c9c7eb18
22 changed files with 920 additions and 63 deletions

View File

@@ -2885,6 +2885,36 @@
],
"type": "object"
},
"cabana.RecordLocaleVariant": {
"properties": {
"current": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"label": {
"type": "string"
},
"locale": {
"type": "string"
},
"states": {
"items": {
"type": "string"
},
"type": "array"
}
},
"required": [
"current",
"id",
"label",
"locale",
"states"
],
"type": "object"
},
"cabana.RecordMeta": {
"properties": {
"actions": {
@@ -2906,6 +2936,13 @@
},
"type": "object"
},
"localeVariants": {
"description": "LocaleVariants are the locale versions of the record for the update\nform's locale switcher, in display order. Only the show and update\nresponses of a controller whose records have locale versions (the mail\ntemplates screen) carry it; it is omitted otherwise.",
"items": {
"$ref": "#/components/schemas/cabana.RecordLocaleVariant"
},
"type": "array"
},
"notices": {
"items": {
"$ref": "#/components/schemas/cabana.FieldNotice"