Engineering
generate-translations avatar

generate-translations

Automates the generation and synchronization of localized translation strings for Payload CMS core packages and plugins.

Introduction

This skill is designed for developers working within the Payload CMS ecosystem who need to maintain multi-language support across core packages or custom plugins. It orchestrates the translation workflow, ensuring that new English translation keys are systematically propagated to all supported languages. By leveraging OpenAI for machine translation, it significantly reduces the manual effort required to keep internationalized strings synchronized, consistent, and up-to-date with the latest feature additions.

The tool is specifically tailored for teams maintaining complex applications where UI components require precise localization. It streamlines the lifecycle of translation keys, from initial definition in English source files to the automated generation of localized counterparts. It enforces strict naming conventions and directory structures, ensuring that both core packages and independent plugins adhere to the project's standards for translation management.

  • Automates translation generation using OpenAI integration, ensuring rapid content updates across all locales.

  • Supports distinct workflows for Core Payload translations (packages/ui, packages/payload, etc.) and Plugin-specific translations.

  • Handles the scaffolding of new translation directory structures for plugins, including types, index files, and language placeholders.

  • Manages the registration of client-side translation keys, facilitating seamless integration with browser-based admin UI elements.

  • Provides a consistent CLI interface for triggering translation generation via pnpm scripts.

  • Requires an OPENAI_KEY environment variable to function, as the generation scripts rely on LLM-based translation.

  • Always define the source of truth in English first (e.g., packages/translations/src/languages/en.ts) before running the generation script.

  • For plugin translations, verify the existence of the translation directory; if missing, use the standard scaffold structure provided in the documentation.

  • Ensure that all generated files are tracked in version control, as the script acts as an automation aid for the repository's translation assets.

  • When adding new keys for client-side use, remember to register them in clientKeys.ts using colon notation (e.g., namespace:key).

Repository Stats

Stars
42,104
Forks
3,644
Open Issues
660
Language
TypeScript
Default Branch
main
Sync Status
Idle
Last Synced
Apr 29, 2026, 08:52 AM
View on GitHub