Dictionary (Database Translations)
Moves static UI translation keys into a localized Payload collection that editors can manage and Next.js reads through a cached helper.
Installation
pnpm add payload-plugin-dictionary About
This plugin adds a `translations` collection to Payload, grouped under a "Dictionary" admin section. Each document holds a namespace (chosen from the list you pass to the plugin), a dot-separated key such as `auth.login_button`, and a localized `value` field. The goal is to move frontend microcopy like button labels, nav items, and error messages out of `en.json`-style files and into the admin panel, so editors can change them without a code deploy. On the Next.js side, the package exports a `getTranslations` helper and a `getDictionary` function from `payload-plugin-dictionary/cache`. These wrap database reads in `unstable_cache` under the tag `payload-translations`. An `afterChange` and `afterDelete` hook on the collection calls `revalidateTag` on that tag, so cached dictionaries refresh after an edit. The client entry point provides `DictionaryProvider` and a `useTranslations()` hook for Client Components. The `t` function supports `{var}` interpolation and a fallback string when a key is missing. The plugin also registers a `GET /api/dictionary/:namespace?locale=` REST endpoint with HTTP caching headers, and a `payload-dictionary` CLI that generates TypeScript types from the stored keys. There are some limits to be aware of. The plugin requires a namespaces array and throws at startup if it is empty. Key uniqueness is enforced in two places: the `key` field is marked unique, and a `beforeValidate` hook checks the `(namespace, key)` pair. Keys may not contain whitespace. The package targets Payload 3.90 or later, Next.js 15 or 16, and React 19. The `react` peer dependency is optional and only needed for the client helpers. Its `next-intl` and `i18next` compatibility is described in the README as a way to feed stored messages into those libraries.
Package info
- Package name
payload-plugin-dictionary- Latest version
1.0.0- Unpacked size
- 446 kB
- License
- MIT
- Last publish
- Oct 12, 2026
More from Mhmod-Hsn
View profileAdvanced Sidebar
Adds Lucide icons, custom groups, and custom nav links to the Payload admin sidebar without rewriting your collection config.
Dynamic RBAC
Adds database-backed roles and permissions to Payload, with optional row-level conditions edited in the admin UI.
Social Auth
Adds GitHub, Google, Facebook, Twitter, and LinkedIn OAuth login to the Payload admin sign-in screen.
Similar plugins
More in i18nTranslator
Translates localized Payload CMS content into any locale via pluggable providers, with document, bulk-collection, and per-field controls in the admin UI.
Auto Translate (LibreTranslate)
Translates Payload documents into target locales in the background using a self-hosted LibreTranslate server.
Translator
Translates localized text, richText, and textarea fields with AI into other locales, saving the result as drafts where versions are enabled.
Locale Snapshot
Prevents silent data loss of localized blocks and arrays in Payload CMS when saving a document in one locale with the PostgreSQL adapter.
Multilang
Polylang-style document localization for Payload CMS where each translation is its own document.
Translations
Manage UI translations in Payload CMS with automatic string collection.