开发者

Tranzly 能力参考

Tranzly 将其操作注册到 WordPress Abilities API。这些相同的能力也是站点自身服务器上的 MCP 工具,以及 /wp-json/wp-abilities/v1 下的 REST 路由。本页面基于插件自身的注册表生成。

用户指南:连接 AI 应用

端点

能力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
为指定内容类型(若未指定,则为所有已翻译类型)的每个原始内容启动后台翻译任务:翻译缺失的、已过期的或全部内容。返回已启动的任务,每种语言一个任务。
ProPOST /wp-json/wp-abilities/v1/abilities/tranzly/bulk-translate/runedit_posts;发布需具备 publish_postslanguages 数组(必填)
post_types 数组
scope 字符串:missing、stale、all
engine 字符串
publish 布尔值
tranzly/cancel-job
停止任务;已完成的翻译内容将予以保留。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/cancel-job/runmanage_options(REST 路由自身的检查)id 字符串(必填)
tranzly/check-quality
让 AI 对比单篇翻译与原文并进行评分,同时将报告保存在该翻译上。使用 Tranzly 工作流设置中配置的质量检查 AI 模型。
ProPOST /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/runmanage_options(REST 路由自身的检查)email 字符串(必填)
name 字符串
consent 布尔值(必填)
tranzly/correct-segments
保存翻译的修正句段(句段:键到文本);修正后的文本将免受重新翻译的影响。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/correct-segments/runedit_post(REST 路由自身的检查)id 字符串(必填)
segments 对象
texts 对象
tranzly/create-job
启动后台任务,将指定的文章列表(posts)或整个文章类型翻译成目标语言(langs)。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/create-job/runedit_posts(REST 路由自身的检查)posts 数组
post_type 字符串
langs 数组(必填)
engine 字符串
status 字符串:publish、draft
force 布尔值
tranzly/create-post-translation
为某篇文章创建特定语言(lang)的草稿翻译,用于手动撰写,无需使用翻译引擎。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/create-post-translation/runREST 路由自身的单项权限检查id 字符串(必填)
lang 字符串(必填)
name 字符串
slug 字符串
description 字符串
tranzly/create-term-translation
使用您提供的名称、别名和描述,创建某个分类法项目的特定语言翻译。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/create-term-translation/runREST 路由自身的单项权限检查id 字符串(必填)
lang 字符串(必填)
name 字符串
slug 字符串
description 字符串
tranzly/disconnect-support
断开本站与支持服务的连接。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/disconnect-support/runmanage_options(REST 路由自身的检查)无
tranzly/estimate
在产生任何费用之前,预估使用引擎将文章(posts 或 post_type)翻译为目标语言(langs)所需的字符数和费用。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/estimate/runedit_posts(REST 路由自身的检查)posts 数组
post_type 字符串
langs 数组(必填)
engine 字符串
tranzly/estimate-bulk
在开始之前,预估某种语言的全站翻译(post_types、scope、engine)。
ProPOST /wp-json/wp-abilities/v1/abilities/tranzly/estimate-bulk/runedit_posts(REST 路由自身的检查)post_types 数组
scope 字符串:missing、stale、all
engine 字符串
lang 字符串(必填)
after 整数
tranzly/export-translation-file
返回包含原文及其对应单语言译文的 XLIFF 或 CSV 文件(作为文本),以供译员或翻译机构使用:支持指定的文章,或某种状态(missing、stale、translated 或 all;可通过 after 分页)下某个内容类型单页最多 100 篇的原文。翻译完成后,同一文件可重新导入。
ProGET /wp-json/wp-abilities/v1/abilities/tranzly/export-translation-file/runedit_posts;仅当用户有权限编辑某篇文章时才会包含该文章lang 字符串(必填)
format 字符串:xliff、csv
posts 数组
post_type 字符串
state 字符串:all、missing、stale、translated
after 整数
tranzly/fix-status
将指定语言和文章类型中每个缺失(或已过期)的项目加入翻译队列。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/fix-status/runedit_posts(REST 路由自带的权限检查)post_type 字符串
lang 字符串(必填)
state 字符串(必填):missing、stale、quality
tranzly/get-comments-setting
返回评论是跨语言共享还是按语言独立保留。
专业版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-comments-setting/runmoderate_comments(REST 路由自带的权限检查)无
tranzly/get-deepl-usage
返回已保存的 DeepL 密钥本月已用字符数及配额上限。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-deepl-usage/runmanage_options(REST 路由自带的权限检查)无
tranzly/get-diagnostics
返回支持工单所需的诊断信息:版本、已启用的插件、限制条件以及近期的错误。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-diagnostics/runmanage_options(REST 路由自带的权限检查)无
tranzly/get-display
返回语言切换器和署名信息显示选项。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-display/runmanage_options(REST 路由自带的权限检查)无
tranzly/get-engine-settings
返回默认及备用引擎、各语言专属引擎与 AI 模型、各引擎状态、已连接的 AI 提供商及其模型,以及本月支出。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-engine-settings/runmanage_options(REST 路由自带的权限检查)无
tranzly/get-glossary
返回不翻译的词汇、固定术语翻译以及每种语言的语气设置。
专业版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-glossary/runmanage_options无
tranzly/get-integrations
列出 Tranzly 支持的 SEO、WooCommerce、页面构建器和表单插件,以及当前站点已启用的插件。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-integrations/runmanage_options(REST 路由自带的权限检查)无
tranzly/get-job
返回单个任务的进度与计数。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-job/runmanage_options(REST 路由自带的权限检查)id 字符串(必填)
tranzly/get-job-failures
列出任务中失败的项目及其失败原因。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-job-failures/runmanage_options(REST 路由自带的权限检查)id 字符串(必填)
tranzly/get-legacy-import
返回从 Tranzly 2.x 导入翻译的状态和报告。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-legacy-import/runmanage_options(REST 路由自带的权限检查)无
tranzly/get-licence
返回本站点的 Tranzly 方案套餐、许可证状态、续费日期以及套餐包含的内容。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-licence/runmanage_options(REST 路由自带的权限检查)无
tranzly/get-menus
返回各语言在各个菜单位置中显示的菜单。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-menus/runedit_theme_options(REST 路由自带的权限检查)无
tranzly/get-post-group
列出文章的翻译关联组:每种语言对应的成员及其标题、状态和编辑链接。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-post-group/runedit_post 和 edit_term(REST 路由自带的权限检查)id 字符串(必填)
tranzly/get-quality-report
返回翻译的 AI 质量报告:评分及被标记的句段。
专业版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-quality-report/runedit_post(REST 路由自带的权限检查)id 字符串(必填)
tranzly/get-segments
并排返回翻译句段与原文句段,以便审核和修改。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-segments/runedit_post(REST 路由自带的权限检查)id 字符串(必填)
tranzly/get-shared-strings
返回指定语言下的主题和插件文本(作用域)及其翻译。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-shared-strings/runedit_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/runmanage_options(REST 路由自带的权限检查)lang 字符串(必填)
tranzly/get-support-connection
说明此站点是否已连接至 Zinn Digital® 支持,以及以何身份连接。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-support-connection/runmanage_options(REST 路由自身的检查)refresh 布尔值
tranzly/get-term-group
列出分类或标签的翻译分组。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-term-group/runedit_post 和 edit_term(REST 路由自身的检查)id 字符串(必填)
tranzly/get-urls
返回语言在地址中的显示方式(目录、子域名或独立域名)、翻译后的别名与基础路径,以及未翻译页面的 noindex 设置。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-urls/runmanage_options(REST 路由自身的检查)无
tranzly/get-workflow-settings
返回发布时和更新时的自动翻译设置、发布前审核,以及 AI 质量检查的阈值、服务提供商和模型。
Pro 版GET /wp-json/wp-abilities/v1/abilities/tranzly/get-workflow-settings/runmanage_options(REST 路由自身的检查)无
tranzly/import-from-source
从另一个多语言插件导入下一页翻译(模式:dry-run 或 run;cursor)。
Pro 版POST /wp-json/wp-abilities/v1/abilities/tranzly/import-from-source/runmanage_options(REST 路由自身的检查)source 字符串(必填)
mode 字符串:dry-run、run、undo
cursor 字符串
tranzly/import-translation-file
从已上传的翻译文件中写入下一页文章(通过 after 重复操作直至完成)。
Pro 版POST /wp-json/wp-abilities/v1/abilities/tranzly/import-translation-file/runedit_posts(REST 路由自身的检查)token 字符串(必填)
after 整数
tranzly/link-post
将现有文章(目标)关联为此文章在某种语言下的翻译。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/link-post/runedit_post 和 edit_term(REST 路由自身的检查)id 字符串(必填)
lang 字符串(必填)
target 整数(必填)
tranzly/link-term
将现有分类项目(目标)关联为此项目在某种语言下的翻译。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/link-term/runedit_post 和 edit_term(REST 路由自身的检查)id 字符串(必填)
lang 字符串(必填)
target 整数(必填)
tranzly/list-engines
列出翻译引擎、各引擎是否已配置,以及未指定时使用的引擎。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/list-engines/runedit_posts无
tranzly/list-import-sources
列出在此站点上发现的、可供导入的 WPML、Polylang 和 TranslatePress 数据。
Pro 版GET /wp-json/wp-abilities/v1/abilities/tranzly/list-import-sources/runmanage_options(REST 路由自身的检查)无
tranzly/list-jobs
按从新到旧顺序列出后台翻译任务及其进度。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/list-jobs/runedit_posts(REST 路由自身的检查)无
tranzly/list-languages
列出站点的语言。第一种语言为原始内容的编写语言。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/list-languages/runedit_posts无
tranzly/list-status-items
逐页列出原文及其在某种语言下的翻译状态(状态:缺失、已过期、最新)。
免费版GET /wp-json/wp-abilities/v1/abilities/tranzly/list-status-items/runedit_posts(REST 路由自身的检查)post_type 字符串
lang 字符串(必填)
state 字符串:all、missing、stale、translated、human、machine、review、quality
after 整数
tranzly/list-theme-strings
列出可扫描翻译文本的主题和插件,以及各自拥有的字符串数量。
Pro 版GET /wp-json/wp-abilities/v1/abilities/tranzly/list-theme-strings/runmanage_options(REST 路由自身的检查)无
tranzly/open-support-ticket
提交支持工单(主题、消息、类型、电子邮件),并在管理员同意时附带此站点的诊断信息。绝不会创建登录信息或发送登录凭据。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/open-support-ticket/runmanage_options(REST 路由自身的检查)subject 字符串(必填)
message 字符串(必填)
kind 字符串:help、bug、feedback、feature_request
email 字符串
name 字符串
diagnostics 布尔值
tranzly/record-support-consent
记录管理员是否同意在支持工单中发送诊断信息。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/record-support-consent/runmanage_options(REST 路由自身的检查)consent 布尔值(必填)
tranzly/retry-job-item
重试失败的项目(操作:retry,可选使用其他引擎)或将其标记为手动翻译(操作:by-hand)。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/retry-job-item/runedit_post 和 manage_options(REST 路由自身的检查)item 字符串(必填)
action 字符串(必填)
engine 字符串
tranzly/review-translation
批准翻译(并在原文已发布时予以发布)或将其退回(decision,note)。
专业版POST /wp-json/wp-abilities/v1/abilities/tranzly/review-translation/runedit_post(REST 路由自身的检查)id 字符串(必填)
decision 字符串(必填):approve、changes、pending
note 字符串
tranzly/run-legacy-import
运行 2.x 导入:预检演练(仅生成报告)、正式运行或撤销。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/run-legacy-import/runmanage_options(REST 路由自身的检查)action 字符串(必填)
tranzly/scan-theme-strings
扫描组件 PHP 文件的下一页以查找可翻译文本(使用 after 重复此操作直至完成)。
专业版POST /wp-json/wp-abilities/v1/abilities/tranzly/scan-theme-strings/runmanage_options(REST 路由自身的检查)component 字符串(必填)
after 整数
tranzly/schedule-quality-check
为某种语言的下一页翻译(或指定的文章)安排 AI 质量检查。
专业版POST /wp-json/wp-abilities/v1/abilities/tranzly/schedule-quality-check/runedit_posts(REST 路由自身的检查)lang 字符串(必填)
post_type 字符串
posts 数组
after 整数
tranzly/seo-audit
逐页检查某种语言的翻译中是否缺失 SEO 标题、描述、别名和 hreflang。
专业版GET /wp-json/wp-abilities/v1/abilities/tranzly/seo-audit/runmanage_options(REST 路由自身的检查)lang 字符串(必填)
after 整数
tranzly/set-comments-setting
在某篇文章的不同语言翻译之间共享评论,或按语言分别保留评论(mode)。
专业版POST /wp-json/wp-abilities/v1/abilities/tranzly/set-comments-setting/runmanage_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/runmanage_options(REST 路由自身的检查)engine 字符串(必填)
key 字符串(必填)
region 字符串
tranzly/set-menus
按语言和位置分配菜单(map)。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/set-menus/runedit_theme_options(REST 路由自身的检查)map 对象(必填)
tranzly/set-protection
保护翻译不被引擎覆盖(protected: true),或取消保护锁定。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/set-protection/runedit_post(REST 路由自身的检查)id 字符串(必填)
protected 布尔值(必填)
tranzly/set-shared-strings
保存修正后的主题和插件文本翻译(strings);这些翻译将被保护锁定。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/set-shared-strings/runedit_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/runedit_theme_options 和 manage_options(REST 路由自身的检查)lang 字符串(必填)
key 字符串(必填)
translation 字符串(必填)
tranzly/set-urls
设置地址模式(mode)、各语言域名、已翻译的基础路径和分段、noindex_untranslated 以及别名建议。
免费版POST /wp-json/wp-abilities/v1/abilities/tranzly/set-urls/runmanage_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/runmanage_options(REST 路由自身的检查)无
tranzly/translate-media-field
以指定语言(lang)保存图像的替代文本、标题或说明(field)。
免费POST /wp-json/wp-abilities/v1/abilities/tranzly/translate-media-field/runedit_post(REST 路由自身的检查)id 字符串(必填)
lang 字符串(必填)
field 字符串(必填):alt、caption、title
translation 字符串(必填)
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/runedit_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/runedit_postslanguages 字符串(必填)
tranzly/translate-term
使用引擎将单个分类项目(分类、标签或产品属性)翻译为指定语言(lang),创建或更新其翻译。
免费POST /wp-json/wp-abilities/v1/abilities/tranzly/translate-term/runREST 路由自身的单项权限检查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/runedit_post 和 edit_term(REST 路由自身的检查)id 字符串(必填)
tranzly/unlink-term
将分类项目移出其翻译组。
免费POST /wp-json/wp-abilities/v1/abilities/tranzly/unlink-term/runedit_post 和 edit_term(REST 路由自身的检查)id 字符串(必填)
tranzly/update-display
更改切换器(样式、旗帜、名称、放置位置)和鸣谢署名。
免费POST /wp-json/wp-abilities/v1/abilities/tranzly/update-display/runmanage_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/runmanage_options(REST 路由自身的检查)default 字符串
per_lang 对象
fallback 数组
caps 对象
models 对象
tranzly/update-glossary
替换您提交的术语表部分内容(从不翻译的词汇、术语翻译、语气);未提交的部分将予以保留。从下一次翻译开始供所有引擎使用。
专业版POST /wp-json/wp-abilities/v1/abilities/tranzly/update-glossary/runmanage_optionsdnt 数组
terms 对象
tone 对象
tranzly/update-settings
设置站点的语言(languages:代码和名称列表;第一个为原始语言)、前端类名前缀以及是否允许 AI 智能体(MCP)。
免费POST /wp-json/wp-abilities/v1/abilities/tranzly/update-settings/runmanage_options(REST 路由自身的检查)prefix 字符串
mcp 布尔值
languages 数组
tranzly/update-workflow-settings
设置 on_update(off、stale、translate)、on_publish、review、quality_threshold、quality_provider 和 quality_model。
ProPOST /wp-json/wp-abilities/v1/abilities/tranzly/update-workflow-settings/runmanage_options(REST 路由的自身检查)on_update string:off、stale、translate
on_publish boolean
review boolean
quality_threshold integer
quality_provider string
quality_model string
tranzly/upload-translation-file
上传在其他位置翻译的 Tranzly XLIFF 或 CSV 文件(content、filename);返回一个用于在导入时识别该上传的令牌。
ProPOST /wp-json/wp-abilities/v1/abilities/tranzly/upload-translation-file/runedit_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=admin
wp tranzly jobs status 12
wp tranzly jobs failures 12
wp tranzly jobs retry 345 --engine=deepl
wp tranzly jobs retry-failed 12
wp 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-run
wp tranzly legacy run
wp tranzly legacy undo
显示、试运行、执行或撤销从旧版 Tranzly (2.x) 站点导入翻译。免费版
wp tranzly link <source> <target> [--term]将现有的文章(或分类法词条)关联为另一篇的翻译。免费版
wp tranzly network <action> [--languages=<codes>]
wp tranzly network setup
wp 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=admin
wp 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 ): arrayTranzly 为某个区块类型翻译的属性名称:其 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 $bar
int $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 $content
string $lang
免费版
tranzly_copy_meta_keys过滤器过滤从文章复制到其新译文中的元键(meta key)。不会复制其他任何内容。int $source_id免费版
tranzly_deepl_host过滤器过滤 DeepL API 主机(代理或测试替身)。string $host
string $key
免费版
tranzly_deepl_price_per_million过滤器过滤 DeepL 每百万字符的价格(美元)。float $price免费版
tranzly_default_engine过滤器过滤未指定引擎时所使用的默认引擎 ID。string $id免费版
tranzly_engine_cap过滤器过滤引擎的每月限额(美元):免费插件中无此项。float|null $cap
string $engine
免费版
tranzly_engine_chain过滤器按顺序过滤某种语言要尝试的引擎。免费版:默认引擎。高级版图层会添加该语言专属的引擎及备用列表。string $lang
string $first
免费版
tranzly_engine_options过滤器过滤传递给引擎的选项(不翻译列表、术语表、正式程度、提示指令)。string $target
Engine $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 $pricePro
tranzly_install_language_packs过滤器Tranzly 是否安装添加到站点的语言所对应的 WordPress、主题和插件语言包(以便 WordPress 和 WooCommerce 自带的词条显示为已翻译)。默认开启。bool $install免费版
tranzly_integration_available过滤器过滤在未检测到某个插件时是否仍运行其集成——适用于页面构建器停用后遗留的内容,或以非标准方式加载的插件。bool $on
string $id
免费版
tranzly_integrations过滤器过滤 Tranzly 运行的集成。添加一个 `Integration` 子类即可支持其他插件。无免费版
tranzly_is_pro过滤器过滤高级版图层是否正在运行。仅高级版图层会响应该过滤器。bool $pro免费版
tranzly_job_created动作在创建翻译任务后触发。int $job
int $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 $localize
string $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 $target
int $source_id
string $code
string $engine
免费版
tranzly_post_translation_created动作在 Tranzly 创建文章翻译后触发。int $new_id
int $source_id
string $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 $workers
int $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 $type
array<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 $scope
string $lang
免费
tranzly_source_changed动作在原文的可翻译内容发生更改,导致其翻译过时时触发。int $post_id
string $now
string $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 $enabled
string $locale
免费
tranzly_taxonomies过滤器过滤 Tranzly 翻译的分类法。无免费
tranzly_term_segments过滤器过滤发送到翻译引擎的分类项目片段(`name`、`description`,以及集成添加的任何内容:SEO 标题、自定义字段)。通过 `tranzly_term_translated` 写入添加的片段。\WP_Term $term免费
tranzly_term_translated动作在引擎翻译分类项目后触发,包含每个翻译好的片段(集成在此写入其在 `tranzly_term_segments` 中添加的片段)。int $target
int $term_id
string $code
免费
tranzly_term_translation_created动作在 Tranzly 创建分类项目翻译后触发。int $new_id
int $term_id
string $code
免费
tranzly_translatable_attributes过滤器过滤 Tranzly 为某种区块类型翻译的属性。string $block_name免费
tranzly_translate_string过滤器过滤翻译为目标语言的单个可翻译字符串。string $value
string $code
array $context
免费
tranzly_translated_post_fields过滤器在引擎运行后,过滤写入翻译中的文章字段。添加了自定义片段(自定义字段、页面构建器数据)的集成在此处写入这些内容。\WP_Post $post
string $code
免费
tranzly_translation_memory过滤器过滤正在使用的翻译记忆库:免费插件中无;高级层提供此功能(docs/843,WordPress.org 指南 5)。Translation_Memory|null $memory免费