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>
146 lines
5.0 KiB
TypeScript
146 lines
5.0 KiB
TypeScript
import type { GlobalConfig } from 'payload'
|
|
|
|
import { globalVersions } from '../lib/payload-versions'
|
|
|
|
/**
|
|
* Mirrors ContactPageContent (proto/src/content/types.ts) — MITHOME-87.
|
|
*
|
|
* WHY `gdpr.label` textarea és nem richText: a JSON forrás egy kézzel
|
|
* beírt <a> taget tartalmazó HTML string (lásd contact.json). A lexical
|
|
* richText mező más (JSON node-fa) szerializációt használna, ami extra
|
|
* migrációs/render logikát igényelne — ezt itt, bootstrap szinten nem
|
|
* bontjuk ki, marad egyszerű (HTML-t tartalmazó) szöveg mező.
|
|
*/
|
|
export const Contact: GlobalConfig = {
|
|
slug: 'contact',
|
|
admin: {
|
|
group: 'Oldalak',
|
|
},
|
|
versions: globalVersions,
|
|
fields: [
|
|
{
|
|
name: 'meta',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'title', type: 'text', required: true, localized: true },
|
|
{ name: 'description', type: 'textarea', required: true, localized: true },
|
|
],
|
|
},
|
|
{
|
|
name: 'hero',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'title', type: 'text', required: true, localized: true },
|
|
{ name: 'subtitle', type: 'text', required: true, localized: true },
|
|
],
|
|
},
|
|
{
|
|
name: 'form',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'title', type: 'text', required: true, localized: true },
|
|
{ name: 'successMessage', type: 'text', required: true, localized: true },
|
|
{ name: 'errorMessage', type: 'text', required: true, localized: true },
|
|
{
|
|
name: 'fields',
|
|
type: 'group',
|
|
fields: [
|
|
{
|
|
name: 'name',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'label', type: 'text', required: true, localized: true },
|
|
{ name: 'placeholder', type: 'text', required: true, localized: true },
|
|
{ name: 'error', type: 'text', required: true, localized: true },
|
|
],
|
|
},
|
|
{
|
|
name: 'email',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'label', type: 'text', required: true, localized: true },
|
|
{ name: 'placeholder', type: 'text', required: true, localized: true },
|
|
{ name: 'errorRequired', type: 'text', required: true, localized: true },
|
|
{ name: 'errorInvalid', type: 'text', required: true, localized: true },
|
|
],
|
|
},
|
|
{
|
|
name: 'subject',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'label', type: 'text', required: true, localized: true },
|
|
{ name: 'placeholder', type: 'text', required: true, localized: true },
|
|
{ name: 'error', type: 'text', required: true, localized: true },
|
|
],
|
|
},
|
|
{
|
|
name: 'message',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'label', type: 'text', required: true, localized: true },
|
|
{ name: 'placeholder', type: 'text', required: true, localized: true },
|
|
{ name: 'errorRequired', type: 'text', required: true, localized: true },
|
|
{ name: 'errorMinLength', type: 'text', required: true, localized: true },
|
|
],
|
|
},
|
|
{
|
|
name: 'gdpr',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'label', type: 'textarea', required: true, localized: true },
|
|
{ name: 'error', type: 'text', required: true, localized: true },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{ name: 'submitButton', type: 'text', required: true, localized: true },
|
|
{ name: 'submittingButton', type: 'text', required: true, localized: true },
|
|
],
|
|
},
|
|
{
|
|
name: 'info',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'title', type: 'text', required: true, localized: true },
|
|
{
|
|
name: 'email',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'title', type: 'text', required: true, localized: true },
|
|
{ name: 'responseTime', type: 'text', required: true, localized: true },
|
|
],
|
|
},
|
|
{
|
|
name: 'company',
|
|
type: 'group',
|
|
fields: [{ name: 'title', type: 'text', required: true, localized: true }],
|
|
},
|
|
{
|
|
name: 'webmail',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'title', type: 'text', required: true, localized: true },
|
|
{ name: 'linkText', type: 'text', required: true, localized: true },
|
|
{ name: 'subtitle', type: 'text', required: true, localized: true },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{
|
|
name: 'faq',
|
|
type: 'group',
|
|
fields: [
|
|
{ name: 'title', type: 'text', required: true, localized: true },
|
|
{
|
|
name: 'items',
|
|
type: 'array',
|
|
fields: [
|
|
{ name: 'question', type: 'text', required: true, localized: true },
|
|
{ name: 'answer', type: 'textarea', required: true, localized: true },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
],
|
|
}
|