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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@jhb.software/payload-content-translator-plugin

v0.1.0

Published

A Payload CMS plugin that adds a content translation feature to the admin UI.

Readme

JHB Software - Payload Content Translator Plugin

NPM Version

A plugin that enables content translation directly within the Payload CMS panel, using any translation service you prefer. It supports custom translation resolvers and provides a ready-to-use integration with OpenAI.

Features

  • translate content in the Payload Admin UI between locales
  • supports any translation service using a resolver pattern (e.g. OpenAI, DeepL, etc.)
  • comes with a ready-to-use OpenAI resolver out of the box
  • seamless integration with Payload's localization system
  • review and edit translations before saving or publishing

Setup

Install the plugin and add it to your Payload config:

import {
  payloadContentTranslatorPlugin,
  openAIResolver,
} from '@jhb.software/payload-content-translator-plugin'

export default buildConfig({
  // Enable localization
  localization: {
    defaultLocale: 'en' /* example */,
    locales: ['en', 'de'] /* example */,
  },
  plugins: [
    payloadContentTranslatorPlugin({
      collections: ['pages', 'posts'],
      globals: ['settings'],
      /* openAI or any other resolver */
      resolver: openAIResolver({
        apiKey: process.env.OPENAI_API_KEY,
        model: 'gpt-4o-mini',
      }),
    }),
  ],
})

Configuration

Plugin Options

| Option | Type | Required | Description | | ------------- | ------------------- | -------- | ------------------------------------- | | collections | CollectionSlug[] | Yes | Collections to enable translation for | | globals | GlobalSlug[] | Yes | Globals to enable translation for | | resolver | TranslateResolver | Yes | Translation resolver to use | | enabled | boolean | No | Whether to enable the plugin. |

Resolvers

This plugin is designed to work seamlessly with various translation services by accepting a customizable translation resolver as a configuration option.

An OpenAI resolver is provided out of the box, but you can use any translation provider by creating your own resolver and specifying it in the plugin configuration.

OpenAI Resolver

import { openAIResolver } from '@jhb.software/payload-content-translator-plugin'

openAIResolver({
  apiKey: process.env.OPENAI_API_KEY,
  model: 'gpt-4o-mini', // or 'gpt-4', 'gpt-3.5-turbo', etc.
})

Custom Resolver

You can create your own resolver by implementing the TranslateResolver interface.

import type { TranslateResolver } from '@jhb.software/payload-content-translator-plugin'

export const customResolver = (): TranslateResolver => ({
  key: 'custom',
  resolve: ({ localeTo, texts }) => {
    const translatedTexts = texts.map((text) => {
      /* your custom translation logic here */
      return text
    })

    return { success: true, translatedTexts }
  },
})

Acknowledgements

This plugin builds upon the translator package from payload-enchants and has been refined and streamlined with additional enhancements and fixes.

Contributing

We welcome contributions! Please open an issue to report bugs or suggest improvements, or submit a pull request with your changes.