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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9b5ca94030
commit
829f543962
@@ -15,38 +15,38 @@ export const Services: GlobalConfig = {
|
||||
name: 'meta',
|
||||
type: 'group',
|
||||
fields: [
|
||||
{ name: 'title', type: 'text', required: true },
|
||||
{ name: 'description', type: 'textarea', required: true },
|
||||
{ name: 'ogDescription', type: 'textarea', required: true },
|
||||
{ name: 'title', type: 'text', required: true, localized: true },
|
||||
{ name: 'description', type: 'textarea', required: true, localized: true },
|
||||
{ name: 'ogDescription', type: 'textarea', required: true, localized: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'hero',
|
||||
type: 'group',
|
||||
fields: [
|
||||
{ name: 'title', type: 'text', required: true },
|
||||
{ name: 'subtitle', type: 'text', required: true },
|
||||
{ name: 'title', type: 'text', required: true, localized: true },
|
||||
{ name: 'subtitle', type: 'text', required: true, localized: true },
|
||||
],
|
||||
},
|
||||
{
|
||||
name: 'details',
|
||||
type: 'group',
|
||||
fields: [
|
||||
{ name: 'title', type: 'text', required: true },
|
||||
{ name: 'subtitle', type: 'text', required: true },
|
||||
{ name: 'title', type: 'text', required: true, localized: true },
|
||||
{ name: 'subtitle', type: 'text', required: true, localized: true },
|
||||
{
|
||||
name: 'services',
|
||||
type: 'array',
|
||||
fields: [
|
||||
{ name: 'icon', type: 'text', required: true },
|
||||
{ name: 'title', type: 'text', required: true },
|
||||
{ name: 'description', type: 'textarea', required: true },
|
||||
{ name: 'title', type: 'text', required: true, localized: true },
|
||||
{ name: 'description', type: 'textarea', required: true, localized: true },
|
||||
{
|
||||
name: 'specs',
|
||||
type: 'group',
|
||||
fields: [
|
||||
{ name: 'title', type: 'text', required: true },
|
||||
stringArrayField('items', 'Items'),
|
||||
{ name: 'title', type: 'text', required: true, localized: true },
|
||||
stringArrayField('items', 'Items', { localized: true }),
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -57,15 +57,15 @@ export const Services: GlobalConfig = {
|
||||
name: 'support',
|
||||
type: 'group',
|
||||
fields: [
|
||||
{ name: 'title', type: 'text', required: true },
|
||||
{ name: 'subtitle', type: 'text', required: true },
|
||||
{ name: 'title', type: 'text', required: true, localized: true },
|
||||
{ name: 'subtitle', type: 'text', required: true, localized: true },
|
||||
{
|
||||
name: 'channels',
|
||||
type: 'array',
|
||||
fields: [
|
||||
{ name: 'icon', type: 'text', required: true },
|
||||
{ name: 'title', type: 'text', required: true },
|
||||
{ name: 'description', type: 'text', required: true },
|
||||
{ name: 'title', type: 'text', required: true, localized: true },
|
||||
{ name: 'description', type: 'text', required: true, localized: true },
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -74,10 +74,10 @@ export const Services: GlobalConfig = {
|
||||
name: 'cta',
|
||||
type: 'group',
|
||||
fields: [
|
||||
{ name: 'title', type: 'text', required: true },
|
||||
{ name: 'subtitle', type: 'textarea', required: true },
|
||||
{ name: 'primaryButton', type: 'text', required: true },
|
||||
{ name: 'secondaryButton', type: 'text', required: true },
|
||||
{ name: 'title', type: 'text', required: true, localized: true },
|
||||
{ name: 'subtitle', type: 'textarea', required: true, localized: true },
|
||||
{ name: 'primaryButton', type: 'text', required: true, localized: true },
|
||||
{ name: 'secondaryButton', type: 'text', required: true, localized: true },
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user