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,12 +21,14 @@
|
||||
* script eredménye mindig publikált tartalom legyen, sosem draft.
|
||||
*
|
||||
* MITHOME-110 tapasztalat: ha egy mezőt utólag `localized: true`-ra
|
||||
* állítasz (MITHOME-111/112 retrofit), a korábban beírt érték a régi,
|
||||
* nem-lokalizált tárolási alakban marad, és `locale: defaultLocale`-lal
|
||||
* nem olvasható vissza (üresnek látszik) — ilyenkor ezt a scriptet újra
|
||||
* kell futtatni, hogy a defaultLocale (hu) alá újra beírja az értéket a
|
||||
* lokalizált alakban. Explicit `locale` paramétert egyik updateGlobal/
|
||||
* update hívás sem ad meg itt, ezért mindig a `defaultLocale` (hu) alá ír.
|
||||
* állítasz, a korábban beírt érték a régi, nem-lokalizált tárolási alakban
|
||||
* marad, és `locale: defaultLocale`-lal nem olvasható vissza (üresnek
|
||||
* látszik). MITHOME-111 óta ezt NEM ennek a scriptnek az újrafuttatásával
|
||||
* kezeljük (az felülírná az admin-szerkesztéseket), hanem Payload
|
||||
* migrációval (src/migrations/, prodMigrations) — egy újabb retrofitnál
|
||||
* (pl. MITHOME-112) is új migráció kell, a src/lib/localize-paths.ts
|
||||
* helperekkel. Explicit `locale` paramétert egyik updateGlobal/update hívás
|
||||
* sem ad meg itt, ezért mindig a `defaultLocale` (hu) alá ír.
|
||||
*/
|
||||
import path from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
|
||||
Reference in New Issue
Block a user