generate-translations by payloadcms/payload
npx skills add https://github.com/payloadcms/payload --skill generate-translationsPayload 拥有两套独立的翻译系统:
使用场景: 为核心 Payload 包(packages/ui、packages/payload、packages/next)添加翻译。
packages/translations/src/languages/en.ts
authentication、general、fields 等)广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
export const enTranslations = {
authentication: {
// ... 现有键
newFeature: 'New Feature Text',
},
}
packages/translations/src/clientKeys.ts
'authentication:newFeature'cd tools/scriptspnpm generateTranslations:core使用场景: 为任何插件包(packages/plugin-*)添加翻译。
packages/plugin-{name}/src/translations 是否存在packages/plugin-{name}/src/translations/languages/en.ts
export const enTranslations = {
'plugin-multi-tenant': {
'new-feature-label': 'New Feature',
},
}
cd tools/scriptspnpm generateTranslations:plugin-{name}pnpm generateTranslations:plugin-multi-tenantpnpm generateTranslations:plugin-ecommercepnpm generateTranslations:plugin-import-export如果插件还没有翻译文件夹,请询问用户是否想要搭建一个。
packages/plugin-{name}/src/translations/
├── index.ts
├── types.ts
└── languages/
├── en.ts
├── es.ts
└── ... (所有其他语言文件)
tools/scripts/src/generateTranslations/plugin-{name}.ts
plugin-multi-tenant.ts 作为模板tools/scripts/package.json:
"generateTranslations:plugin-{name}": "node --no-deprecation --import @swc-node/register/esm-register src/generateTranslations/plugin-{name}.ts"
OPENAI_KEY 环境变量每周安装量
143
代码仓库
GitHub 星标数
41.4K
首次出现
2026年1月21日
安全审计
安装于
opencode127
codex123
gemini-cli120
github-copilot118
cursor113
claude-code109
Payload has two separate translation systems:
When to use: Adding translations to core Payload packages (packages/ui, packages/payload, packages/next)
Add the English translation to packages/translations/src/languages/en.ts
Add your new key/value to the appropriate section (e.g., authentication, general, fields, etc.)
Use nested objects for organization
Example:
export const enTranslations = {
authentication: {
// ... existing keys
newFeature: 'New Feature Text',
},
}
Add client key (if needed for client-side usage) to packages/translations/src/clientKeys.ts
'authentication:newFeature'Generate translations for all languages
cd tools/scriptspnpm generateTranslations:coreWhen to use: Adding translations to any plugin package (packages/plugin-*)
Verify plugin has translations folder
packages/plugin-{name}/src/translations existsAdd the English translation to the plugin's packages/plugin-{name}/src/translations/languages/en.ts
Plugin translations are namespaced under the plugin name
Example for plugin-multi-tenant:
export const enTranslations = {
'plugin-multi-tenant': {
'new-feature-label': 'New Feature',
},
}
Generate translations for all languages
cd tools/scriptspnpm generateTranslations:plugin-{name}If a plugin doesn't have a translations folder yet, ask the user if they want to scaffold one.
packages/plugin-{name}/src/translations/
├── index.ts
├── types.ts
└── languages/
├── en.ts
├── es.ts
└── ... (all other language files)
Create tools/scripts/src/generateTranslations/plugin-{name}.ts
plugin-multi-tenant.ts as a templateAdd script to tools/scripts/package.json:
"generateTranslations:plugin-{name}": "node --no-deprecation --import @swc-node/register/esm-register src/generateTranslations/plugin-{name}.ts"
OPENAI_KEY environment variable to be setWeekly Installs
143
Repository
GitHub Stars
41.4K
First Seen
Jan 21, 2026
Security Audits
Gen Agent Trust HubWarnSocketPassSnykPass
Installed on
opencode127
codex123
gemini-cli120
github-copilot118
cursor113
claude-code109
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
157,400 周安装
pnpm generateTranslations:plugin-multi-tenantpnpm generateTranslations:plugin-ecommercepnpm generateTranslations:plugin-import-export