开发者
Tranzly 能力参考
Tranzly 将其操作注册到 WordPress Abilities API。这些相同的能力也是站点自身服务器上的 MCP 工具,以及 /wp-json/wp-abilities/v1 下的 REST 路由。本页面基于插件自身的注册表生成。
端点
| 能力 | REST |
|---|---|
| 基于 HTTP 的 MCP(可流式传输) | /wp-json/tranzly/v1/mcp |
| 基于 WP-CLI 的 MCP(标准输入与输出) | wp mcp-adapter serve --server=tranzly --user=<login> |
| REST:列出能力 | /wp-json/wp-abilities/v1/abilities?category=tranzly |
| REST:运行能力 | /wp-json/wp-abilities/v1/abilities/<name>/run (只读能力使用带有 ?input= 的 GET,其他使用 POST {"input": {...}}) |
身份验证与权限
HTTP 请求使用 WordPress 应用程序密码(HTTP Basic)进行身份验证。连接到 MCP 服务器需要下方显示的功能权限;然后每项能力会按对象检查其自身权限。只读能力通过 GET 运行且其输入位于查询字符串中;其他能力通过 POST 和 JSON 请求体 ‘{“input”: {…}}’ 运行。
WordPress 应用程序密码 (HTTP) 或 --user (WP-CLI);用户需要每项能力指定的功能权限 · 设置:允许 AI 智能体 (MCP),默认开启
所有能力
| 能力 | 版本 | REST | 权限 | 参数 |
|---|---|---|---|---|
tranzly/bulk-translate为指定内容类型(若未指定,则为所有已翻译类型)的每个原始内容启动后台翻译任务:翻译缺失的、已过期的或全部内容。返回已启动的任务,每种语言一个任务。 | Pro | POST /wp-json/wp-abilities/v1/abilities/tranzly/bulk-translate/run | edit_posts;发布需具备 publish_posts | languages 数组(必填)post_types 数组scope 字符串:missing、stale、allengine 字符串publish 布尔值 |
tranzly/cancel-job停止任务;已完成的翻译内容将予以保留。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/cancel-job/run | manage_options(REST 路由自身的检查) | id 字符串(必填) |
tranzly/check-quality让 AI 对比单篇翻译与原文并进行评分,同时将报告保存在该翻译上。使用 Tranzly 工作流设置中配置的质量检查 AI 模型。 | Pro | POST /wp-json/wp-abilities/v1/abilities/tranzly/check-quality/run | 针对该翻译的 edit_post 权限 | id 整数(必填) |
tranzly/connect-support将本站连接至 Zinn Digital® 支持服务(姓名、电子邮箱、同意书)。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/connect-support/run | manage_options(REST 路由自身的检查) | email 字符串(必填)name 字符串consent 布尔值(必填) |
tranzly/correct-segments保存翻译的修正句段(句段:键到文本);修正后的文本将免受重新翻译的影响。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/correct-segments/run | edit_post(REST 路由自身的检查) | id 字符串(必填)segments 对象texts 对象 |
tranzly/create-job启动后台任务,将指定的文章列表(posts)或整个文章类型翻译成目标语言(langs)。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/create-job/run | edit_posts(REST 路由自身的检查) | posts 数组post_type 字符串langs 数组(必填)engine 字符串status 字符串:publish、draftforce 布尔值 |
tranzly/create-post-translation为某篇文章创建特定语言(lang)的草稿翻译,用于手动撰写,无需使用翻译引擎。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/create-post-translation/run | REST 路由自身的单项权限检查 | id 字符串(必填)lang 字符串(必填)name 字符串slug 字符串description 字符串 |
tranzly/create-term-translation使用您提供的名称、别名和描述,创建某个分类法项目的特定语言翻译。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/create-term-translation/run | REST 路由自身的单项权限检查 | id 字符串(必填)lang 字符串(必填)name 字符串slug 字符串description 字符串 |
tranzly/disconnect-support断开本站与支持服务的连接。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/disconnect-support/run | manage_options(REST 路由自身的检查) | 无 |
tranzly/estimate在产生任何费用之前,预估使用引擎将文章(posts 或 post_type)翻译为目标语言(langs)所需的字符数和费用。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/estimate/run | edit_posts(REST 路由自身的检查) | posts 数组post_type 字符串langs 数组(必填)engine 字符串 |
tranzly/estimate-bulk在开始之前,预估某种语言的全站翻译(post_types、scope、engine)。 | Pro | POST /wp-json/wp-abilities/v1/abilities/tranzly/estimate-bulk/run | edit_posts(REST 路由自身的检查) | post_types 数组scope 字符串:missing、stale、allengine 字符串lang 字符串(必填)after 整数 |
tranzly/export-translation-file返回包含原文及其对应单语言译文的 XLIFF 或 CSV 文件(作为文本),以供译员或翻译机构使用:支持指定的文章,或某种状态(missing、stale、translated 或 all;可通过 after 分页)下某个内容类型单页最多 100 篇的原文。翻译完成后,同一文件可重新导入。 | Pro | GET /wp-json/wp-abilities/v1/abilities/tranzly/export-translation-file/run | edit_posts;仅当用户有权限编辑某篇文章时才会包含该文章 | lang 字符串(必填)format 字符串:xliff、csvposts 数组post_type 字符串state 字符串:all、missing、stale、translatedafter 整数 |
tranzly/fix-status将指定语言和文章类型中每个缺失(或已过期)的项目加入翻译队列。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/fix-status/run | edit_posts(REST 路由自带的权限检查) | post_type 字符串lang 字符串(必填)state 字符串(必填):missing、stale、quality |
tranzly/get-comments-setting返回评论是跨语言共享还是按语言独立保留。 | 专业版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-comments-setting/run | moderate_comments(REST 路由自带的权限检查) | 无 |
tranzly/get-deepl-usage返回已保存的 DeepL 密钥本月已用字符数及配额上限。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-deepl-usage/run | manage_options(REST 路由自带的权限检查) | 无 |
tranzly/get-diagnostics返回支持工单所需的诊断信息:版本、已启用的插件、限制条件以及近期的错误。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-diagnostics/run | manage_options(REST 路由自带的权限检查) | 无 |
tranzly/get-display返回语言切换器和署名信息显示选项。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-display/run | manage_options(REST 路由自带的权限检查) | 无 |
tranzly/get-engine-settings返回默认及备用引擎、各语言专属引擎与 AI 模型、各引擎状态、已连接的 AI 提供商及其模型,以及本月支出。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-engine-settings/run | manage_options(REST 路由自带的权限检查) | 无 |
tranzly/get-glossary返回不翻译的词汇、固定术语翻译以及每种语言的语气设置。 | 专业版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-glossary/run | manage_options | 无 |
tranzly/get-integrations列出 Tranzly 支持的 SEO、WooCommerce、页面构建器和表单插件,以及当前站点已启用的插件。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-integrations/run | manage_options(REST 路由自带的权限检查) | 无 |
tranzly/get-job返回单个任务的进度与计数。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-job/run | manage_options(REST 路由自带的权限检查) | id 字符串(必填) |
tranzly/get-job-failures列出任务中失败的项目及其失败原因。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-job-failures/run | manage_options(REST 路由自带的权限检查) | id 字符串(必填) |
tranzly/get-legacy-import返回从 Tranzly 2.x 导入翻译的状态和报告。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-legacy-import/run | manage_options(REST 路由自带的权限检查) | 无 |
tranzly/get-licence返回本站点的 Tranzly 方案套餐、许可证状态、续费日期以及套餐包含的内容。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-licence/run | manage_options(REST 路由自带的权限检查) | 无 |
tranzly/get-menus返回各语言在各个菜单位置中显示的菜单。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-menus/run | edit_theme_options(REST 路由自带的权限检查) | 无 |
tranzly/get-post-group列出文章的翻译关联组:每种语言对应的成员及其标题、状态和编辑链接。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-post-group/run | edit_post 和 edit_term(REST 路由自带的权限检查) | id 字符串(必填) |
tranzly/get-quality-report返回翻译的 AI 质量报告:评分及被标记的句段。 | 专业版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-quality-report/run | edit_post(REST 路由自带的权限检查) | id 字符串(必填) |
tranzly/get-segments并排返回翻译句段与原文句段,以便审核和修改。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-segments/run | edit_post(REST 路由自带的权限检查) | id 字符串(必填) |
tranzly/get-shared-strings返回指定语言下的主题和插件文本(作用域)及其翻译。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-shared-strings/run | edit_theme_options(REST 路由自带的权限检查) | lang 字符串(必填)scope 字符串:menus、site、templates、gettext.plugin-<slug>、gettext.theme-<slug> |
tranzly/get-site-strings返回指定语言下的站点标题、副标题和小工具文本。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-site-strings/run | manage_options(REST 路由自带的权限检查) | lang 字符串(必填) |
tranzly/get-support-connection说明此站点是否已连接至 Zinn Digital® 支持,以及以何身份连接。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-support-connection/run | manage_options(REST 路由自身的检查) | refresh 布尔值 |
tranzly/get-term-group列出分类或标签的翻译分组。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-term-group/run | edit_post 和 edit_term(REST 路由自身的检查) | id 字符串(必填) |
tranzly/get-urls返回语言在地址中的显示方式(目录、子域名或独立域名)、翻译后的别名与基础路径,以及未翻译页面的 noindex 设置。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-urls/run | manage_options(REST 路由自身的检查) | 无 |
tranzly/get-workflow-settings返回发布时和更新时的自动翻译设置、发布前审核,以及 AI 质量检查的阈值、服务提供商和模型。 | Pro 版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/get-workflow-settings/run | manage_options(REST 路由自身的检查) | 无 |
tranzly/import-from-source从另一个多语言插件导入下一页翻译(模式:dry-run 或 run;cursor)。 | Pro 版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/import-from-source/run | manage_options(REST 路由自身的检查) | source 字符串(必填)mode 字符串:dry-run、run、undocursor 字符串 |
tranzly/import-translation-file从已上传的翻译文件中写入下一页文章(通过 after 重复操作直至完成)。 | Pro 版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/import-translation-file/run | edit_posts(REST 路由自身的检查) | token 字符串(必填)after 整数 |
tranzly/link-post将现有文章(目标)关联为此文章在某种语言下的翻译。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/link-post/run | edit_post 和 edit_term(REST 路由自身的检查) | id 字符串(必填)lang 字符串(必填)target 整数(必填) |
tranzly/link-term将现有分类项目(目标)关联为此项目在某种语言下的翻译。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/link-term/run | edit_post 和 edit_term(REST 路由自身的检查) | id 字符串(必填)lang 字符串(必填)target 整数(必填) |
tranzly/list-engines列出翻译引擎、各引擎是否已配置,以及未指定时使用的引擎。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/list-engines/run | edit_posts | 无 |
tranzly/list-import-sources列出在此站点上发现的、可供导入的 WPML、Polylang 和 TranslatePress 数据。 | Pro 版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/list-import-sources/run | manage_options(REST 路由自身的检查) | 无 |
tranzly/list-jobs按从新到旧顺序列出后台翻译任务及其进度。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/list-jobs/run | edit_posts(REST 路由自身的检查) | 无 |
tranzly/list-languages列出站点的语言。第一种语言为原始内容的编写语言。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/list-languages/run | edit_posts | 无 |
tranzly/list-status-items逐页列出原文及其在某种语言下的翻译状态(状态:缺失、已过期、最新)。 | 免费版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/list-status-items/run | edit_posts(REST 路由自身的检查) | post_type 字符串lang 字符串(必填)state 字符串:all、missing、stale、translated、human、machine、review、qualityafter 整数 |
tranzly/list-theme-strings列出可扫描翻译文本的主题和插件,以及各自拥有的字符串数量。 | Pro 版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/list-theme-strings/run | manage_options(REST 路由自身的检查) | 无 |
tranzly/open-support-ticket提交支持工单(主题、消息、类型、电子邮件),并在管理员同意时附带此站点的诊断信息。绝不会创建登录信息或发送登录凭据。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/open-support-ticket/run | manage_options(REST 路由自身的检查) | subject 字符串(必填)message 字符串(必填)kind 字符串:help、bug、feedback、feature_requestemail 字符串name 字符串diagnostics 布尔值 |
tranzly/record-support-consent记录管理员是否同意在支持工单中发送诊断信息。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/record-support-consent/run | manage_options(REST 路由自身的检查) | consent 布尔值(必填) |
tranzly/retry-job-item重试失败的项目(操作:retry,可选使用其他引擎)或将其标记为手动翻译(操作:by-hand)。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/retry-job-item/run | edit_post 和 manage_options(REST 路由自身的检查) | item 字符串(必填)action 字符串(必填)engine 字符串 |
tranzly/review-translation批准翻译(并在原文已发布时予以发布)或将其退回(decision,note)。 | 专业版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/review-translation/run | edit_post(REST 路由自身的检查) | id 字符串(必填)decision 字符串(必填):approve、changes、pendingnote 字符串 |
tranzly/run-legacy-import运行 2.x 导入:预检演练(仅生成报告)、正式运行或撤销。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/run-legacy-import/run | manage_options(REST 路由自身的检查) | action 字符串(必填) |
tranzly/scan-theme-strings扫描组件 PHP 文件的下一页以查找可翻译文本(使用 after 重复此操作直至完成)。 | 专业版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/scan-theme-strings/run | manage_options(REST 路由自身的检查) | component 字符串(必填)after 整数 |
tranzly/schedule-quality-check为某种语言的下一页翻译(或指定的文章)安排 AI 质量检查。 | 专业版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/schedule-quality-check/run | edit_posts(REST 路由自身的检查) | lang 字符串(必填)post_type 字符串posts 数组after 整数 |
tranzly/seo-audit逐页检查某种语言的翻译中是否缺失 SEO 标题、描述、别名和 hreflang。 | 专业版 | GET /wp-json/wp-abilities/v1/abilities/tranzly/seo-audit/run | manage_options(REST 路由自身的检查) | lang 字符串(必填)after 整数 |
tranzly/set-comments-setting在某篇文章的不同语言翻译之间共享评论,或按语言分别保留评论(mode)。 | 专业版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/set-comments-setting/run | manage_options 和 moderate_comments(REST 路由自身的检查) | mode 字符串(必填):off、show、translate |
tranzly/set-engine-key保存 DeepL、Google 或 Microsoft 的 API 密钥(以及 Microsoft 的区域);留空则移除。密钥采用加密存储,且绝不会被返回。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/set-engine-key/run | manage_options(REST 路由自身的检查) | engine 字符串(必填)key 字符串(必填)region 字符串 |
tranzly/set-menus按语言和位置分配菜单(map)。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/set-menus/run | edit_theme_options(REST 路由自身的检查) | map 对象(必填) |
tranzly/set-protection保护翻译不被引擎覆盖(protected: true),或取消保护锁定。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/set-protection/run | edit_post(REST 路由自身的检查) | id 字符串(必填)protected 布尔值(必填) |
tranzly/set-shared-strings保存修正后的主题和插件文本翻译(strings);这些翻译将被保护锁定。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/set-shared-strings/run | edit_theme_options(REST 路由自身的检查) | lang 字符串(必填)scope 字符串:menus、site、templates、gettext.plugin-<slug>、gettext.theme-<slug>strings 对象(必填) |
tranzly/set-site-string保存某种语言下的一个站点文本(key),例如站点标题或副标题。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/set-site-string/run | edit_theme_options 和 manage_options(REST 路由自身的检查) | lang 字符串(必填)key 字符串(必填)translation 字符串(必填) |
tranzly/set-urls设置地址模式(mode)、各语言域名、已翻译的基础路径和分段、noindex_untranslated 以及别名建议。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/set-urls/run | manage_options(REST 路由自身的检查) | mode 字符串segments 对象domains 对象bases 对象suggest 布尔值noindex_untranslated 布尔值 |
tranzly/start-trial为此站点开启 14 天 Tranzly Pro 试用(无需付款)。 | 免费版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/start-trial/run | manage_options(REST 路由自身的检查) | 无 |
tranzly/translate-media-field以指定语言(lang)保存图像的替代文本、标题或说明(field)。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/translate-media-field/run | edit_post(REST 路由自身的检查) | id 字符串(必填)lang 字符串(必填)field 字符串(必填):alt、caption、titletranslation 字符串(必填) |
tranzly/translate-post使用翻译引擎将单篇文章或页面翻译为站点的一种或多种语言,并创建或更新各翻译版本。除非 publish 为 true,否则新翻译均为草稿。人工编辑过的翻译将被跳过,除非 force 为 true。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/translate-post/run | 可翻译该文章(对其拥有 edit_post 权限);对已有翻译拥有 edit_post 权限;该内容类型的 publish 权限以发布 | id 整数(必填)languages 数组(必填)engine 字符串publish 布尔值force 布尔值 |
tranzly/translate-shared-strings使用默认引擎翻译指定语言中下一页未翻译的主题和插件文本(通过 after 参数重复直到完成)。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/translate-shared-strings/run | edit_theme_options(REST 路由自身的检查) | lang 字符串(必填)scope 字符串:menus、site、templates、gettext.plugin-<slug>、gettext.theme-<slug>after 整数 |
tranzly/translate-site向导式工作流程:智能体检查语言和引擎,估算费用,并翻译缺失的内容,在产生费用或发布之前会进行询问。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/translate-site/run | edit_posts | languages 字符串(必填) |
tranzly/translate-term使用引擎将单个分类项目(分类、标签或产品属性)翻译为指定语言(lang),创建或更新其翻译。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/translate-term/run | REST 路由自身的单项权限检查 | id 字符串(必填)lang 字符串(必填)engine 字符串force 布尔值status 字符串:publish、draft |
tranzly/translation-status提供文章 ID 时:该文章各语言的翻译版本、是否已过时以及作者是谁。未提供时:按语言统计站点的翻译进度。 | 免费 | GET /wp-json/wp-abilities/v1/abilities/tranzly/translation-status/run | 对该文章拥有 edit_post 权限;查看站点摘要需拥有 edit_posts 权限 | id 整数post_type 字符串 |
tranzly/unlink-post将文章移出其翻译组;保留其语言设置。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/unlink-post/run | edit_post 和 edit_term(REST 路由自身的检查) | id 字符串(必填) |
tranzly/unlink-term将分类项目移出其翻译组。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/unlink-term/run | edit_post 和 edit_term(REST 路由自身的检查) | id 字符串(必填) |
tranzly/update-display更改切换器(样式、旗帜、名称、放置位置)和鸣谢署名。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/update-display/run | manage_options(REST 路由自身的检查) | switcher 对象credit 布尔值 |
tranzly/update-engine-settings设置默认引擎、备用引擎、按语言设置的引擎以及按语言设置的 AI 模型(default、fallback、per_lang、models、caps)。除默认引擎外,其他功能均为专业版(Pro)。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/update-engine-settings/run | manage_options(REST 路由自身的检查) | default 字符串per_lang 对象fallback 数组caps 对象models 对象 |
tranzly/update-glossary替换您提交的术语表部分内容(从不翻译的词汇、术语翻译、语气);未提交的部分将予以保留。从下一次翻译开始供所有引擎使用。 | 专业版 | POST /wp-json/wp-abilities/v1/abilities/tranzly/update-glossary/run | manage_options | dnt 数组terms 对象tone 对象 |
tranzly/update-settings设置站点的语言(languages:代码和名称列表;第一个为原始语言)、前端类名前缀以及是否允许 AI 智能体(MCP)。 | 免费 | POST /wp-json/wp-abilities/v1/abilities/tranzly/update-settings/run | manage_options(REST 路由自身的检查) | prefix 字符串mcp 布尔值languages 数组 |
tranzly/update-workflow-settings设置 on_update(off、stale、translate)、on_publish、review、quality_threshold、quality_provider 和 quality_model。 | Pro | POST /wp-json/wp-abilities/v1/abilities/tranzly/update-workflow-settings/run | manage_options(REST 路由的自身检查) | on_update string:off、stale、translateon_publish booleanreview booleanquality_threshold integerquality_provider stringquality_model string |
tranzly/upload-translation-file上传在其他位置翻译的 Tranzly XLIFF 或 CSV 文件(content、filename);返回一个用于在导入时识别该上传的令牌。 | Pro | POST /wp-json/wp-abilities/v1/abilities/tranzly/upload-translation-file/run | edit_posts(REST 路由的自身检查) | content string(必填)filename string(必填) |
由插件的 abilities.json 生成,该文件本身是从运行中的站点生成的;当两者不一致时测试将失败。
WP-CLI 命令
在服务器上通过 WP-CLI 运行这些命令。每个命令都会检查与插件后台界面相同的权限;示例均取自插件自身的帮助文本。
| 命令 | 作用 | 版本 |
|---|---|---|
wp tranzly create <id> [--term]wp tranzly create 42 --lang=de_DE --user=admin | 创建文章(或分类法词条)的草稿翻译,并与其关联。 | 免费版 |
wp tranzly engines | 列出翻译引擎。 | 免费版 |
wp tranzly jobs <action> [<id>...] [--lang=<codes>] [--post-type=<type>] [--engine=<id>] [--publish] [--force] [--format=<format>]wp tranzly jobs create --lang=de,fr --post-type=page --user=adminwp tranzly jobs status 12wp tranzly jobs failures 12wp tranzly jobs retry 345 --engine=deeplwp tranzly jobs retry-failed 12wp tranzly jobs run 12 # work the job here instead of waiting for the queue runner | 后台翻译任务。 | 免费版 |
wp tranzly legacy <action> [--format=<format>]wp tranzly legacy dry-runwp tranzly legacy runwp tranzly legacy undo | 显示、试运行、执行或撤销从旧版 Tranzly (2.x) 站点导入翻译。 | 免费版 |
wp tranzly link <source> <target> [--term] | 将现有的文章(或分类法词条)关联为另一篇的翻译。 | 免费版 |
wp tranzly network <action> [--languages=<codes>]wp tranzly network setupwp tranzly network languages --languages=en_US,de_DE,fr_FR | 多站点(机构版):设置网络中的每个站点,或设置新站点初始启用的语言。 | 免费版 |
wp tranzly translate [<id>...] [--post-type=<type>] [--engine=<id>] [--force] [--publish] [--dry-run]wp tranzly translate --lang=de --post-type=page --user=adminwp tranzly translate 42 43 --lang=de_DE,fr_FR --engine=deepl --user=admin | 使用引擎翻译文章。 | 免费版 |
wp tranzly translations <id> [--term] [--format=<format>] | 列出文章(或分类法词条)的所有翻译。 | 免费版 |
PHP 函数
主题和其他插件可以调用的函数。请先检查 function_exists(),以确保在插件停用时您的代码仍能正常运行。
| 函数 | 功能描述 | 版本 |
|---|---|---|
icl_object_id( $id, $type = 'post', $return_original_if_missing = false, $lang = null ) | WPML:对象的翻译。 | Pro |
pll__( $text ) | Polylang:已注册的字符串,已翻译。Tranzly 通过 WordPress 自带的 gettext 翻译主题字符串,因此字符串原样返回。 | Pro |
pll_current_language( $field = 'slug' ) | Polylang:当前语言。 | Pro |
pll_default_language( $field = 'slug' ) | Polylang:默认语言。 | Pro |
pll_e( $text ) | Polylang:输出已注册并转义的字符串。 | Pro |
pll_get_post( $post_id, $lang = null ) | Polylang:文章的翻译。 | Pro |
pll_get_post_language( $post_id, $field = 'slug' ) | Polylang:文章的语言。 | Pro |
pll_get_post_translations( $post_id ) | Polylang:文章的所有翻译版本,别名 => ID。 | Pro |
pll_get_term( $term_id, $lang = null ) | Polylang:分类法项目的翻译。 | Pro |
pll_get_term_language( $term_id, $field = 'slug' ) | Polylang:分类法项目的语言。 | Pro |
pll_get_term_translations( $term_id ) | Polylang:分类法项目的所有翻译版本,别名 => ID。 | Pro |
pll_home_url( $lang = '' ) | Polylang:指定语言的主页 URL。 | Pro |
pll_is_translated_post_type( $post_type ) | Polylang:此文章类型是否已翻译? | Pro |
pll_is_translated_taxonomy( $taxonomy ) | Polylang:此分类法是否已翻译? | Pro |
pll_languages_list( $args = array( ) | Polylang:语言列表。 | Pro |
pll_register_string() | Polylang:注册字符串(已接收并忽略——参见 pll__())。 | Pro |
pll_the_languages( $args = array( ) | Polylang:语言切换器。`raw` 返回 Polylang 的数组(别名 => 详细信息);否则返回 Polylang 标记结构的 `<li>` 列表,除非 `echo` 为 0 否则直接输出。遵循 `hide_current`、`hide_if_no_translation` 和 `display_names_as`(`name` 或 `slug`)。`dropdown` 仍渲染为列表:如需下拉菜单,请使用 Tranzly 自带的切换器区块/小部件。 | Pro |
pll_translate_string( $text ) | Polylang:指定语言中已注册的字符串。同 pll__(),字符串原样返回。 | Pro |
tranzly_compat_field( string $code, string $field ) | 语言的一个字段,采用 Polylang 词汇表。 | Pro |
tranzly_current_language(): string | 当前请求的语言(WordPress 区域设置代码,如 `fr_FR`)。 | Free |
tranzly_default_language(): string | 默认语言:列表中的首项。 | Free |
tranzly_get_engines(): array | 可用引擎:id => name。 | Free |
tranzly_get_post_language( int $post_id ): string | 文章撰写时所用的语言。 | Free |
tranzly_get_term_language( int $term_id ): string | 分类法项目撰写时所用的语言。 | Free |
tranzly_get_term_translation( int $term_id, string $lang ): ?int | 分类法项目对应某种语言的翻译,若无则为 null。 | Free |
tranzly_get_term_translations( int $term_id ): array | 分类法项目的所有版本:语言代码 => 分类法项目 ID。 | Free |
tranzly_get_translation( int $post_id, string $lang ): ?int | 文章对应某种语言的翻译 ID,若不存在则为 null。当文章本身就是该语言撰写时,返回其自身的 ID。 | Free |
tranzly_get_translations( int $post_id ): array | 文章的所有版本(包含其自身):语言代码 => 文章 ID。无翻译的文章仅返回其自身及对应语言。 | Free |
tranzly_language_switcher( array $args = array( ) | 适用于任何主题、页面构建器或插件(T5)的语言切换器 HTML。Page Builder Sandwich 的元素已调用它;您也可以调用。语言少于两种时返回空。 | Free |
tranzly_language_url( string $lang, ?string $url = null ): string | 显示指定语言的 URL。 | Free |
tranzly_languages(): array | 站点的语言列表,默认语言居首。 | Free |
tranzly_register_engine( Engine $engine ) | 添加翻译引擎。在 `tranzly_register_engines` 上调用,或在本次请求的首次翻译之前的任意时间调用。 | Free |
tranzly_restore_language(): bool | 撤销上一次 tranzly_switch_language() 的操作。 | Free |
tranzly_switch_language( string $lang ): bool | 使代码以另一种语言运行,直到调用 tranzly_restore_language():当前语言和 WordPress 自身的翻译都会切换。类似于 switch_to_blog() 进行嵌套: | Free |
tranzly_translatable_attributes( string $block_name ): array | Tranzly 为某个区块类型翻译的属性名称:其 block.json 中的 `role: content`,并由 `tranzly_translatable_attributes` 过滤器调整。 | Free |
tranzly_translate_post( int $post_id, string $lang, string $engine = '', array $args = array( ) | 使用引擎将文章翻译为某种语言,以当前用户的身份操作(适用其权限)。 | 免费 |
动作与过滤器
插件提供的所有钩子,附带其源代码中的说明。过滤器用于更改值;动作让您在特定时刻运行代码;入口点则是您触发以要求插件执行某项操作的动作。
| 钩子 | 类型 | 作用 | 参数 | 版本 |
|---|---|---|---|---|
tranzly_admin_bar | 动作 | 在翻译管理栏菜单构建完成后触发(Pro 版本的可视化编辑器在此处添加其“在此页面上翻译”菜单项)。 | \WP_Admin_Bar $barint $id | 免费版 |
tranzly_admin_data | 过滤器 | 过滤管理端应用启动时加载的数据。高级版图层使用它来报告其版本;此处不应包含任何敏感数据,因为它会被输出到页面中。 | 无 | 免费版 |
tranzly_ai_model | 过滤器 | 过滤用于翻译为特定语言的 AI 服务商和模型。免费版:对所有语言均使用为 `translate` 任务选择的服务商和模型。Tranzly Pro:优先使用该语言自选的模型,否则使用“所有其他语言”的选择。 | string $target | 免费版 |
tranzly_ai_providers_in_use | 过滤器 | 过滤为特定语言选择的 AI 服务商。免费插件中无此项:每种语言均使用为 `translate` 任务选择的服务商和模型。Tranzly Pro 则会列出为其各语言模型提供支持的服务商。 | 无 | 免费版 |
tranzly_content_before_rebuild | 过滤器 | 在将已翻译片段写入源内容之前按语言过滤源内容(Pro 版本的按语言替换图片功能使用了此项)。 | string $contentstring $lang | 免费版 |
tranzly_copy_meta_keys | 过滤器 | 过滤从文章复制到其新译文中的元键(meta key)。不会复制其他任何内容。 | int $source_id | 免费版 |
tranzly_deepl_host | 过滤器 | 过滤 DeepL API 主机(代理或测试替身)。 | string $hoststring $key | 免费版 |
tranzly_deepl_price_per_million | 过滤器 | 过滤 DeepL 每百万字符的价格(美元)。 | float $price | 免费版 |
tranzly_default_engine | 过滤器 | 过滤未指定引擎时所使用的默认引擎 ID。 | string $id | 免费版 |
tranzly_engine_cap | 过滤器 | 过滤引擎的每月限额(美元):免费插件中无此项。 | float|null $capstring $engine | 免费版 |
tranzly_engine_chain | 过滤器 | 按顺序过滤某种语言要尝试的引擎。免费版:默认引擎。高级版图层会添加该语言专属的引擎及备用列表。 | string $langstring $first | 免费版 |
tranzly_engine_options | 过滤器 | 过滤传递给引擎的选项(不翻译列表、术语表、正式程度、提示指令)。 | string $targetEngine $engine | 免费版 |
tranzly_engine_settings_save | 过滤器 | 保存按语言设置的引擎和 AI 模型、备用列表以及每月限额。仅高级版图层会响应(WordPress.org 准则 5:免费插件中不得包含 Pro 行为)。 | 无 | 免费版 |
tranzly_frontend_prefix | 过滤器 | 过滤中立的前端类名前缀。 | string $prefix | 免费版 |
tranzly_fs_loaded | 动作 | 在授权许可 SDK 加载完成后触发(在主文件中,先于任何 Tranzly 代码执行)。在此挂载钩子以与 `tranzly_fs()` 通信。 | 无 | 免费版 |
tranzly_glossary_options | 过滤器 | 过滤目标语言的引擎选项:不翻译列表,以及在高级版图层添加术语表和语气设置时的相关选项。 | string $lang | 免费版 |
tranzly_glossary_save | 过滤器 | 保存各语言的首选翻译和语气。仅高级版图层会响应(WordPress.org 准则 5:免费插件中不得包含 Pro 行为)。 | 无 | 免费版 |
tranzly_google_price_per_million | 过滤器 | 过滤 Google Cloud Translation 每百万字符的价格(美元)。 | float $price | Pro |
tranzly_install_language_packs | 过滤器 | Tranzly 是否安装添加到站点的语言所对应的 WordPress、主题和插件语言包(以便 WordPress 和 WooCommerce 自带的词条显示为已翻译)。默认开启。 | bool $install | 免费版 |
tranzly_integration_available | 过滤器 | 过滤在未检测到某个插件时是否仍运行其集成——适用于页面构建器停用后遗留的内容,或以非标准方式加载的插件。 | bool $onstring $id | 免费版 |
tranzly_integrations | 过滤器 | 过滤 Tranzly 运行的集成。添加一个 `Integration` 子类即可支持其他插件。 | 无 | 免费版 |
tranzly_is_pro | 过滤器 | 过滤高级版图层是否正在运行。仅高级版图层会响应该过滤器。 | bool $pro | 免费版 |
tranzly_job_created | 动作 | 在创建翻译任务后触发。 | int $jobint $items | 免费版 |
tranzly_job_finished | 动作 | 在翻译任务没有剩余工作时触发。 | int $job_id | 免费版 |
tranzly_kit_api_base | 过滤器 | 过滤支持页面调用的 Zinn Digital® API 基础 URL。 | string $base | 免费版 |
tranzly_kit_diagnostics | 过滤器 | 在站点所有者查看前过滤诊断信息。插件可在 `extra` 下添加自己的信息。⛔ 此钩子在预览之前运行,绝不会在预览和发送之间运行。 | 无 | 免费版 |
tranzly_kit_footprint_free | 过滤器 | 过滤此站点是否为无足迹(footprint-free),以避免在其上推广 Zinn® Ads。 | bool $footprint_free | 免费版 |
tranzly_kit_promotions | 过滤器 | 在解析前过滤推广注册表。添加一行以推广其他产品:`id`、`kind`(hosting|marketplace|platform|plugin|bundle|ads)、`slot`(promo|cross-sell),以及 `url` 或(针对插件)`name`、`site`、`main_files`。 | 无 | 免费版 |
tranzly_kit_tier | 过滤器 | 过滤工具包为该插件报告的方案层级(用于测试和预发布环境;生产环境由许可证决定)。 | string $tier | 免费版 |
tranzly_localize_links | 过滤器 | 过滤 Tranzly 是否将此页面的内部链接指向其对应的翻译版本。 | bool $localizestring $lang | 免费版 |
tranzly_memory_enabled | 过滤器 | 过滤是否使用翻译记忆库。 | bool $on | 专业版 |
tranzly_microsoft_price_per_million | 过滤器 | 过滤微软翻译(Microsoft Translator)每百万字符的价格(美元)。 | float $price | 专业版 |
tranzly_network_enabled | 过滤器 | 过滤多站点网络层是否已开启。 | bool $agency | 免费版 |
tranzly_pbs_internal_post_types | 过滤器 | 过滤 Tranzly 忽略的 Page Builder Sandwich 文章类型。 | 无 | 免费版 |
tranzly_post_segments | 过滤器 | 过滤发送给引擎的文章分段。格式为 Key => `text` + `format`(`text` 或 `html`)。区块感知解析器及集成在此处添加、拆分或替换分段,并在 `tranzly_translated_post_fields` 上写回它们。 | \WP_Post $post | 免费版 |
tranzly_post_translated | 动作 | 在引擎翻译文章后(或人工文件或导入写入文章后)触发。 | int $targetint $source_idstring $codestring $engine | 免费版 |
tranzly_post_translation_created | 动作 | 在 Tranzly 创建文章翻译后触发。 | int $new_idint $source_idstring $code | 免费版 |
tranzly_post_types | 过滤器 | 过滤 Tranzly 要翻译的文章类型。 | 无 | 免费版 |
tranzly_pre_current_language | 过滤器 | 提前截断当前语言判断:返回语言代码以使用它。tranzly_switch_language() 正是依此运作;返回 null 则由 Tranzly 自行决定。 | string|null $lang | 免费版 |
tranzly_query_var | 过滤器 | 过滤用于选择语言的查询变量。 | string $var | 免费版 |
tranzly_queue_lease_seconds | 过滤器 | 过滤认领项的租约时长(秒):租约过期后,在处理中途崩溃的 Worker 会将该项目归还给其他 Worker。应大于单次翻译的最长时间。 | int $seconds | 免费版 |
tranzly_queue_worker_seconds | 过滤器 | 过滤单个 Worker 在交接前运行的时长(秒)。 | int $seconds | 免费版 |
tranzly_queue_workers | 过滤器 | 过滤单个任务同时运行的 Worker 数量。限制 Worker 数量是为了避免给翻译服务带来过大压力;绝不限制可完成的项目总数。 | int $workersint $job_id | 免费版 |
tranzly_rate_source_ | 过滤器 | 来自其他来源的汇率(参见 `tranzly_rate_sources`)。 | 无 | 专业版 |
tranzly_rate_sources | 过滤器 | 过滤汇率来源。通过 `tranzly_rate_source_<id>` 过滤器添加来源,该过滤器返回 `[ code => 相对于其基准的汇率 ]` 或 WP_Error。 | 无 | 专业版 |
tranzly_register_engines | 动作 | 注册翻译引擎。调用 `$registry->add( new Your_Engine() )`。 | Registry $registry | 免费版 |
tranzly_relations_changed | 动作 | 在对象的翻译关联发生更改后触发:关联、取消关联、移动到其他语言或移除。涉及到的每个组都会触发一次,因此单次关联可能触发两次。 | string $typearray<int> $ids | 免费版 |
tranzly_robots_meta_keys | 过滤器 | 过滤保存 robots 设置的 post meta 键;每个键都会从原文同步到其翻译版本。 | 无 | 免费版 |
tranzly_shared_string_scopes | 过滤器 | 过滤共享文本作用域(泳道 L06、T6:集成可添加 `woocommerce`、`forms` 和 `theme`;对应的文本通过 `tranzly_shared_strings` 传入)。 | 无 | 免费 |
tranzly_shared_strings | 过滤器 | 按作用域过滤 Tranzly 作为字符串翻译的共享文本。Pro 层会将区块模板、模板部件和样板添加到 `templates` 中。 | string $scope | 免费 |
tranzly_shared_strings_covered | 过滤器 | 过滤语言包针对某一语言翻译的共享文本作用域的文本。Pro 层会为 `templates` 报告主题和核心注册的样板。 | string $scopestring $lang | 免费 |
tranzly_source_changed | 动作 | 在原文的可翻译内容发生更改,导致其翻译过时时触发。 | int $post_idstring $nowstring $before | 免费 |
tranzly_source_meta_keys | 过滤器 | 过滤其更改会导致页面翻译过时的元键(meta key)。集成可添加其翻译的键(页面构建器数据、SEO 字段、自定义字段)。 | int $post_id | 免费 |
tranzly_source_published | 动作 | 在原文首次发布时触发一次(在其元数据保存之后)。 | int $post_id | 免费 |
tranzly_style_rules_enabled | 过滤器 | Tranzly 是否对每个新翻译应用该语言的 WordPress.org 翻译团队风格指南规则(引号、标点周围的空格、省略号、日文间隙、称谓代词等)。默认开启。 | bool $enabledstring $locale | 免费 |
tranzly_taxonomies | 过滤器 | 过滤 Tranzly 翻译的分类法。 | 无 | 免费 |
tranzly_term_segments | 过滤器 | 过滤发送到翻译引擎的分类项目片段(`name`、`description`,以及集成添加的任何内容:SEO 标题、自定义字段)。通过 `tranzly_term_translated` 写入添加的片段。 | \WP_Term $term | 免费 |
tranzly_term_translated | 动作 | 在引擎翻译分类项目后触发,包含每个翻译好的片段(集成在此写入其在 `tranzly_term_segments` 中添加的片段)。 | int $targetint $term_idstring $code | 免费 |
tranzly_term_translation_created | 动作 | 在 Tranzly 创建分类项目翻译后触发。 | int $new_idint $term_idstring $code | 免费 |
tranzly_translatable_attributes | 过滤器 | 过滤 Tranzly 为某种区块类型翻译的属性。 | string $block_name | 免费 |
tranzly_translate_string | 过滤器 | 过滤翻译为目标语言的单个可翻译字符串。 | string $valuestring $codearray $context | 免费 |
tranzly_translated_post_fields | 过滤器 | 在引擎运行后,过滤写入翻译中的文章字段。添加了自定义片段(自定义字段、页面构建器数据)的集成在此处写入这些内容。 | \WP_Post $poststring $code | 免费 |
tranzly_translation_memory | 过滤器 | 过滤正在使用的翻译记忆库:免费插件中无;高级层提供此功能(docs/843,WordPress.org 指南 5)。 | Translation_Memory|null $memory | 免费 |