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
@@ -21,6 +21,8 @@
|
||||
* nyers, Payload-on kívüli Mongo collection-be (`contact_submissions`,
|
||||
* proto/src/lib/mongodb.ts) írt, amit az ügyfél nem látott sehol az admin
|
||||
* felületen. Mostantól Payload collection, a route.ts a Local API-n ír bele.
|
||||
* MITHOME-111: a Globals fordítható mezői lokalizáltak; a meglévő adatot a
|
||||
* src/migrations/20260929_localize_globals.ts alakítja át (prodMigrations).
|
||||
*/
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
@@ -39,6 +41,7 @@ import { About } from './globals/About'
|
||||
import { Services } from './globals/Services'
|
||||
import { Contact } from './globals/Contact'
|
||||
import { Common } from './globals/Common'
|
||||
import { migrations } from './migrations'
|
||||
|
||||
const filename = fileURLToPath(import.meta.url)
|
||||
const dirname = path.dirname(filename)
|
||||
@@ -81,6 +84,10 @@ export default buildConfig({
|
||||
|
||||
db: mongooseAdapter({
|
||||
url: process.env.MONGODB_URI || '',
|
||||
// MITHOME-111: pending migrations run automatically on production
|
||||
// startup (NODE_ENV=production — staging + prod containers), so a deploy
|
||||
// never serves the localized schema on un-migrated data.
|
||||
prodMigrations: migrations,
|
||||
}),
|
||||
|
||||
// WHY: Payload sends anonymous usage telemetry to its own servers by
|
||||
|
||||
Reference in New Issue
Block a user