feat(cms): enable Payload localization — hu default + en (MITHOME-110)
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
CI Pipeline with Test Management / 🧪 Run Tests & Generate Reports (push) Waiting to run
CI Pipeline with Test Management / 🐳 Docker Integration Tests (push) Blocked by required conditions
CI Pipeline with Test Management / 🏗️ Build Docker Image (push) Blocked by required conditions
CI Pipeline with Test Management / 📊 Generate Test Summary (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🧪 Run Tests & Generate Reports (push) Waiting to run
Test Reporting & Gherkin Analysis / 📊 Analyze Test Coverage (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / 🔄 Sync with Linear (push) Blocked by required conditions
Test Reporting & Gherkin Analysis / ⚡ Performance Monitoring (push) Blocked by required conditions
payload.config.ts: localization: { locales: ['hu','en'], defaultLocale:
'hu', fallback: true }. URL/routing side is separate (MITHOME-114).
Proved the mechanism on a real field rather than a throwaway one:
Common.buttons.* (contact/learnMore/webmail/sendMessage) marked
localized: true — these are genuinely translatable UI labels, so this
doubles as a first, correct slice of the full MITHOME-111 retrofit
instead of being disposable test scaffolding.
Gotcha discovered and documented in the migration script: marking an
existing field `localized: true` after data was already written non-
localized makes that value unreadable via `locale: defaultLocale` (the
storage shape changed) — the migration script must be re-run so it
gets rewritten under the localized shape. This will matter again for
the full MITHOME-111/112 retrofit.
Verified: Local API round-trip (set en, defaultLocale/hu re-seeded via
re-running the migration script) — hu reads "Kapcsolatfelvétel", en
reads "Contact". Real browser: admin UI locale switcher (hu/en) in the
top bar, fields show "— hu"/"— en" per-locale labels, switching
locale swaps the visible value correctly on the Common global editor.
build/lint/tsc/test (58 passed) all clean.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
1b587ac373
commit
6589289878
@@ -11,6 +11,14 @@
|
|||||||
* többször futtatható — mindig a JSON az aktuális "forrás igazság", felül-
|
* többször futtatható — mindig a JSON az aktuális "forrás igazság", felül-
|
||||||
* írja a Payload-ban lévő korábbi állapotot. NEM törli/nem érinti a JSON
|
* írja a Payload-ban lévő korábbi állapotot. NEM törli/nem érinti a JSON
|
||||||
* fájlokat.
|
* fájlokat.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
*/
|
*/
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
|
|||||||
@@ -1,6 +1,14 @@
|
|||||||
import type { GlobalConfig } from 'payload'
|
import type { GlobalConfig } from 'payload'
|
||||||
|
|
||||||
/** Mirrors CommonContent (proto/src/content/types.ts) — MITHOME-87. */
|
/**
|
||||||
|
* Mirrors CommonContent (proto/src/content/types.ts) — MITHOME-87.
|
||||||
|
*
|
||||||
|
* `buttons.*` localized: true (MITHOME-110) — ez a lokalizáció-mechanizmus
|
||||||
|
* bizonyítéka (admin nyelvváltó + Local/REST API locale param), és egyben
|
||||||
|
* előremutató, helyes darabja a MITHOME-111 teljes retrofitnak: ezek
|
||||||
|
* ténylegesen fordítandó UI-feliratok. A többi mező itt még nem lokalizált,
|
||||||
|
* azt a MITHOME-111 teljes körűen elvégzi.
|
||||||
|
*/
|
||||||
export const Common: GlobalConfig = {
|
export const Common: GlobalConfig = {
|
||||||
slug: 'common',
|
slug: 'common',
|
||||||
admin: {
|
admin: {
|
||||||
@@ -11,10 +19,10 @@ export const Common: GlobalConfig = {
|
|||||||
name: 'buttons',
|
name: 'buttons',
|
||||||
type: 'group',
|
type: 'group',
|
||||||
fields: [
|
fields: [
|
||||||
{ name: 'contact', type: 'text', required: true },
|
{ name: 'contact', type: 'text', required: true, localized: true },
|
||||||
{ name: 'learnMore', type: 'text', required: true },
|
{ name: 'learnMore', type: 'text', required: true, localized: true },
|
||||||
{ name: 'webmail', type: 'text', required: true },
|
{ name: 'webmail', type: 'text', required: true, localized: true },
|
||||||
{ name: 'sendMessage', type: 'text', required: true },
|
{ name: 'sendMessage', type: 'text', required: true, localized: true },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,6 +11,9 @@
|
|||||||
* feltetelek).
|
* feltetelek).
|
||||||
* MITHOME-89: Partners + Media collection (MVP — feltöltés, a vágás/
|
* MITHOME-89: Partners + Media collection (MVP — feltöltés, a vágás/
|
||||||
* áttetszővé tétel szerkesztő külön, MITHOME-118).
|
* áttetszővé tétel szerkesztő külön, MITHOME-118).
|
||||||
|
* MITHOME-110: lokalizáció bekapcsolva (hu alapértelmezett, en). A mezőnkénti
|
||||||
|
* `localized: true` retrofit a Globals/LegalPages configokon külön ticket
|
||||||
|
* (MITHOME-111/112) — ez a ticket csak magát a mechanizmust kapcsolja be.
|
||||||
*/
|
*/
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { fileURLToPath } from 'url'
|
import { fileURLToPath } from 'url'
|
||||||
@@ -45,6 +48,15 @@ export default buildConfig({
|
|||||||
|
|
||||||
globals: [Home, About, Services, Contact, Common],
|
globals: [Home, About, Services, Contact, Common],
|
||||||
|
|
||||||
|
// MITHOME-109/110: hu alapértelmezett (URL-prefix nélkül), en /en/ alatt
|
||||||
|
// (Next.js routing oldala: MITHOME-114). fallback:true -> amíg egy mezőnek
|
||||||
|
// nincs angol fordítása, a magyar érték jelenik meg — nem üres oldal.
|
||||||
|
localization: {
|
||||||
|
locales: ['hu', 'en'],
|
||||||
|
defaultLocale: 'hu',
|
||||||
|
fallback: true,
|
||||||
|
},
|
||||||
|
|
||||||
secret: process.env.PAYLOAD_SECRET || '',
|
secret: process.env.PAYLOAD_SECRET || '',
|
||||||
|
|
||||||
typescript: {
|
typescript: {
|
||||||
|
|||||||
Reference in New Issue
Block a user