Files
websitedev/openspec/changes/localize-globals-mithome-111/specs/content-management/spec.md
T
Do SikiandClaude Opus 5.5 829f543962 feat(cms): localize translatable Globals fields with lossless migration (MITHOME-111)
Mark every translatable text/textarea field of the Home, About, Services,
Contact and Common globals as localized. Icons, row ids, the external
flag and the postal address stay shared; CTA hrefs are localized because
internal routes differ per locale. String lists (paragraphs, bullets,
features, spec items) are localized at array level so locales can have
different item counts; structured rows share order/icons and localize
only their inner text.

Existing data is not re-seeded (that would overwrite admin edits): a
Payload migration wraps legacy values into { hu: value } on the published
global and every draft/version record, idempotently, and runs on
production startup via prodMigrations. Paths are derived from the Global
configs themselves so the migration cannot drift from the schema.

OpenSpec change: openspec/changes/localize-globals-mithome-111

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 00:52:26 +02:00

62 lines
2.8 KiB
Markdown

# Spec Delta
## ADDED Requirements
### Requirement: Localized page globals
The Home, About, Services, Contact, and Common globals SHALL store every translatable
text value (titles, subtitles, descriptions, body paragraphs, labels, button texts,
form messages, FAQ entries, metadata, and locale-dependent link targets) separately per
locale. Structural values (icons, row identifiers, the external-link flag, and the
postal address) SHALL be shared across locales. List items that consist of a single
text value (paragraph lists, bullet lists, feature lists, specification item lists)
SHALL be editable per locale, including a different number of items per locale. For
lists of structured rows, the row count, order, and structural values SHALL be shared
across locales, and only the text values within each row SHALL be localized.
#### Scenario: An administrator saves an English value
- **WHEN** an administrator edits a translatable global field in the `en` locale and
publishes it
- **THEN** the English public page SHALL render the English value and the Hungarian
public page SHALL continue to render the unchanged Hungarian value
#### Scenario: An administrator changes a shared structural value
- **WHEN** an administrator changes a structural value such as an icon in either locale
- **THEN** both locales SHALL render the changed value
#### Scenario: A paragraph list differs between locales
- **WHEN** the Hungarian version of a paragraph list has three items and the English
version has two
- **THEN** each locale's public page SHALL render exactly its own items
### Requirement: Lossless locale migration of existing content
When a previously non-localized global field becomes localized, its existing value
SHALL be preserved as the Hungarian value, including values edited by administrators
after the initial content import. The migration SHALL cover published content, saved
drafts, and version history, SHALL NOT overwrite existing content with seed data, and
SHALL be safe to run more than once. Deployed environments SHALL apply the migration
without a manual step.
#### Scenario: Deploy onto a database with administrator edits
- **WHEN** the localized configuration is deployed onto a database whose globals were
edited in the admin after the initial import
- **THEN** after startup the Hungarian public pages SHALL render the edited values
unchanged, and the English public pages SHALL render the same values through fallback
#### Scenario: Restore an older version after migration
- **WHEN** an administrator opens or restores a global version saved before the
migration
- **THEN** the version SHALL show its original text as the Hungarian value rather than
empty fields
#### Scenario: Migration runs a second time
- **WHEN** the migration is executed on already migrated data
- **THEN** stored values SHALL remain unchanged