feat(cms): English translation status with a public gate (MITHOME-113)
Every page global and legal page gets a shared "English translation status" sidebar field (none / AI draft awaiting review / approved). The content adapter reads through readGated(): an English page renders English text only when its translation is approved, otherwise the Hungarian text of the same page, while links keep resolving to /en/... Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
0eb6594acc
commit
32b6643fbc
@@ -0,0 +1,35 @@
|
||||
import type { SelectField, SelectFieldSingleValidation } from 'payload'
|
||||
|
||||
import { EN_TRANSLATION_STATUSES, type EnTranslationStatus } from '../../lib/translation-gate'
|
||||
|
||||
const LABELS: Record<EnTranslationStatus, string> = {
|
||||
none: 'Nincs fordítás',
|
||||
'ai-draft': 'AI-draft, átnézésre vár',
|
||||
approved: 'Jóváhagyva',
|
||||
}
|
||||
|
||||
/**
|
||||
* MITHOME-113: English translation status of a page, shown in the admin
|
||||
* sidebar. The public English page only shows English content once this is
|
||||
* "approved" (src/lib/translation-gate.ts); until then it shows Hungarian.
|
||||
*
|
||||
* WHY not localized: only English has a translation status — a localized
|
||||
* field would show a meaningless value in the Hungarian (source) view.
|
||||
* `validate` lets LegalPages add its multi-model validation rule.
|
||||
*/
|
||||
export function translationStatusField(validate?: SelectFieldSingleValidation): SelectField {
|
||||
return {
|
||||
name: 'enTranslationStatus',
|
||||
label: 'Angol fordítás állapota',
|
||||
type: 'select',
|
||||
defaultValue: 'none',
|
||||
options: EN_TRANSLATION_STATUSES.map((value) => ({ label: LABELS[value], value })),
|
||||
...(validate ? { validate } : {}),
|
||||
admin: {
|
||||
position: 'sidebar',
|
||||
description:
|
||||
'Az angol oldal csak „Jóváhagyva” állapotban jelenik meg; addig a látogatók a magyar szöveget látják. ' +
|
||||
'Az AI-draft gépi fordítás: jóváhagyás előtt ellenőrizni és szükség szerint javítani kell.',
|
||||
},
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user