npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@wisemen/payload-core-translate

v0.0.10

Published

Payload plugin for translating documents with one or more adapters.

Downloads

901

Readme

@wisemen/payload-core-translate

Payload plugin for translating documents with one or more adapters.

What it does

  • Adds a translation action to collection edit screens.
  • Translates selected fields into one or more target locales.
  • Keeps translation status in sync on translated collections.
  • Lets you store adapter credentials in Payload, either in a global or a collection.
  • Supports an optional access gate for both the translation endpoint and the rendered translation settings field.

Install

This package is workspace-local, so you usually import it directly from the monorepo package:

import {
  payloadTranslatePlugin,
  googleTranslateAdapterDefinition,
} from "@wisemen/payload-core-translate";

Basic usage

import {
  payloadTranslatePlugin,
  googleTranslateAdapterDefinition,
} from "@wisemen/payload-core-translate";

export default buildConfig({
  plugins: [
    payloadTranslatePlugin({
      adapters: [googleTranslateAdapterDefinition],
      collections: [
        defineTranslatableCollection<Article>({
          slug: "articles",
          translatableFields: ["title", "body"],
          ignoredFields: ["seo.slug"],
        }),
      ],
      translations: {
        type: "collection",
        slug: "translationSettings",
      },
    }),
  ],
});

Adapters

Pass every adapter you want to support through adapters.

Each adapter definition can provide:

  • key: the stored config key
  • label: the admin tab label
  • fields: the editable Payload fields shown in the translations settings document
  • create(options): returns the runtime translation adapter

The package ships with a Google adapter definition:

  • googleTranslateAdapterDefinition

Google adapter settings:

  • apiKey
  • apiURL
  • fallbackApiURL

Example:

adapters: [googleTranslateAdapterDefinition];

The package also ships with a DeepL adapter definition:

  • deeplTranslateAdapterDefinition

DeepL adapter settings:

  • apiKey
  • apiURL

Example:

adapters: [deeplTranslateAdapterDefinition];

When you configure more than one adapter, the translation modal shows a Translation service dropdown so editors can choose which service to use for that translation run.

Translation settings storage

Use translations to tell the plugin where to store adapter configuration.

translations: {
  type: 'global',
  slug: 'translationSettings',
}

or:

translations: {
  type: 'collection',
  slug: 'translationSettings',
}

The plugin injects a translations group with one tab per configured adapter.

Use ignoredFields for fields that can be edited without changing the translation status. They still translate normally, but editing them will not flip a locale to manually edited or mark sibling locales stale.

Access

You can optionally gate both:

  • the translation endpoint
  • the rendered translation settings field
payloadTranslatePlugin({
  access: async ({ req, collectionSlug, document }) => {
    if (!req.user) return false;
    if (collectionSlug === "restricted") return false;
    return Boolean(document);
  },
  adapters: [googleTranslateAdapterDefinition],
  collections,
  translations: {
    type: "collection",
    slug: "translationSettings",
  },
});

If access returns false, the endpoint responds with 403, and the translations field will not render in admin.

Rich text heuristics

You can extend the built-in rich text detection rules:

payloadTranslatePlugin({
  adapters: [googleTranslateAdapterDefinition],
  collections,
  richText: {
    metaKeys: ["myMetaKey"],
    skipKeys: ["mySkipKey"],
    optionKeyPatterns: [/myOption$/i],
  },
});

Notes

  • adapters is required.
  • The runtime tries adapters in order and falls back to the next one if a translation fails.
  • The full source document is passed to each adapter, even if the adapter does not need it today.