Admin panel in English and Polish, reworded per docs/dev/admin-ux.md
- admin-i18n module: AdminText { en, pl }, component texts under the ipal
namespace (project translations win), en + pl admin languages when the
project sets none (project's supportedLanguages wins)
- every plugin label, description, option, tab and group as { en, pl };
explicit labels instead of auto-labels; sentence case; glossary terms
- visible renames (slugs, names, data unchanged): Cookie banner, Form
messages, Privacy group, Search engines, Maintenance, Spam protection,
E-mail sending, stats nav link Overview (hidden without access)
- Polish visitor defaults by page locale: cookie banner, form messages,
validators, lightbox, accessibility widget; {field} uses the label
- fixes: e-mail status banner used Turnstile wording; developer words and
env var names out of editor messages; stats numbers/dates in the admin
language; test e-mail no longer says ipal-kit
- test/adminUx.test.ts: length limits, en + pl present, no developer words
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
eeac33ed2f
commit
6b46bc0c14
@@ -1,7 +1,9 @@
|
||||
'use client'
|
||||
import { useConfig, useDocumentInfo, useFormFields, useLocale } from '@payloadcms/ui'
|
||||
import { useConfig, useDocumentInfo, useFormFields, useLocale, useTranslation } from '@payloadcms/ui'
|
||||
import { useEffect, useState } from 'react'
|
||||
|
||||
import { ipalT } from '../admin-i18n/t.js'
|
||||
|
||||
export type MetaDescriptionCheckProps = {
|
||||
/** An empty description is filled from the page content on save (autoFill). */
|
||||
autoFill?: boolean
|
||||
@@ -39,14 +41,15 @@ export function MetaDescriptionCheck({
|
||||
serverURL,
|
||||
},
|
||||
} = useConfig()
|
||||
const { t } = useTranslation()
|
||||
const [warning, setWarning] = useState<null | Warning>(null)
|
||||
|
||||
useEffect(() => {
|
||||
if (!description) {
|
||||
setWarning(
|
||||
autoFill
|
||||
? { text: 'Empty — on save it is filled from this page’s content. Writing your own is better.', tone: 'info' }
|
||||
: { text: 'Empty — the page gets the site-wide description, the same as every other page.', tone: 'warn' },
|
||||
? { text: ipalT(t, 'seoDescEmptyAutoFill'), tone: 'info' }
|
||||
: { text: ipalT(t, 'seoDescEmpty'), tone: 'warn' },
|
||||
)
|
||||
return
|
||||
}
|
||||
@@ -64,10 +67,7 @@ export function MetaDescriptionCheck({
|
||||
try {
|
||||
const settings = await get(`${base}/globals/${settingsSlug}?depth=0&locale=${locale}`)
|
||||
if (settings && norm(settings[siteDescriptionField]) === description) {
|
||||
setWarning({
|
||||
text: 'Same as the site-wide description. Google ignores a description repeated across pages — write one about this page.',
|
||||
tone: 'warn',
|
||||
})
|
||||
setWarning({ text: ipalT(t, 'seoDescSameAsSite'), tone: 'warn' })
|
||||
return
|
||||
}
|
||||
|
||||
@@ -82,10 +82,7 @@ export function MetaDescriptionCheck({
|
||||
const twin = (found?.docs as Record<string, unknown>[] | undefined)?.[0]
|
||||
if (twin) {
|
||||
const name = norm(twin[titleField]) || String(twin.id)
|
||||
setWarning({
|
||||
text: `Same description as “${name}”. Google ignores a description repeated across pages — make each one unique.`,
|
||||
tone: 'warn',
|
||||
})
|
||||
setWarning({ text: ipalT(t, 'seoDescSameAs', { name }), tone: 'warn' })
|
||||
return
|
||||
}
|
||||
setWarning(null)
|
||||
@@ -99,7 +96,7 @@ export function MetaDescriptionCheck({
|
||||
clearTimeout(timer)
|
||||
controller.abort()
|
||||
}
|
||||
}, [api, autoFill, collectionSlug, description, id, locale, serverURL, settingsSlug, siteDescriptionField, titleField])
|
||||
}, [api, autoFill, collectionSlug, description, id, locale, serverURL, settingsSlug, siteDescriptionField, t, titleField])
|
||||
|
||||
if (!warning) {return null}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user