Docs: admin languages and texts, wording rule for agents, new screen names
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
6b46bc0c14
commit
0a2374db18
@@ -375,6 +375,45 @@ export const config = { matcher: ['/((?!api|admin|_next|.*\\..*).*)'] }
|
||||
Use `DEFAULT_PROXY_MATCHER` as a reference value, but if Next complains
|
||||
about the matcher — paste it inline. This is a Next limitation, not a plugin one.
|
||||
|
||||
## Admin panel languages and texts
|
||||
|
||||
The site's content languages (`i18n.locales`) and the **admin panel's** language are
|
||||
separate. The panel's language is what each user picks in *Account → Language*.
|
||||
|
||||
- **Default:** when the project's `buildConfig` has no `i18n.supportedLanguages`, ipal-kit
|
||||
sets English and Polish. A project that sets its own list keeps it, untouched:
|
||||
|
||||
```ts
|
||||
import { en } from 'payload/i18n/en'
|
||||
import { de } from 'payload/i18n/de'
|
||||
|
||||
export default buildConfig({ i18n: { supportedLanguages: { en, de } }, /* … */ })
|
||||
```
|
||||
|
||||
- **Field and global texts** the plugin ships (labels, descriptions, options, tabs, groups)
|
||||
are `{ en, pl }` objects (type `AdminText`). Change one through the override options —
|
||||
`globalOverrides`, `collectionOverrides` — like any other field setting.
|
||||
- **Component texts** (statistics view, test e-mail, integration alerts, cookie scan…) live in
|
||||
`adminTexts` (`{ en: {…}, pl: {…} }`) and are read through Payload's translations under
|
||||
the `ipal` namespace. Override any key per language; your value wins:
|
||||
|
||||
```ts
|
||||
export default buildConfig({
|
||||
i18n: { translations: { pl: { ipal: { statsHeading: 'Ruch na stronie' } } } },
|
||||
})
|
||||
```
|
||||
|
||||
A language the plugin has no texts for (e.g. `de`) gets the English ones until you
|
||||
add yours.
|
||||
- **Building blocks** for your own admin components: `ipalT(t, key, vars)` reads a plugin
|
||||
text through Payload's `t`; `formatNumber(n, language)` and `formatDateTime(iso, language, timeZone?)`
|
||||
format in the admin language; `defineTexts({ en, pl })` declares a text set whose Polish keys
|
||||
must match the English ones; `ADMIN_LANGUAGES` lists the plugin's languages;
|
||||
`applyAdminI18n(config)` is the config step itself (already applied by `ipalKit`).
|
||||
- **Wording rules** for every label you add: [dev/admin-ux.md](./dev/admin-ux.md).
|
||||
- **Verify:** switch *Account → Language* to Polski — every plugin global, collection and
|
||||
view reads in Polish; `pnpm test` runs `test/adminUx.test.ts` in the plugin.
|
||||
|
||||
## Turn off, override, extend
|
||||
|
||||
- `i18n` is required — the module cannot be turned off; one language = mode without the `/pl` prefix.
|
||||
@@ -382,3 +421,4 @@ about the matcher — paste it inline. This is a Next limitation, not a plugin o
|
||||
- Proxy: `createProxy` with options (`consentCategory`, `cookieName`, `exposeHeaders`, `markdown`, `policyVersion`) or your own proxy on `createLocaleMiddleware` + `negotiateLocale` / `matchAcceptLanguage`.
|
||||
- Switcher: `LanguageSwitcher` (`classNames`, `renderLabel`) or your own on `useAlternateLinks()`.
|
||||
- Paths: `buildLocalizedPath` / `switchLocalePath` with `homeSlug` and `prefix` — for your own link helpers.
|
||||
- Admin languages: your own `i18n.supportedLanguages` wins over the plugin's en + pl default; component texts via `i18n.translations.<lang>.ipal.<key>`.
|
||||
|
||||
Reference in New Issue
Block a user