Adds a single localized global to Payload where each scope becomes an admin tab and a nested API property. Developers define scopes and string keys in plugin config, and editors translate them per locale. Helper functions resolve keys like general.cancelButton across all locales in one query, falling back to a developer-defined default value. Requires Payload localization to be configured and Payload 4.
Developer-defined UI strings global for Payload CMS with scoped tabs and localized text fields.
Installation
npm i @sittari/payload-strings0
Stars
0
Forks
0
Open Issues
2 months ago
Last Updated
13
Weekly Downloads
v0.2.0
npm Version
35.0 KB
Unpacked Size
0
Dependencies
00 since Sep 6
| Date | Stars |
|---|---|
| Dec 5, 2026 | 0 |
| Dec 4, 2026 | 0 |
| Dec 3, 2026 | 0 |
| Dec 2, 2026 | 0 |
| Dec 1, 2026 | 0 |
| Nov 30, 2026 | 0 |
| Nov 29, 2026 | 0 |
| Nov 28, 2026 | 0 |
| Nov 27, 2026 | 0 |
| Nov 26, 2026 | 0 |
| Nov 25, 2026 | 0 |
| Nov 24, 2026 | 0 |
| Nov 23, 2026 | 0 |
| Nov 22, 2026 | 0 |
| Nov 21, 2026 | 0 |
| Nov 20, 2026 | 0 |
| Nov 19, 2026 | 0 |
| Nov 18, 2026 | 0 |
| Nov 17, 2026 | 0 |
| Nov 16, 2026 | 0 |
| Nov 15, 2026 | 0 |
| Nov 14, 2026 | 0 |
| Nov 13, 2026 | 0 |
| Nov 12, 2026 | 0 |
| Nov 11, 2026 | 0 |
| Nov 10, 2026 | 0 |
| Nov 9, 2026 | 0 |
| Nov 8, 2026 | 0 |
| Nov 7, 2026 | 0 |
| Nov 6, 2026 | 0 |
| Nov 5, 2026 | 0 |
| Nov 4, 2026 | 0 |
| Nov 3, 2026 | 0 |
| Nov 2, 2026 | 0 |
| Nov 1, 2026 | 0 |
| Oct 31, 2026 | 0 |
| Oct 30, 2026 | 0 |
| Oct 29, 2026 | 0 |
| Oct 28, 2026 | 0 |
| Oct 27, 2026 | 0 |
| Oct 26, 2026 | 0 |
| Oct 25, 2026 | 0 |
| Oct 24, 2026 | 0 |
| Oct 23, 2026 | 0 |
| Oct 22, 2026 | 0 |
| Oct 21, 2026 | 0 |
| Oct 20, 2026 | 0 |
| Oct 19, 2026 | 0 |
| Oct 18, 2026 | 0 |
| Oct 17, 2026 | 0 |
| Oct 16, 2026 | 0 |
| Oct 15, 2026 | 0 |
| Oct 14, 2026 | 0 |
| Oct 13, 2026 | 0 |
| Oct 12, 2026 | 0 |
| Oct 11, 2026 | 0 |
| Oct 10, 2026 | 0 |
| Oct 9, 2026 | 0 |
| Oct 8, 2026 | 0 |
| Oct 7, 2026 | 0 |
| Oct 6, 2026 | 0 |
| Oct 5, 2026 | 0 |
| Oct 4, 2026 | 0 |
| Oct 3, 2026 | 0 |
| Oct 2, 2026 | 0 |
| Oct 1, 2026 | 0 |
| Sep 30, 2026 | 0 |
| Sep 29, 2026 | 0 |
| Sep 28, 2026 | 0 |
| Sep 27, 2026 | 0 |
| Sep 26, 2026 | 0 |
| Sep 25, 2026 | 0 |
| Sep 24, 2026 | 0 |
| Sep 23, 2026 | 0 |
| Sep 22, 2026 | 0 |
| Sep 21, 2026 | 0 |
| Sep 20, 2026 | 0 |
| Sep 19, 2026 | 0 |
| Sep 18, 2026 | 0 |
| Sep 17, 2026 | 0 |
| Sep 16, 2026 | 0 |
| Sep 15, 2026 | 0 |
| Sep 14, 2026 | 0 |
| Sep 13, 2026 | 0 |
| Sep 12, 2026 | 0 |
| Sep 11, 2026 | 0 |
| Sep 10, 2026 | 0 |
| Sep 9, 2026 | 0 |
| Sep 8, 2026 | 0 |
| Sep 7, 2026 | 0 |
| Sep 6, 2026 | 0 |
Shared by 8 plugins in sittari-studio/payload-plugins.
9−65 since Sep 6
| Date | Weekly downloads |
|---|---|
| Dec 5, 2026 | 9 |
| Dec 4, 2026 | 10 |
| Dec 3, 2026 | 12 |
| Dec 2, 2026 | 6 |
| Dec 1, 2026 | 10 |
| Nov 30, 2026 | 10 |
| Nov 29, 2026 | 10 |
| Nov 28, 2026 | 8 |
| Nov 27, 2026 | 8 |
| Nov 26, 2026 | 6 |
| Nov 25, 2026 | 7 |
| Nov 24, 2026 | 3 |
| Nov 23, 2026 | 3 |
| Nov 22, 2026 | 4 |
| Nov 21, 2026 | 6 |
| Nov 20, 2026 | 9 |
| Nov 19, 2026 | 10 |
| Nov 18, 2026 | 13 |
| Nov 17, 2026 | 13 |
| Nov 16, 2026 | 13 |
| Nov 15, 2026 | 12 |
| Nov 14, 2026 | 10 |
| Nov 13, 2026 | 6 |
| Nov 12, 2026 | 5 |
| Nov 11, 2026 | 1 |
| Nov 10, 2026 | 5 |
| Nov 9, 2026 | 8 |
| Nov 8, 2026 | 7 |
| Nov 7, 2026 | 10 |
| Nov 6, 2026 | 10 |
| Nov 5, 2026 | 14 |
| Nov 4, 2026 | 14 |
| Nov 3, 2026 | 10 |
| Nov 2, 2026 | 7 |
| Nov 1, 2026 | 7 |
| Oct 31, 2026 | 4 |
| Oct 30, 2026 | 4 |
| Oct 29, 2026 | 0 |
| Oct 28, 2026 | 0 |
| Oct 27, 2026 | 0 |
| Oct 26, 2026 | 1 |
| Oct 25, 2026 | 2 |
| Oct 24, 2026 | 4 |
| Oct 23, 2026 | 4 |
| Oct 22, 2026 | 7 |
| Oct 21, 2026 | 11 |
| Oct 20, 2026 | 13 |
| Oct 19, 2026 | 13 |
| Oct 18, 2026 | 12 |
| Oct 17, 2026 | 13 |
| Oct 16, 2026 | 14 |
| Oct 15, 2026 | 17 |
| Oct 14, 2026 | 14 |
| Oct 13, 2026 | 12 |
| Oct 12, 2026 | 11 |
| Oct 11, 2026 | 12 |
| Oct 10, 2026 | 18 |
| Oct 9, 2026 | 25 |
| Oct 8, 2026 | 21 |
| Oct 7, 2026 | 23 |
| Oct 6, 2026 | 26 |
| Oct 5, 2026 | 26 |
| Oct 4, 2026 | 29 |
| Oct 3, 2026 | 29 |
| Oct 2, 2026 | 22 |
| Oct 1, 2026 | 20 |
| Sep 30, 2026 | 21 |
| Sep 29, 2026 | 19 |
| Sep 28, 2026 | 34 |
| Sep 27, 2026 | 31 |
| Sep 26, 2026 | 33 |
| Sep 25, 2026 | 33 |
| Sep 24, 2026 | 38 |
| Sep 23, 2026 | 41 |
| Sep 22, 2026 | 47 |
| Sep 21, 2026 | 53 |
| Sep 20, 2026 | 201 |
| Sep 19, 2026 | 191 |
| Sep 18, 2026 | 192 |
| Sep 17, 2026 | 190 |
| Sep 16, 2026 | 185 |
| Sep 15, 2026 | 179 |
| Sep 14, 2026 | 160 |
| Sep 13, 2026 | 20 |
| Sep 12, 2026 | 25 |
| Sep 11, 2026 | 27 |
| Sep 10, 2026 | 27 |
| Sep 9, 2026 | 36 |
| Sep 8, 2026 | 50 |
| Sep 7, 2026 | 56 |
| Sep 6, 2026 | 74 |
Each point is npm's rolling 7-day download count.
Health Score
Composite score based on GitHub activity, stars, npm downloads, publish recency, dependency count, and package size.
Badge for your README
[](https://payloaddirectory.dev/plugins/1294311885-strings)<a href="https://payloaddirectory.dev/plugins/1294311885-strings"><img src="https://payloaddirectory.dev/badge/1294311885-strings.svg" alt="Payload Directory"></a>README
A Payload CMS plugin that generates one localized strings global for developer-defined UI strings. Each scope becomes a named tab in the admin panel and a nested property in the API response, e.g. general.cancelButton.
pnpm add @sittari/payload-strings
Payload localization must be configured in the consuming project.
import { buildConfig } from 'payload';
import { stringsPlugin } from '@sittari/payload-strings';
export default buildConfig({
localization: {
defaultLocale: 'en',
locales: ['en', 'fr'],
},
plugins: [
stringsPlugin({
scopes: {
general: {
labels: 'General',
strings: {
cancelButton: {
defaultValue: 'Cancel',
description: 'Shown next to destructive actions.',
},
saveButton: {},
},
},
auth: {
labels: {
en: 'Authentication',
fr: 'Authentification',
},
strings: {
loginTitle: {},
},
},
},
}),
],
});
The global is exposed through Payload's normal global endpoints and Local API. Scope keys become nested properties:
const strings = await payload.findGlobal({ slug: 'strings', locale: 'fr' });
strings.general.cancelButton; // "Annuler" (once translated)
strings.auth.loginTitle;
Runtime translation behavior — including whether missing locale values fall back to the default locale — is controlled by Payload's localization configuration and per-request fallbackLocale options, exactly as for any other localized field.
getStrings and getTranslationsFor application code, getTranslations resolves keys like general.cancelButton in one shot. It loads every configured locale in a single query with locale: 'all' and fallbackLocale: false, then returns a synchronous translator:
import { getTranslations } from '@sittari/payload-strings';
const t = await getTranslations({ payload, locale: 'en' });
t('general.cancelButton'); // stored value or defaultValue or null
t('general.cancelButton', 'fr'); // per-call explicit locale
Resolution order per key and locale:
defaultValue.null.Because lookups happen with fallbackLocale: false, locales stay fully isolated: an untranslated string falls back to its developer-defined defaultValue instead of leaking another locale's wording.
The helper discovers both custom slugs (slug) and configured defaults automatically from internal metadata the plugin attaches to the Payload config, so it works without duplicating any configuration. It throws if stringsPlugin is not part of the Payload config.
getStringsgetStrings performs the single findGlobal({ slug, locale: 'all', fallbackLocale: false }) call itself and returns the normalized data behind every translator — one request for all locales, no Promise.all fan-out per locale:
import { getStrings } from '@sittari/payload-strings';
const strings = await getStrings({ payload });
Payload's locale: 'all' response is scopes-first (scope.key.locale). getStrings inverts it into a locale-first table, materializing every configured locale, scope, and key; missing, nullish, and empty stored values become the scope's defaultValue, or null when none exists (whitespace-only strings count as values):
{
en: {
general: {
cancelButton: 'Cancel', // stored '' → defaultValue
saveButton: 'Save changes',
},
},
fr: {
general: {
cancelButton: 'Annuler',
saveButton: null, // untranslated, no default
},
},
}
Locales missing entirely from the table (for example a requested code that is not configured) resolve to null downstream.
createTranslatorThe two helpers compose explicitly: getTranslations is just createTranslator(await getStrings(...)). You can call them directly when you want the normalized table (e.g. for caching) or several translators sharing one fetch:
import { createTranslator, getStrings } from '@sittari/payload-strings';
const strings = await getStrings({ payload });
const t = createTranslator(strings, 'en');
t('general.saveButton'); // 'Save changes'
t('general.saveButton', 'fr'); // null — locales stay isolated
t('general.unknownKey'); // null
The generated global is labeled Translations in English, Russian, and Ukrainian.
| Option | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Set to false to return the incoming Payload config unchanged. |
slug | string | "strings" | Slug of the generated global. |
scopes | StringsScopes | Required | Scope definitions keyed by the generated tab and API property name. |
overrides | (defaultGlobal) => GlobalConfig | Default global | Extends or replaces the final global configuration. Applied last. |
scopes is required unless the plugin is disabled, and every scope must define at least one string. Scope and string names are validated by Payload like any other field name.
Each entry under a scope's strings becomes a localized text field. Labels are generated by Payload from the string key.
| Option | Type | Description |
|---|---|---|
defaultValue | string | Shown as the admin placeholder while the string is empty, in every locale. |
description | string | Record<string, string> | Admin description below the field, localized when keyed by locale code. |
defaultValue is an editing hint only. It does not pre-seed or synchronize database values — strings stay empty until an editor saves them. When you read the global directly through Payload's Local or REST API, empty fields stay empty and defaultValue is not applied.
Through getTranslations, defaultValue becomes a runtime fallback: it is returned whenever the stored value for the requested locale is missing or an empty string, so developer-defined defaults never leave placeholder duty in direct Payload reads but still protect production UI through t.
stringsPlugin({
scopes: { general: { labels: 'General', strings: { ok: {} } } },
slug: 'ui-strings',
});
Use overrides to append hooks without losing the generated fields:
stringsPlugin({
scopes: { general: { labels: 'General', strings: { ok: {} } } },
overrides: (defaultGlobal) => ({
...defaultGlobal,
hooks: {
...defaultGlobal.hooks,
afterChange: [
async ({ doc }) => {
// Revalidate cached UI strings, trigger ISR, etc.
},
],
},
}),
});
The callback must return a complete Payload GlobalConfig. Spread defaultGlobal (and nested properties you want to preserve) when making partial changes.
The generated global uses Payload's authenticated read/update defaults. Replace them through overrides:
import { adminAccess } from './access';
stringsPlugin({
scopes: { general: { labels: 'General', strings: { ok: {} } } },
overrides: (defaultGlobal) => ({
...defaultGlobal,
access: {
read: () => true,
update: adminAccess,
},
}),
});
Configuration types are exported from the package root and from @sittari/payload-strings/types:
import type {
GetStringsOptions,
GetTranslationsOptions,
LocalizedText,
Strings,
StringsPluginConfig,
StringsRuntimeConfig,
StringsScope,
StringsScopes,
StringsString,
Translator,
} from '@sittari/payload-strings/types';
payload plugin dictionary
Manage frontend UI translation keys in the Payload admin instead of static JSON files
5615/wk3v3
better localized fields
Adds locale tabs to every localized field so editors can view each locale's value in place
50262/wk335v3
payload translations
Manage front-end UI translations in a Payload global with a t() helper and automatic revalidation
3934/wk4v3
language pt pt
European Portuguese (pt-PT) admin translations for Payload CMS with optional overrides
67575/wk0v3
payload plugin translator
AI translation of localized fields in collections and globals, saved as drafts without overwriting hand-edited text
74356/wk1v3
payload plugin translator
Translate localized Payload content with an AI provider from the admin panel via background jobs
713.9k/wk37v3